From 109394840fad4fc328f045475e87b3e14474aea5 Mon Sep 17 00:00:00 2001 From: Rohit Jadhav <69809379+jadhavrohit924@users.noreply.github.com> Date: Sat, 24 Jun 2023 00:30:31 +0530 Subject: [PATCH] Add supported attribute to refrigerator alarm cluster xml (#27433) * Add supported attribute to refrigerator alarm cluster xml * Zap regen --- .../all-clusters-common/all-clusters-app.zap | 6 +- .../data-model/chip/refrigerator-alarm.xml | 3 +- src/app/zap_cluster_list.json | 4 +- .../data_model/controller-clusters.matter | 1 + .../data_model/controller-clusters.zap | 6 +- .../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/MTRCallbackBridge.h | 32 ++++++++ .../CHIP/zap-generated/MTRCallbackBridge.mm | 23 ++++++ .../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 | 14 ++++ .../app-common/zap-generated/ids/Attributes.h | 4 + .../app-common/zap-generated/print-cluster.h | 8 +- .../zap-generated/cluster/Commands.h | 5 ++ .../cluster/logging/DataModelLogger.cpp | 5 ++ .../zap-generated/cluster/Commands.h | 73 +++++++++++++++++++ 30 files changed, 363 insertions(+), 13 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index d2e55f8f6dd442..c5e15ce673f529 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -13080,7 +13080,7 @@ "name": "Refrigerator Alarm", "code": 87, "mfgCode": null, - "define": "REFRIGERATOR_ALARM", + "define": "REFRIGERATOR_ALARM_CLUSTER", "side": "client", "enabled": 0, "attributes": [ @@ -13122,7 +13122,7 @@ "name": "Refrigerator Alarm", "code": 87, "mfgCode": null, - "define": "REFRIGERATOR_ALARM", + "define": "REFRIGERATOR_ALARM_CLUSTER", "side": "server", "enabled": 1, "attributes": [ @@ -32125,4 +32125,4 @@ } ], "log": [] -} \ No newline at end of file +} diff --git a/src/app/zap-templates/zcl/data-model/chip/refrigerator-alarm.xml b/src/app/zap-templates/zcl/data-model/chip/refrigerator-alarm.xml index da478ae2347961..7cc27383a91bcf 100644 --- a/src/app/zap-templates/zcl/data-model/chip/refrigerator-alarm.xml +++ b/src/app/zap-templates/zcl/data-model/chip/refrigerator-alarm.xml @@ -25,11 +25,12 @@ limitations under the License. Appliances Attributes and commands for configuring the Refrigerator alarm. 0x0057 - REFRIGERATOR_ALARM + REFRIGERATOR_ALARM_CLUSTER true true Mask State + Supported Notify diff --git a/src/app/zap_cluster_list.json b/src/app/zap_cluster_list.json index 6975c5cfe70164..4a005bd706ee68 100644 --- a/src/app/zap_cluster_list.json +++ b/src/app/zap_cluster_list.json @@ -109,7 +109,7 @@ "PWM_CLUSTER": [], "REFRIGERATOR_AND_TEMPERATURE_CONTROLLED_CABINET_MODE_CLUSTER": [], "RADON_CONCENTRATION_MEASUREMENT_CLUSTER": [], - "REFRIGERATOR_ALARM": [], + "REFRIGERATOR_ALARM_CLUSTER": [], "RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER": [], "RVC_CLEAN_MODE_CLUSTER": [], "RVC_RUN_MODE_CLUSTER": [], @@ -263,7 +263,7 @@ ], "PWM_CLUSTER": [], "RADON_CONCENTRATION_MEASUREMENT_CLUSTER": [], - "REFRIGERATOR_ALARM": ["refrigerator-alarm-server"], + "REFRIGERATOR_ALARM_CLUSTER": ["refrigerator-alarm-server"], "REFRIGERATOR_AND_TEMPERATURE_CONTROLLED_CABINET_MODE_CLUSTER": [ "mode-select-server" ], diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index f20671c20ca3f7..e3c54ed2523660 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -3068,6 +3068,7 @@ client cluster RefrigeratorAlarm = 87 { readonly attribute AlarmMap mask = 0; readonly attribute AlarmMap state = 2; + readonly attribute AlarmMap supported = 3; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap index 4f78819037b7ef..0a357eb62955c7 100644 --- a/src/controller/data_model/controller-clusters.zap +++ b/src/controller/data_model/controller-clusters.zap @@ -11913,7 +11913,7 @@ "name": "Refrigerator Alarm", "code": 87, "mfgCode": null, - "define": "REFRIGERATOR_ALARM", + "define": "REFRIGERATOR_ALARM_CLUSTER", "side": "client", "enabled": 1, "attributes": [ @@ -11955,7 +11955,7 @@ "name": "Refrigerator Alarm", "code": 87, "mfgCode": null, - "define": "REFRIGERATOR_ALARM", + "define": "REFRIGERATOR_ALARM_CLUSTER", "side": "server", "enabled": 0, "attributes": [ @@ -38914,4 +38914,4 @@ } ], "log": [] -} \ No newline at end of file +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java index 6d0a6c01a988ce..fc0b38b9bb4380 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java @@ -7043,6 +7043,7 @@ public long getID() { public enum Attribute { Mask(0L), State(2L), + Supported(3L), 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 c8237497332929..948295592f8450 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java @@ -6785,6 +6785,17 @@ private static Map readRefrigeratorAlarmInteractionInfo readRefrigeratorAlarmStateCommandParams ); result.put("readStateAttribute", readRefrigeratorAlarmStateAttributeInteractionInfo); + Map readRefrigeratorAlarmSupportedCommandParams = new LinkedHashMap(); + InteractionInfo readRefrigeratorAlarmSupportedAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.RefrigeratorAlarmCluster) cluster).readSupportedAttribute( + (ChipClusters.LongAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + readRefrigeratorAlarmSupportedCommandParams + ); + result.put("readSupportedAttribute", readRefrigeratorAlarmSupportedAttributeInteractionInfo); Map readRefrigeratorAlarmGeneratedCommandListCommandParams = new LinkedHashMap(); InteractionInfo readRefrigeratorAlarmGeneratedCommandListAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index 389c20d685f409..f2779bf1a8b339 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -13871,6 +13871,21 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR cppValue.Raw(), value); return value; } + case Attributes::Supported::Id: { + using TypeInfo = Attributes::Supported::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.Raw(), 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 9eae83df98d089..f999a2d15b3889 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java @@ -15387,6 +15387,18 @@ public void subscribeStateAttribute( subscribeStateAttribute(chipClusterPtr, callback, minInterval, maxInterval); } + public void readSupportedAttribute( + LongAttributeCallback callback + ) { + readSupportedAttribute(chipClusterPtr, callback); + } + public void subscribeSupportedAttribute( + LongAttributeCallback callback +, + int minInterval, int maxInterval) { + subscribeSupportedAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readGeneratedCommandListAttribute( GeneratedCommandListAttributeCallback callback ) { @@ -15473,6 +15485,13 @@ private native void subscribeStateAttribute(long chipClusterPtr, LongAttributeCallback callback , int minInterval, int maxInterval); + private native void readSupportedAttribute(long chipClusterPtr, + LongAttributeCallback callback + ); + private native void subscribeSupportedAttribute(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 aceb25e2c4cfc6..1e0ad3a7b2f76d 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipIdLookup.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipIdLookup.java @@ -2385,6 +2385,9 @@ public static String attributeIdToName(long clusterId, long attributeId) { if (attributeId == 2L) { return "State"; } + if (attributeId == 3L) { + return "Supported"; + } if (attributeId == 65528L) { return "GeneratedCommandList"; } diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index a1ec35a1508b62..e05ea26f35bd49 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -4841,6 +4841,12 @@ class ChipClusters: "type": "int", "reportable": True, }, + 0x00000003: { + "attributeName": "Supported", + "attributeId": 0x00000003, + "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 dc93955c7146ee..51d61c3802f5f8 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -16711,6 +16711,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: Fields=[ ClusterObjectFieldDescriptor(Label="mask", Tag=0x00000000, Type=uint), ClusterObjectFieldDescriptor(Label="state", Tag=0x00000002, Type=uint), + ClusterObjectFieldDescriptor(Label="supported", Tag=0x00000003, Type=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]), @@ -16721,6 +16722,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: mask: 'uint' = None state: 'uint' = None + supported: 'uint' = None generatedCommandList: 'typing.List[uint]' = None acceptedCommandList: 'typing.List[uint]' = None eventList: 'typing.List[uint]' = None @@ -16765,6 +16767,22 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'uint' = 0 + @dataclass + class Supported(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0057 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000003 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + @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 5b5a8d674feef8..56b9165a20891f 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm @@ -1857,6 +1857,9 @@ static BOOL AttributeIsSpecifiedInRefrigeratorAlarmCluster(AttributeId aAttribut case Attributes::State::Id: { return YES; } + case Attributes::Supported::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 fe3d93e2df6ee4..d433f7686bbb09 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -9502,6 +9502,17 @@ static id _Nullable DecodeAttributeValueForRefrigeratorAlarmCluster( value = [NSNumber numberWithUnsignedInt:cppValue.Raw()]; return value; } + case Attributes::Supported::Id: { + using TypeInfo = Attributes::Supported::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue.Raw()]; + 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 cce1fa6ee2ef4c..d026b7fe5d9dac 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -8102,6 +8102,18 @@ MTR_NEWLY_AVAILABLE completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_NEWLY_AVAILABLE; +- (void)readAttributeSupportedWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion + MTR_NEWLY_AVAILABLE; +- (void)subscribeAttributeSupportedWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler + MTR_NEWLY_AVAILABLE; ++ (void)readAttributeSupportedWithClusterStateCache:(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 dcbca92c2893a0..41d6c11041776d 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -48528,6 +48528,49 @@ + (void)readAttributeStateWithClusterStateCache:(MTRClusterStateCacheContainer * }); } +- (void)readAttributeSupportedWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + MTRReadParams * params = [[MTRReadParams alloc] init]; + using TypeInfo = RefrigeratorAlarm::Attributes::Supported::TypeInfo; + return MTRReadAttribute( + params, completion, self.callbackQueue, self.device, self->_endpoint, TypeInfo::GetClusterId(), TypeInfo::GetAttributeId()); +} + +- (void)subscribeAttributeSupportedWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = RefrigeratorAlarm::Attributes::Supported::TypeInfo; + MTRSubscribeAttribute( + params, subscriptionEstablished, reportHandler, self.callbackQueue, self.device, self->_endpoint, TypeInfo::GetClusterId(), + TypeInfo::GetAttributeId()); +} + ++ (void)readAttributeSupportedWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + auto * bridge = new MTRRefrigeratorAlarmSupportedAttributeCallbackBridge(queue, completion); + std::move(*bridge).DispatchLocalAction(clusterStateCacheContainer.baseDevice, + ^(RefrigeratorAlarmSupportedAttributeCallback successCb, MTRErrorCallback failureCb) { + if (clusterStateCacheContainer.cppClusterStateCache) { + chip::app::ConcreteAttributePath path; + using TypeInfo = RefrigeratorAlarm::Attributes::Supported::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/MTRCallbackBridge.h b/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.h index e239e1f9d503eb..a1e9a2fb5ec3b1 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.h @@ -1179,6 +1179,8 @@ typedef void (*TemperatureControlAttributeListListAttributeCallback)( void * context, const chip::app::DataModel::DecodableList & data); typedef void (*RefrigeratorAlarmMaskAttributeCallback)(void *, chip::BitMask); typedef void (*RefrigeratorAlarmStateAttributeCallback)(void *, chip::BitMask); +typedef void (*RefrigeratorAlarmSupportedAttributeCallback)(void *, + chip::BitMask); typedef void (*RefrigeratorAlarmGeneratedCommandListListAttributeCallback)( void * context, const chip::app::DataModel::DecodableList & data); typedef void (*RefrigeratorAlarmAcceptedCommandListListAttributeCallback)( @@ -8934,6 +8936,36 @@ class MTRRefrigeratorAlarmStateAttributeCallbackSubscriptionBridge : public MTRR MTRSubscriptionEstablishedHandler mEstablishedHandler; }; +class MTRRefrigeratorAlarmSupportedAttributeCallbackBridge : public MTRCallbackBridge +{ +public: + MTRRefrigeratorAlarmSupportedAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler) : + MTRCallbackBridge(queue, handler, OnSuccessFn){}; + + MTRRefrigeratorAlarmSupportedAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, MTRActionBlock action) : + MTRCallbackBridge(queue, handler, action, OnSuccessFn){}; + + static void OnSuccessFn(void * context, chip::BitMask value); +}; + +class MTRRefrigeratorAlarmSupportedAttributeCallbackSubscriptionBridge : public MTRRefrigeratorAlarmSupportedAttributeCallbackBridge +{ +public: + MTRRefrigeratorAlarmSupportedAttributeCallbackSubscriptionBridge(dispatch_queue_t queue, ResponseHandler handler, + MTRActionBlock action, + MTRSubscriptionEstablishedHandler establishedHandler) : + MTRRefrigeratorAlarmSupportedAttributeCallbackBridge(queue, handler, action), + mEstablishedHandler(establishedHandler) + {} + + void OnSubscriptionEstablished(); + using MTRRefrigeratorAlarmSupportedAttributeCallbackBridge::KeepAliveOnCallback; + using MTRRefrigeratorAlarmSupportedAttributeCallbackBridge::OnDone; + +private: + MTRSubscriptionEstablishedHandler mEstablishedHandler; +}; + class MTRRefrigeratorAlarmGeneratedCommandListListAttributeCallbackBridge : public MTRCallbackBridge { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.mm index 2a0dd1d620c47e..ff249bb32b2d4f 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.mm @@ -8446,6 +8446,29 @@ } } +void MTRRefrigeratorAlarmSupportedAttributeCallbackBridge::OnSuccessFn( + void * context, chip::BitMask value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedInt:value.Raw()]; + DispatchSuccess(context, objCValue); +}; + +void MTRRefrigeratorAlarmSupportedAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished() +{ + if (!mQueue) { + return; + } + + if (mEstablishedHandler != nil) { + dispatch_async(mQueue, mEstablishedHandler); + // On failure, mEstablishedHandler will be cleaned up by our destructor, + // but we can clean it up earlier on successful subscription + // establishment. + mEstablishedHandler = nil; + } +} + void MTRRefrigeratorAlarmGeneratedCommandListListAttributeCallbackBridge::OnSuccessFn( void * context, const chip::app::DataModel::DecodableList & value) { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index 22cf891d137b35..613c97c0c2a9df 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -3755,6 +3755,7 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { // Cluster RefrigeratorAlarm attributes MTRAttributeIDTypeClusterRefrigeratorAlarmAttributeMaskID MTR_NEWLY_AVAILABLE = 0x00000000, MTRAttributeIDTypeClusterRefrigeratorAlarmAttributeStateID MTR_NEWLY_AVAILABLE = 0x00000002, + MTRAttributeIDTypeClusterRefrigeratorAlarmAttributeSupportedID MTR_NEWLY_AVAILABLE = 0x00000003, MTRAttributeIDTypeClusterRefrigeratorAlarmAttributeGeneratedCommandListID MTR_NEWLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID, MTRAttributeIDTypeClusterRefrigeratorAlarmAttributeAcceptedCommandListID MTR_NEWLY_AVAILABLE diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index 6b5575ae7d7a8e..4d6e5d72a5d565 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -2865,6 +2865,8 @@ MTR_NEWLY_AVAILABLE - (NSDictionary *)readAttributeStateWithParams:(MTRReadParams * _Nullable)params MTR_NEWLY_AVAILABLE; +- (NSDictionary *)readAttributeSupportedWithParams:(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 2af744a894e0e3..3b7d52bd39b26f 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -13117,6 +13117,14 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpoi params:params]; } +- (NSDictionary *)readAttributeSupportedWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(_endpoint) + clusterID:@(MTRClusterIDTypeRefrigeratorAlarmID) + attributeID:@(MTRAttributeIDTypeClusterRefrigeratorAlarmAttributeSupportedID) + 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 09fb0643ff9688..9d40a30973a38d 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 @@ -8559,6 +8559,37 @@ EmberAfStatus Set(chip::EndpointId endpoint, chip::BitMask * value) +{ + using Traits = NumericAttributeTraits>; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::RefrigeratorAlarm::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, chip::BitMask 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::RefrigeratorAlarm::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); +} + +} // namespace Supported + 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 80d2f6a4dddf1a..775425d4a0a93d 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 @@ -1611,6 +1611,11 @@ EmberAfStatus Get(chip::EndpointId endpoint, chip::BitMask value); } // namespace State +namespace Supported { +EmberAfStatus Get(chip::EndpointId endpoint, chip::BitMask * value); // AlarmMap +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitMask value); +} // namespace Supported + 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 9fb3fd0ff82f4e..c702047822a7d8 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 @@ -12293,6 +12293,9 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre case Attributes::State::TypeInfo::GetAttributeId(): ReturnErrorOnFailure(DataModel::Decode(reader, state)); break; + case Attributes::Supported::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, supported)); + 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 2337d70af2b895..fded9ec775c322 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 @@ -15447,6 +15447,18 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace State +namespace Supported { +struct TypeInfo +{ + using Type = chip::BitMask; + using DecodableType = chip::BitMask; + using DecodableArgType = chip::BitMask; + + static constexpr ClusterId GetClusterId() { return Clusters::RefrigeratorAlarm::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::Supported::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace Supported namespace GeneratedCommandList { struct TypeInfo : public Clusters::Globals::Attributes::GeneratedCommandList::TypeInfo { @@ -15496,6 +15508,8 @@ struct TypeInfo static_cast>(0); Attributes::State::TypeInfo::DecodableType state = static_cast>(0); + Attributes::Supported::TypeInfo::DecodableType supported = + 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 ac4a7532f1e8d8..8e5a2b524c5f31 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 @@ -2762,6 +2762,10 @@ namespace State { static constexpr AttributeId Id = 0x00000002; } // namespace State +namespace Supported { +static constexpr AttributeId Id = 0x00000003; +} // namespace Supported + namespace GeneratedCommandList { static constexpr AttributeId Id = Globals::Attributes::GeneratedCommandList::Id; } // namespace GeneratedCommandList diff --git a/zzz_generated/app-common/app-common/zap-generated/print-cluster.h b/zzz_generated/app-common/app-common/zap-generated/print-cluster.h index 3052095d47d1a9..59c7a06a25bdbb 100644 --- a/zzz_generated/app-common/app-common/zap-generated/print-cluster.h +++ b/zzz_generated/app-common/app-common/zap-generated/print-cluster.h @@ -331,10 +331,10 @@ #define CHIP_PRINTCLUSTER_TEMPERATURE_CONTROL_CLUSTER #endif -#if defined(ZCL_USING_REFRIGERATOR_ALARM_SERVER) || defined(ZCL_USING_REFRIGERATOR_ALARM_CLIENT) -#define CHIP_PRINTCLUSTER_REFRIGERATOR_ALARM { chip::app::Clusters::RefrigeratorAlarm::Id, "Refrigerator Alarm" }, +#if defined(ZCL_USING_REFRIGERATOR_ALARM_CLUSTER_SERVER) || defined(ZCL_USING_REFRIGERATOR_ALARM_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_REFRIGERATOR_ALARM_CLUSTER { chip::app::Clusters::RefrigeratorAlarm::Id, "Refrigerator Alarm" }, #else -#define CHIP_PRINTCLUSTER_REFRIGERATOR_ALARM +#define CHIP_PRINTCLUSTER_REFRIGERATOR_ALARM_CLUSTER #endif #if defined(ZCL_USING_DISHWASHER_MODE_CLUSTER_SERVER) || defined(ZCL_USING_DISHWASHER_MODE_CLUSTER_CLIENT) @@ -977,7 +977,7 @@ CHIP_PRINTCLUSTER_RVC_RUN_MODE_CLUSTER \ CHIP_PRINTCLUSTER_RVC_CLEAN_MODE_CLUSTER \ CHIP_PRINTCLUSTER_TEMPERATURE_CONTROL_CLUSTER \ - CHIP_PRINTCLUSTER_REFRIGERATOR_ALARM \ + CHIP_PRINTCLUSTER_REFRIGERATOR_ALARM_CLUSTER \ CHIP_PRINTCLUSTER_DISHWASHER_MODE_CLUSTER \ CHIP_PRINTCLUSTER_AIR_QUALITY_CLUSTER \ CHIP_PRINTCLUSTER_SMOKE_CO_ALARM_CLUSTER \ diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 8b6994c1505de2..cf8ff0e172bc26 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -4372,6 +4372,7 @@ class TemperatureControlSetTemperature : public ClusterCommand | Attributes: | | | * Mask | 0x0000 | | * State | 0x0002 | +| * Supported | 0x0003 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -15066,6 +15067,7 @@ void registerClusterRefrigeratorAlarm(Commands & commands, CredentialIssuerComma make_unique(Id, credsIssuerConfig), // make_unique(Id, "mask", Attributes::Mask::Id, credsIssuerConfig), // make_unique(Id, "state", Attributes::State::Id, credsIssuerConfig), // + make_unique(Id, "supported", Attributes::Supported::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), // @@ -15077,6 +15079,8 @@ void registerClusterRefrigeratorAlarm(Commands & commands, CredentialIssuerComma Id, "mask", 0, UINT32_MAX, Attributes::Mask::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>( Id, "state", 0, UINT32_MAX, Attributes::State::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "supported", 0, UINT32_MAX, Attributes::Supported::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>( Id, "generated-command-list", Attributes::GeneratedCommandList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // @@ -15093,6 +15097,7 @@ void registerClusterRefrigeratorAlarm(Commands & commands, CredentialIssuerComma make_unique(Id, credsIssuerConfig), // make_unique(Id, "mask", Attributes::Mask::Id, credsIssuerConfig), // make_unique(Id, "state", Attributes::State::Id, credsIssuerConfig), // + make_unique(Id, "supported", Attributes::Supported::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 9a73b13a7d1dfe..e66c47e327fd73 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -8256,6 +8256,11 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("State", 1, value); } + case RefrigeratorAlarm::Attributes::Supported::Id: { + chip::BitMask value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("Supported", 1, value); + } case RefrigeratorAlarm::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 476299e289fbdd..5c26e91d4e1764 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -41521,6 +41521,7 @@ class SubscribeAttributeTemperatureControlClusterRevision : public SubscribeAttr | Attributes: | | | * Mask | 0x0000 | | * State | 0x0002 | +| * Supported | 0x0003 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -41672,6 +41673,76 @@ class SubscribeAttributeRefrigeratorAlarmState : public SubscribeAttribute { } }; +/* + * Attribute Supported + */ +class ReadRefrigeratorAlarmSupported : public ReadAttribute { +public: + ReadRefrigeratorAlarmSupported() + : ReadAttribute("supported") + { + } + + ~ReadRefrigeratorAlarmSupported() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000057) ReadAttribute (0x00000003) on endpoint %u", endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterRefrigeratorAlarm alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeSupportedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"RefrigeratorAlarm.Supported response %@", [value description]); + if (error != nil) { + LogNSError("RefrigeratorAlarm Supported read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeRefrigeratorAlarmSupported : public SubscribeAttribute { +public: + SubscribeAttributeRefrigeratorAlarmSupported() + : SubscribeAttribute("supported") + { + } + + ~SubscribeAttributeRefrigeratorAlarmSupported() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000057) ReportAttribute (0x00000003) on endpoint %u", endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterRefrigeratorAlarm 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 subscribeAttributeSupportedWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"RefrigeratorAlarm.Supported response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + /* * Attribute GeneratedCommandList */ @@ -122519,6 +122590,8 @@ void registerClusterRefrigeratorAlarm(Commands & commands) make_unique(), // make_unique(), // make_unique(), // + make_unique(), // + make_unique(), // make_unique(), // make_unique(), // make_unique(), //