From 9b239068be2713ca0bc5a018a788631b22d7e7fd Mon Sep 17 00:00:00 2001 From: EricZijian_Siter Date: Thu, 22 Jun 2023 02:40:51 +1000 Subject: [PATCH] Add the ExpiryDate type to Smoke CO cluster (#27339) * Smoke/CO: Add the type of ExpiryDate * Smoke/CO: Regen zap --------- Co-authored-by: Hare --- .../chip/smoke-co-alarm-cluster.xml | 3 +- .../data_model/controller-clusters.matter | 1 + .../devicecontroller/ClusterIDMapping.java | 1 + .../devicecontroller/ClusterReadMapping.java | 11 +++ .../CHIPAttributeTLVValueDecoder.cpp | 15 ++++ .../chip/devicecontroller/ChipClusters.java | 19 +++++ .../chip/devicecontroller/ChipIdLookup.java | 3 + .../python/chip/clusters/CHIPClusters.py | 6 ++ .../python/chip/clusters/Objects.py | 18 +++++ .../MTRAttributeSpecifiedCheck.mm | 3 + .../MTRAttributeTLVValueDecoder.mm | 11 +++ .../CHIP/zap-generated/MTRBaseClusters.h | 12 +++ .../CHIP/zap-generated/MTRBaseClusters.mm | 43 +++++++++++ .../CHIP/zap-generated/MTRClusterConstants.h | 1 + .../CHIP/zap-generated/MTRClusters.h | 2 + .../CHIP/zap-generated/MTRClusters.mm | 8 ++ .../zap-generated/attributes/Accessors.cpp | 31 ++++++++ .../zap-generated/attributes/Accessors.h | 5 ++ .../zap-generated/cluster-objects.cpp | 3 + .../zap-generated/cluster-objects.h | 13 ++++ .../app-common/zap-generated/ids/Attributes.h | 4 + .../zap-generated/cluster/Commands.h | 5 ++ .../cluster/logging/DataModelLogger.cpp | 5 ++ .../zap-generated/cluster/Commands.h | 73 +++++++++++++++++++ 24 files changed, 294 insertions(+), 2 deletions(-) diff --git a/src/app/zap-templates/zcl/data-model/chip/smoke-co-alarm-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/smoke-co-alarm-cluster.xml index 97404c86a62a39..cf8bb144a8e103 100644 --- a/src/app/zap-templates/zcl/data-model/chip/smoke-co-alarm-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/smoke-co-alarm-cluster.xml @@ -49,8 +49,7 @@ limitations under the License. InterconnectCOAlarm ContaminationState SensitivityLevel - - + ExpiryDate diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index a160909ea05ff4..f20671c20ca3f7 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -3245,6 +3245,7 @@ client cluster SmokeCoAlarm = 92 { readonly attribute optional AlarmStateEnum interconnectCOAlarm = 9; readonly attribute optional ContaminationStateEnum contaminationState = 10; attribute optional SensitivityEnum sensitivityLevel = 11; + readonly attribute optional epoch_s expiryDate = 12; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java index 3cd260b9e1aaf9..6d0a6c01a988ce 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java @@ -7379,6 +7379,7 @@ public enum Attribute { InterconnectCOAlarm(9L), ContaminationState(10L), SensitivityLevel(11L), + ExpiryDate(12L), GeneratedCommandList(65528L), AcceptedCommandList(65529L), EventList(65530L), diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java index 3faa2661db449f..c8237497332929 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java @@ -7182,6 +7182,17 @@ private static Map readSmokeCoAlarmInteractionInfo() { readSmokeCoAlarmSensitivityLevelCommandParams ); result.put("readSensitivityLevelAttribute", readSmokeCoAlarmSensitivityLevelAttributeInteractionInfo); + Map readSmokeCoAlarmExpiryDateCommandParams = new LinkedHashMap(); + InteractionInfo readSmokeCoAlarmExpiryDateAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.SmokeCoAlarmCluster) cluster).readExpiryDateAttribute( + (ChipClusters.LongAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + readSmokeCoAlarmExpiryDateCommandParams + ); + result.put("readExpiryDateAttribute", readSmokeCoAlarmExpiryDateAttributeInteractionInfo); Map readSmokeCoAlarmGeneratedCommandListCommandParams = new LinkedHashMap(); InteractionInfo readSmokeCoAlarmGeneratedCommandListAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index 12585d03b60a16..389c20d685f409 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -14630,6 +14630,21 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR static_cast(cppValue), value); return value; } + case Attributes::ExpiryDate::Id: { + using TypeInfo = Attributes::ExpiryDate::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + cppValue, value); + return value; + } case Attributes::GeneratedCommandList::Id: { using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; TypeInfo::DecodableType cppValue; diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java index 23ca8d6a4308bf..9eae83df98d089 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java @@ -16152,6 +16152,18 @@ public void subscribeSensitivityLevelAttribute( subscribeSensitivityLevelAttribute(chipClusterPtr, callback, minInterval, maxInterval); } + public void readExpiryDateAttribute( + LongAttributeCallback callback + ) { + readExpiryDateAttribute(chipClusterPtr, callback); + } + public void subscribeExpiryDateAttribute( + LongAttributeCallback callback +, + int minInterval, int maxInterval) { + subscribeExpiryDateAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readGeneratedCommandListAttribute( GeneratedCommandListAttributeCallback callback ) { @@ -16310,6 +16322,13 @@ private native void subscribeSensitivityLevelAttribute(long chipClusterPtr, IntegerAttributeCallback callback , int minInterval, int maxInterval); + private native void readExpiryDateAttribute(long chipClusterPtr, + LongAttributeCallback callback + ); + private native void subscribeExpiryDateAttribute(long chipClusterPtr, + LongAttributeCallback callback +, int minInterval, int maxInterval); + private native void readGeneratedCommandListAttribute(long chipClusterPtr, GeneratedCommandListAttributeCallback callback ); diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipIdLookup.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipIdLookup.java index 77bdd9bce58781..aceb25e2c4cfc6 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipIdLookup.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipIdLookup.java @@ -2499,6 +2499,9 @@ public static String attributeIdToName(long clusterId, long attributeId) { if (attributeId == 11L) { return "SensitivityLevel"; } + if (attributeId == 12L) { + return "ExpiryDate"; + } if (attributeId == 65528L) { return "GeneratedCommandList"; } diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index ebcb10cbbb1287..a1ec35a1508b62 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -5091,6 +5091,12 @@ class ChipClusters: "reportable": True, "writable": True, }, + 0x0000000C: { + "attributeName": "ExpiryDate", + "attributeId": 0x0000000C, + "type": "int", + "reportable": True, + }, 0x0000FFF8: { "attributeName": "GeneratedCommandList", "attributeId": 0x0000FFF8, diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index da33a4a753e694..dc93955c7146ee 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -17341,6 +17341,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="interconnectCOAlarm", Tag=0x00000009, Type=typing.Optional[SmokeCoAlarm.Enums.AlarmStateEnum]), ClusterObjectFieldDescriptor(Label="contaminationState", Tag=0x0000000A, Type=typing.Optional[SmokeCoAlarm.Enums.ContaminationStateEnum]), ClusterObjectFieldDescriptor(Label="sensitivityLevel", Tag=0x0000000B, Type=typing.Optional[SmokeCoAlarm.Enums.SensitivityEnum]), + ClusterObjectFieldDescriptor(Label="expiryDate", Tag=0x0000000C, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="eventList", Tag=0x0000FFFA, Type=typing.List[uint]), @@ -17361,6 +17362,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: interconnectCOAlarm: 'typing.Optional[SmokeCoAlarm.Enums.AlarmStateEnum]' = None contaminationState: 'typing.Optional[SmokeCoAlarm.Enums.ContaminationStateEnum]' = None sensitivityLevel: 'typing.Optional[SmokeCoAlarm.Enums.SensitivityEnum]' = None + expiryDate: 'typing.Optional[uint]' = None generatedCommandList: 'typing.List[uint]' = None acceptedCommandList: 'typing.List[uint]' = None eventList: 'typing.List[uint]' = None @@ -17646,6 +17648,22 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'typing.Optional[SmokeCoAlarm.Enums.SensitivityEnum]' = None + @dataclass + class ExpiryDate(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x005C + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000000C + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Optional[uint]) + + value: 'typing.Optional[uint]' = None + @dataclass class GeneratedCommandList(ClusterAttributeDescriptor): @ChipUtility.classproperty diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm index 0920c65ca69499..5b5a8d674feef8 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm @@ -1950,6 +1950,9 @@ static BOOL AttributeIsSpecifiedInSmokeCOAlarmCluster(AttributeId aAttributeId) case Attributes::SensitivityLevel::Id: { return YES; } + case Attributes::ExpiryDate::Id: { + return YES; + } case Attributes::GeneratedCommandList::Id: { return YES; } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index 02563e2e41ee49..fe3d93e2df6ee4 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -9923,6 +9923,17 @@ static id _Nullable DecodeAttributeValueForSmokeCOAlarmCluster( value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; return value; } + case Attributes::ExpiryDate::Id: { + using TypeInfo = Attributes::ExpiryDate::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } case Attributes::GeneratedCommandList::Id: { using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; TypeInfo::DecodableType cppValue; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index bf303f85568dca..cce1fa6ee2ef4c 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -8450,6 +8450,18 @@ MTR_NEWLY_AVAILABLE completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_NEWLY_AVAILABLE; +- (void)readAttributeExpiryDateWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion + MTR_NEWLY_AVAILABLE; +- (void)subscribeAttributeExpiryDateWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler + MTR_NEWLY_AVAILABLE; ++ (void)readAttributeExpiryDateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion + MTR_NEWLY_AVAILABLE; + - (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_NEWLY_AVAILABLE; - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams *)params diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index cdf9f56791411a..dcbca92c2893a0 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -49735,6 +49735,49 @@ + (void)readAttributeSensitivityLevelWithClusterStateCache:(MTRClusterStateCache }); } +- (void)readAttributeExpiryDateWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + MTRReadParams * params = [[MTRReadParams alloc] init]; + using TypeInfo = SmokeCoAlarm::Attributes::ExpiryDate::TypeInfo; + return MTRReadAttribute( + params, completion, self.callbackQueue, self.device, self->_endpoint, TypeInfo::GetClusterId(), TypeInfo::GetAttributeId()); +} + +- (void)subscribeAttributeExpiryDateWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = SmokeCoAlarm::Attributes::ExpiryDate::TypeInfo; + MTRSubscribeAttribute(params, + subscriptionEstablished, reportHandler, self.callbackQueue, self.device, self->_endpoint, TypeInfo::GetClusterId(), + TypeInfo::GetAttributeId()); +} + ++ (void)readAttributeExpiryDateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + auto * bridge = new MTRInt32uAttributeCallbackBridge(queue, completion); + std::move(*bridge).DispatchLocalAction( + clusterStateCacheContainer.baseDevice, ^(Int32uAttributeCallback successCb, MTRErrorCallback failureCb) { + if (clusterStateCacheContainer.cppClusterStateCache) { + chip::app::ConcreteAttributePath path; + using TypeInfo = SmokeCoAlarm::Attributes::ExpiryDate::TypeInfo; + path.mEndpointId = static_cast([endpoint unsignedShortValue]); + path.mClusterId = TypeInfo::GetClusterId(); + path.mAttributeId = TypeInfo::GetAttributeId(); + TypeInfo::DecodableType value; + CHIP_ERROR err = clusterStateCacheContainer.cppClusterStateCache->Get(path, value); + if (err == CHIP_NO_ERROR) { + successCb(bridge, value); + } + return err; + } + return CHIP_ERROR_NOT_FOUND; + }); +} + - (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { MTRReadParams * params = [[MTRReadParams alloc] init]; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index 0e06ba47e07b3f..22cf891d137b35 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -3794,6 +3794,7 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterSmokeCOAlarmAttributeInterconnectCOAlarmID MTR_NEWLY_AVAILABLE = 0x00000009, MTRAttributeIDTypeClusterSmokeCOAlarmAttributeContaminationStateID MTR_NEWLY_AVAILABLE = 0x0000000A, MTRAttributeIDTypeClusterSmokeCOAlarmAttributeSensitivityLevelID MTR_NEWLY_AVAILABLE = 0x0000000B, + MTRAttributeIDTypeClusterSmokeCOAlarmAttributeExpiryDateID MTR_NEWLY_AVAILABLE = 0x0000000C, MTRAttributeIDTypeClusterSmokeCOAlarmAttributeGeneratedCommandListID MTR_NEWLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID, MTRAttributeIDTypeClusterSmokeCOAlarmAttributeAcceptedCommandListID MTR_NEWLY_AVAILABLE diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index dcc4a1916f0fe1..6b5575ae7d7a8e 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -2961,6 +2961,8 @@ MTR_NEWLY_AVAILABLE expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_NEWLY_AVAILABLE; +- (NSDictionary *)readAttributeExpiryDateWithParams:(MTRReadParams * _Nullable)params MTR_NEWLY_AVAILABLE; + - (NSDictionary *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_NEWLY_AVAILABLE; - (NSDictionary *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_NEWLY_AVAILABLE; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm index 2f1684e89b3480..2af744a894e0e3 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -13446,6 +13446,14 @@ - (void)writeAttributeSensitivityLevelWithValue:(NSDictionary *) timedWriteTimeout:timedWriteTimeout]; } +- (NSDictionary *)readAttributeExpiryDateWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(_endpoint) + clusterID:@(MTRClusterIDTypeSmokeCOAlarmID) + attributeID:@(MTRAttributeIDTypeClusterSmokeCOAlarmAttributeExpiryDateID) + params:params]; +} + - (NSDictionary *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:@(_endpoint) diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp index ef50827f38f950..09fb0643ff9688 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp @@ -9303,6 +9303,37 @@ EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::SmokeCoAlarm:: } // namespace SensitivityLevel +namespace ExpiryDate { + +EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::SmokeCoAlarm::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + *value = Traits::StorageToWorking(temp); + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::SmokeCoAlarm::Id, Id, writable, ZCL_EPOCH_S_ATTRIBUTE_TYPE); +} + +} // namespace ExpiryDate + namespace FeatureMap { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h index dd71aa3fea6314..80d2f6a4dddf1a 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h @@ -1744,6 +1744,11 @@ EmberAfStatus Get(chip::EndpointId endpoint, chip::app::Clusters::SmokeCoAlarm:: EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::SmokeCoAlarm::SensitivityEnum value); } // namespace SensitivityLevel +namespace ExpiryDate { +EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // epoch_s +EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); +} // namespace ExpiryDate + namespace FeatureMap { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp index d000e28af8987a..9fb3fd0ff82f4e 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp @@ -12622,6 +12622,9 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre case Attributes::SensitivityLevel::TypeInfo::GetAttributeId(): ReturnErrorOnFailure(DataModel::Decode(reader, sensitivityLevel)); break; + case Attributes::ExpiryDate::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, expiryDate)); + break; case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); break; diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h index 7d386143d47cf9..2337d70af2b895 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h @@ -16014,6 +16014,18 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace SensitivityLevel +namespace ExpiryDate { +struct TypeInfo +{ + using Type = uint32_t; + using DecodableType = uint32_t; + using DecodableArgType = uint32_t; + + static constexpr ClusterId GetClusterId() { return Clusters::SmokeCoAlarm::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::ExpiryDate::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace ExpiryDate namespace GeneratedCommandList { struct TypeInfo : public Clusters::Globals::Attributes::GeneratedCommandList::TypeInfo { @@ -16080,6 +16092,7 @@ struct TypeInfo static_cast(0); Attributes::SensitivityLevel::TypeInfo::DecodableType sensitivityLevel = static_cast(0); + Attributes::ExpiryDate::TypeInfo::DecodableType expiryDate = static_cast(0); Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; Attributes::EventList::TypeInfo::DecodableType eventList; diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h index a20b6cd0022bff..ac4a7532f1e8d8 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h @@ -2920,6 +2920,10 @@ namespace SensitivityLevel { static constexpr AttributeId Id = 0x0000000B; } // namespace SensitivityLevel +namespace ExpiryDate { +static constexpr AttributeId Id = 0x0000000C; +} // namespace ExpiryDate + namespace GeneratedCommandList { static constexpr AttributeId Id = Globals::Attributes::GeneratedCommandList::Id; } // namespace GeneratedCommandList diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index bc33ea2a4d5c96..8b6994c1505de2 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -4470,6 +4470,7 @@ class DishwasherModeChangeToMode : public ClusterCommand | * InterconnectCOAlarm | 0x0009 | | * ContaminationState | 0x000A | | * SensitivityLevel | 0x000B | +| * ExpiryDate | 0x000C | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -15261,6 +15262,7 @@ void registerClusterSmokeCoAlarm(Commands & commands, CredentialIssuerCommands * make_unique(Id, "interconnect-coalarm", Attributes::InterconnectCOAlarm::Id, credsIssuerConfig), // make_unique(Id, "contamination-state", Attributes::ContaminationState::Id, credsIssuerConfig), // make_unique(Id, "sensitivity-level", Attributes::SensitivityLevel::Id, credsIssuerConfig), // + make_unique(Id, "expiry-date", Attributes::ExpiryDate::Id, credsIssuerConfig), // make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // @@ -15298,6 +15300,8 @@ void registerClusterSmokeCoAlarm(Commands & commands, CredentialIssuerCommands * make_unique>( Id, "sensitivity-level", 0, UINT8_MAX, Attributes::SensitivityLevel::Id, WriteCommandType::kWrite, credsIssuerConfig), // + make_unique>(Id, "expiry-date", 0, UINT32_MAX, Attributes::ExpiryDate::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>( Id, "generated-command-list", Attributes::GeneratedCommandList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // @@ -15325,6 +15329,7 @@ void registerClusterSmokeCoAlarm(Commands & commands, CredentialIssuerCommands * make_unique(Id, "interconnect-coalarm", Attributes::InterconnectCOAlarm::Id, credsIssuerConfig), // make_unique(Id, "contamination-state", Attributes::ContaminationState::Id, credsIssuerConfig), // make_unique(Id, "sensitivity-level", Attributes::SensitivityLevel::Id, credsIssuerConfig), // + make_unique(Id, "expiry-date", Attributes::ExpiryDate::Id, credsIssuerConfig), // make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index 071648f097ff34..9a73b13a7d1dfe 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -8450,6 +8450,11 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("SensitivityLevel", 1, value); } + case SmokeCoAlarm::Attributes::ExpiryDate::Id: { + uint32_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ExpiryDate", 1, value); + } case SmokeCoAlarm::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); diff --git a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h index 16b8371bd637f3..476299e289fbdd 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -42618,6 +42618,7 @@ class SubscribeAttributeAirQualityClusterRevision : public SubscribeAttribute { | * InterconnectCOAlarm | 0x0009 | | * ContaminationState | 0x000A | | * SensitivityLevel | 0x000B | +| * ExpiryDate | 0x000C | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -43562,6 +43563,76 @@ class SubscribeAttributeSmokeCoAlarmSensitivityLevel : public SubscribeAttribute } }; +/* + * Attribute ExpiryDate + */ +class ReadSmokeCoAlarmExpiryDate : public ReadAttribute { +public: + ReadSmokeCoAlarmExpiryDate() + : ReadAttribute("expiry-date") + { + } + + ~ReadSmokeCoAlarmExpiryDate() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000005C) ReadAttribute (0x0000000C) on endpoint %u", endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeExpiryDateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"SmokeCOAlarm.ExpiryDate response %@", [value description]); + if (error != nil) { + LogNSError("SmokeCOAlarm ExpiryDate read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeSmokeCoAlarmExpiryDate : public SubscribeAttribute { +public: + SubscribeAttributeSmokeCoAlarmExpiryDate() + : SubscribeAttribute("expiry-date") + { + } + + ~SubscribeAttributeSmokeCoAlarmExpiryDate() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000005C) ReportAttribute (0x0000000C) on endpoint %u", endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeExpiryDateWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"SmokeCOAlarm.ExpiryDate response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + /* * Attribute GeneratedCommandList */ @@ -122532,6 +122603,8 @@ void registerClusterSmokeCoAlarm(Commands & commands) make_unique(), // make_unique(), // make_unique(), // + make_unique(), // + make_unique(), // make_unique(), // make_unique(), // make_unique(), //