From ab478dd4b7112766cb27dc310f03a8ae1738dd3c Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 10 Oct 2023 14:48:25 -0400 Subject: [PATCH] Align Ballast Configuration XML to spec. (#29678) * Align Ballast Configuration XML to spec. Fixes https://github.com/project-chip/connectedhomeip/issues/29669 * Auto-update ZAP files that involve Ballast Configuration. * Regenerate generated code. --- .../all-clusters-app.matter | 13 +++- .../all-clusters-common/all-clusters-app.zap | 4 +- .../all-clusters-minimal-app.matter | 9 +++ .../chip/ballast-configuration-cluster.xml | 15 +++- .../data_model/controller-clusters.matter | 13 +++- .../CHIPAttributeTLVValueDecoder.cpp | 4 +- .../zap-generated/CHIPClustersWrite-JNI.cpp | 4 +- .../python/chip/clusters/Objects.py | 8 +++ .../CHIP/templates/availability.yaml | 4 ++ .../MTRAttributeTLVValueDecoder.mm | 4 +- .../CHIP/zap-generated/MTRBaseClusters.h | 9 +++ .../CHIP/zap-generated/MTRBaseClusters.mm | 18 ++--- .../CHIP/zap-generated/MTRCallbackBridge.h | 70 +++++++++++++++++++ .../CHIP/zap-generated/MTRCallbackBridge.mm | 44 ++++++++++++ .../zap-generated/attributes/Accessors.cpp | 16 ++--- .../zap-generated/attributes/Accessors.h | 10 +-- .../app-common/zap-generated/cluster-enums.h | 16 ++++- .../zap-generated/cluster-objects.h | 22 +++--- .../zap-generated/cluster/Commands.h | 8 +-- .../cluster/logging/DataModelLogger.cpp | 4 +- 20 files changed, 243 insertions(+), 52 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index 635052df996693..571df50b00f891 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -4533,9 +4533,18 @@ server cluster ColorControl = 768 { /** Attributes and commands for configuring a lighting ballast. */ server cluster BallastConfiguration = 769 { + bitmap BallastStatusBitmap : BITMAP8 { + kBallastNonOperational = 0x1; + kLampFailure = 0x2; + } + + bitmap LampAlarmModeBitmap : BITMAP8 { + kLampBurnHours = 0x1; + } + readonly attribute int8u physicalMinLevel = 0; readonly attribute int8u physicalMaxLevel = 1; - readonly attribute bitmap8 ballastStatus = 2; + readonly attribute BallastStatusBitmap ballastStatus = 2; attribute int8u minLevel = 16; attribute int8u maxLevel = 17; attribute nullable int8u intrinsicBallastFactor = 20; @@ -4545,7 +4554,7 @@ server cluster BallastConfiguration = 769 { attribute char_string<16> lampManufacturer = 49; attribute nullable int24u lampRatedHours = 50; attribute nullable int24u lampBurnHours = 51; - attribute bitmap8 lampAlarmMode = 52; + attribute LampAlarmModeBitmap lampAlarmMode = 52; attribute nullable int24u lampBurnHoursTripPoint = 53; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; 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 1d8a3b0e22df21..dd93794f80db58 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 @@ -15098,7 +15098,7 @@ "code": 2, "mfgCode": null, "side": "server", - "type": "bitmap8", + "type": "BallastStatusBitmap", "included": 1, "storageOption": "RAM", "singleton": 0, @@ -15258,7 +15258,7 @@ "code": 52, "mfgCode": null, "side": "server", - "type": "bitmap8", + "type": "LampAlarmModeBitmap", "included": 1, "storageOption": "RAM", "singleton": 0, diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter index 5263ae74ab7aae..06a32a7e74ca87 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter @@ -2979,6 +2979,15 @@ server cluster ColorControl = 768 { /** Attributes and commands for configuring a lighting ballast. */ server cluster BallastConfiguration = 769 { + bitmap BallastStatusBitmap : BITMAP8 { + kBallastNonOperational = 0x1; + kLampFailure = 0x2; + } + + bitmap LampAlarmModeBitmap : BITMAP8 { + kLampBurnHours = 0x1; + } + readonly attribute int8u physicalMinLevel = 0; readonly attribute int8u physicalMaxLevel = 1; attribute int8u minLevel = 16; diff --git a/src/app/zap-templates/zcl/data-model/chip/ballast-configuration-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/ballast-configuration-cluster.xml index 90fb658802194f..c555247ad7a031 100644 --- a/src/app/zap-templates/zcl/data-model/chip/ballast-configuration-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/ballast-configuration-cluster.xml @@ -17,6 +17,17 @@ limitations under the License. + + + + + + + + + + + Ballast Configuration Lighting @@ -32,7 +43,7 @@ limitations under the License. PhysicalMinLevel PhysicalMaxLevel - BallastStatus + BallastStatus MinLevel MaxLevel @@ -46,7 +57,7 @@ limitations under the License. LampManufacturer LampRatedHours LampBurnHours - LampAlarmMode + LampAlarmMode LampBurnHoursTripPoint diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index e8730291e5cece..8a794ee5701783 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -5042,9 +5042,18 @@ client cluster ColorControl = 768 { /** Attributes and commands for configuring a lighting ballast. */ client cluster BallastConfiguration = 769 { + bitmap BallastStatusBitmap : BITMAP8 { + kBallastNonOperational = 0x1; + kLampFailure = 0x2; + } + + bitmap LampAlarmModeBitmap : BITMAP8 { + kLampBurnHours = 0x1; + } + readonly attribute int8u physicalMinLevel = 0; readonly attribute int8u physicalMaxLevel = 1; - readonly attribute optional bitmap8 ballastStatus = 2; + readonly attribute optional BallastStatusBitmap ballastStatus = 2; attribute int8u minLevel = 16; attribute int8u maxLevel = 17; attribute optional nullable int8u intrinsicBallastFactor = 20; @@ -5054,7 +5063,7 @@ client cluster BallastConfiguration = 769 { attribute optional char_string<16> lampManufacturer = 49; attribute optional nullable int24u lampRatedHours = 50; attribute optional nullable int24u lampBurnHours = 51; - attribute optional bitmap8 lampAlarmMode = 52; + attribute optional LampAlarmModeBitmap lampAlarmMode = 52; attribute optional nullable int24u lampBurnHoursTripPoint = 53; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index b223c8522bc158..40196587dc825b 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -21938,7 +21938,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR jobject value; std::string valueClassName = "java/lang/Integer"; std::string valueCtorSignature = "(I)V"; - jint jnivalue = static_cast(cppValue); + jint jnivalue = static_cast(cppValue.Raw()); chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), jnivalue, value); return value; @@ -22118,7 +22118,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR jobject value; std::string valueClassName = "java/lang/Integer"; std::string valueCtorSignature = "(I)V"; - jint jnivalue = static_cast(cppValue); + jint jnivalue = static_cast(cppValue.Raw()); chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), jnivalue, value); return value; diff --git a/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp b/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp index 9a97be24f17b40..0dbbe20286896c 100644 --- a/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp +++ b/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp @@ -7882,8 +7882,8 @@ JNI_METHOD(void, BallastConfigurationCluster, writeLampAlarmModeAttribute) std::vector> cleanupByteArrays; std::vector> cleanupStrings; - cppValue = - static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + cppValue.SetRaw(static_cast::IntegerType>( + chip::JniReferences::GetInstance().IntegerToPrimitive(value))); std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index ccd8eff0932925..300e8b56cb66c7 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -26925,6 +26925,14 @@ def descriptor(cls) -> ClusterObjectDescriptor: featureMap: 'uint' = None clusterRevision: 'uint' = None + class Bitmaps: + class BallastStatusBitmap(IntFlag): + kBallastNonOperational = 0x1 + kLampFailure = 0x2 + + class LampAlarmModeBitmap(IntFlag): + kLampBurnHours = 0x1 + class Attributes: @dataclass class PhysicalMinLevel(ClusterAttributeDescriptor): diff --git a/src/darwin/Framework/CHIP/templates/availability.yaml b/src/darwin/Framework/CHIP/templates/availability.yaml index 3eb535d3373401..7bfe5c0ebae565 100644 --- a/src/darwin/Framework/CHIP/templates/availability.yaml +++ b/src/darwin/Framework/CHIP/templates/availability.yaml @@ -7633,6 +7633,10 @@ BarrierControl: - BarrierControlCapabilities - BarrierControlSafetyStatus + BallastConfiguration: + # The BallastConfiguration cluster is provisional for now, but not marked that way. + - BallastStatusBitmap + - LampAlarmModeBitmap attributes: GeneralDiagnostics: # Not in the spec yet. diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index aa6b075c9e3cf0..f02f0d8f61c62b 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -9605,7 +9605,7 @@ static id _Nullable DecodeAttributeValueForBallastConfigurationCluster(Attribute return nil; } NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; + value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; return value; } case Attributes::MinLevel::Id: { @@ -9741,7 +9741,7 @@ static id _Nullable DecodeAttributeValueForBallastConfigurationCluster(Attribute return nil; } NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; + value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; return value; } case Attributes::LampBurnHoursTripPoint::Id: { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index a57d1e9eb588c5..22657490eb413b 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -15340,6 +15340,15 @@ typedef NS_OPTIONS(uint32_t, MTRColorControlFeature) { MTRColorControlFeatureColorTemperature MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x10, } MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); +typedef NS_OPTIONS(uint8_t, MTRBallastConfigurationBallastStatusBitmap) { + MTRBallastConfigurationBallastStatusBitmapBallastNonOperational MTR_PROVISIONALLY_AVAILABLE = 0x1, + MTRBallastConfigurationBallastStatusBitmapLampFailure MTR_PROVISIONALLY_AVAILABLE = 0x2, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_OPTIONS(uint8_t, MTRBallastConfigurationLampAlarmModeBitmap) { + MTRBallastConfigurationLampAlarmModeBitmapLampBurnHours MTR_PROVISIONALLY_AVAILABLE = 0x1, +} MTR_PROVISIONALLY_AVAILABLE; + typedef NS_ENUM(uint8_t, MTRIlluminanceMeasurementLightSensorType) { MTRIlluminanceMeasurementLightSensorTypePhotodiode MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x00, MTRIlluminanceMeasurementLightSensorTypeCMOS MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x01, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index 0a5b259f062b7c..26e3d6accbdc38 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -72342,7 +72342,7 @@ - (void)readAttributeBallastStatusWithCompletion:(void (^)(NSNumber * _Nullable { MTRReadParams * params = [[MTRReadParams alloc] init]; using TypeInfo = BallastConfiguration::Attributes::BallastStatus::TypeInfo; - return MTRReadAttribute(params, completion, self.callbackQueue, self.device, self.endpoint, TypeInfo::GetClusterId(), TypeInfo::GetAttributeId()); } @@ -72352,13 +72352,13 @@ - (void)subscribeAttributeBallastStatusWithParams:(MTRSubscribeParams * _Nonnull reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { using TypeInfo = BallastConfiguration::Attributes::BallastStatus::TypeInfo; - MTRSubscribeAttribute(params, subscriptionEstablished, reportHandler, self.callbackQueue, self.device, self.endpoint, TypeInfo::GetClusterId(), TypeInfo::GetAttributeId()); + MTRSubscribeAttribute(params, subscriptionEstablished, reportHandler, self.callbackQueue, self.device, self.endpoint, TypeInfo::GetClusterId(), TypeInfo::GetAttributeId()); } + (void)readAttributeBallastStatusWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - auto * bridge = new MTRInt8uAttributeCallbackBridge(queue, completion); - std::move(*bridge).DispatchLocalAction(clusterStateCacheContainer.baseDevice, ^(Int8uAttributeCallback successCb, MTRErrorCallback failureCb) { + auto * bridge = new MTRBallastConfigurationBallastStatusAttributeCallbackBridge(queue, completion); + std::move(*bridge).DispatchLocalAction(clusterStateCacheContainer.baseDevice, ^(BallastConfigurationBallastStatusAttributeCallback successCb, MTRErrorCallback failureCb) { if (clusterStateCacheContainer.cppClusterStateCache) { chip::app::ConcreteAttributePath path; using TypeInfo = BallastConfiguration::Attributes::BallastStatus::TypeInfo; @@ -73014,7 +73014,7 @@ - (void)readAttributeLampAlarmModeWithCompletion:(void (^)(NSNumber * _Nullable { MTRReadParams * params = [[MTRReadParams alloc] init]; using TypeInfo = BallastConfiguration::Attributes::LampAlarmMode::TypeInfo; - return MTRReadAttribute(params, completion, self.callbackQueue, self.device, self.endpoint, TypeInfo::GetClusterId(), TypeInfo::GetAttributeId()); } @@ -73045,7 +73045,7 @@ - (void)writeAttributeLampAlarmModeWithValue:(NSNumber * _Nonnull)value params:( ListFreer listFreer; using TypeInfo = BallastConfiguration::Attributes::LampAlarmMode::TypeInfo; TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; + cppValue = static_cast>(value.unsignedCharValue); chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpoint); return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); @@ -73058,13 +73058,13 @@ - (void)subscribeAttributeLampAlarmModeWithParams:(MTRSubscribeParams * _Nonnull reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { using TypeInfo = BallastConfiguration::Attributes::LampAlarmMode::TypeInfo; - MTRSubscribeAttribute(params, subscriptionEstablished, reportHandler, self.callbackQueue, self.device, self.endpoint, TypeInfo::GetClusterId(), TypeInfo::GetAttributeId()); + MTRSubscribeAttribute(params, subscriptionEstablished, reportHandler, self.callbackQueue, self.device, self.endpoint, TypeInfo::GetClusterId(), TypeInfo::GetAttributeId()); } + (void)readAttributeLampAlarmModeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - auto * bridge = new MTRInt8uAttributeCallbackBridge(queue, completion); - std::move(*bridge).DispatchLocalAction(clusterStateCacheContainer.baseDevice, ^(Int8uAttributeCallback successCb, MTRErrorCallback failureCb) { + auto * bridge = new MTRBallastConfigurationLampAlarmModeAttributeCallbackBridge(queue, completion); + std::move(*bridge).DispatchLocalAction(clusterStateCacheContainer.baseDevice, ^(BallastConfigurationLampAlarmModeAttributeCallback successCb, MTRErrorCallback failureCb) { if (clusterStateCacheContainer.cppClusterStateCache) { chip::app::ConcreteAttributePath path; using TypeInfo = BallastConfiguration::Attributes::LampAlarmMode::TypeInfo; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.h b/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.h index cefe10ff1e2aea..5fb75a86607979 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.h @@ -1399,6 +1399,10 @@ typedef void (*ColorControlEventListListAttributeCallback)(void * context, const chip::app::DataModel::DecodableList & data); typedef void (*ColorControlAttributeListListAttributeCallback)(void * context, const chip::app::DataModel::DecodableList & data); +typedef void (*BallastConfigurationBallastStatusAttributeCallback)( + void *, chip::BitMask); +typedef void (*BallastConfigurationLampAlarmModeAttributeCallback)( + void *, chip::BitMask); typedef void (*BallastConfigurationGeneratedCommandListListAttributeCallback)( void * context, const chip::app::DataModel::DecodableList & data); typedef void (*BallastConfigurationAcceptedCommandListListAttributeCallback)( @@ -13509,6 +13513,72 @@ class MTRColorControlAttributeListListAttributeCallbackSubscriptionBridge MTRSubscriptionEstablishedHandler mEstablishedHandler; }; +class MTRBallastConfigurationBallastStatusAttributeCallbackBridge + : public MTRCallbackBridge +{ +public: + MTRBallastConfigurationBallastStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler) : + MTRCallbackBridge(queue, handler, OnSuccessFn){}; + + MTRBallastConfigurationBallastStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + MTRActionBlock action) : + MTRCallbackBridge(queue, handler, action, OnSuccessFn){}; + + static void OnSuccessFn(void * context, chip::BitMask value); +}; + +class MTRBallastConfigurationBallastStatusAttributeCallbackSubscriptionBridge + : public MTRBallastConfigurationBallastStatusAttributeCallbackBridge +{ +public: + MTRBallastConfigurationBallastStatusAttributeCallbackSubscriptionBridge(dispatch_queue_t queue, ResponseHandler handler, + MTRActionBlock action, + MTRSubscriptionEstablishedHandler establishedHandler) : + MTRBallastConfigurationBallastStatusAttributeCallbackBridge(queue, handler, action), + mEstablishedHandler(establishedHandler) + {} + + void OnSubscriptionEstablished(); + using MTRBallastConfigurationBallastStatusAttributeCallbackBridge::KeepAliveOnCallback; + using MTRBallastConfigurationBallastStatusAttributeCallbackBridge::OnDone; + +private: + MTRSubscriptionEstablishedHandler mEstablishedHandler; +}; + +class MTRBallastConfigurationLampAlarmModeAttributeCallbackBridge + : public MTRCallbackBridge +{ +public: + MTRBallastConfigurationLampAlarmModeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler) : + MTRCallbackBridge(queue, handler, OnSuccessFn){}; + + MTRBallastConfigurationLampAlarmModeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + MTRActionBlock action) : + MTRCallbackBridge(queue, handler, action, OnSuccessFn){}; + + static void OnSuccessFn(void * context, chip::BitMask value); +}; + +class MTRBallastConfigurationLampAlarmModeAttributeCallbackSubscriptionBridge + : public MTRBallastConfigurationLampAlarmModeAttributeCallbackBridge +{ +public: + MTRBallastConfigurationLampAlarmModeAttributeCallbackSubscriptionBridge(dispatch_queue_t queue, ResponseHandler handler, + MTRActionBlock action, + MTRSubscriptionEstablishedHandler establishedHandler) : + MTRBallastConfigurationLampAlarmModeAttributeCallbackBridge(queue, handler, action), + mEstablishedHandler(establishedHandler) + {} + + void OnSubscriptionEstablished(); + using MTRBallastConfigurationLampAlarmModeAttributeCallbackBridge::KeepAliveOnCallback; + using MTRBallastConfigurationLampAlarmModeAttributeCallbackBridge::OnDone; + +private: + MTRSubscriptionEstablishedHandler mEstablishedHandler; +}; + class MTRBallastConfigurationGeneratedCommandListListAttributeCallbackBridge : public MTRCallbackBridge { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.mm index cd3d0947ea5379..d34f244c92f528 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCallbackBridge.mm @@ -13167,6 +13167,50 @@ } } +void MTRBallastConfigurationBallastStatusAttributeCallbackBridge::OnSuccessFn(void * context, chip::BitMask value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:value.Raw()]; + DispatchSuccess(context, objCValue); +}; + +void MTRBallastConfigurationBallastStatusAttributeCallbackSubscriptionBridge::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 MTRBallastConfigurationLampAlarmModeAttributeCallbackBridge::OnSuccessFn(void * context, chip::BitMask value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:value.Raw()]; + DispatchSuccess(context, objCValue); +}; + +void MTRBallastConfigurationLampAlarmModeAttributeCallbackSubscriptionBridge::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 MTRBallastConfigurationGeneratedCommandListListAttributeCallbackBridge::OnSuccessFn(void * context, const chip::app::DataModel::DecodableList & value) { NSArray * _Nonnull objCValue; 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 545e369130780a..eea6f71fe6596b 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 @@ -17058,9 +17058,9 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) namespace BallastStatus { -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, chip::BitMask * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, readable, sizeof(temp)); @@ -17072,9 +17072,9 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitMask value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; @@ -17456,9 +17456,9 @@ EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullabl namespace LampAlarmMode { -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, chip::BitMask * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, readable, sizeof(temp)); @@ -17470,9 +17470,9 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitMask value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; 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 1430ddedd7efd8..6aa879d45c01b1 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 @@ -3021,8 +3021,9 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); } // namespace PhysicalMaxLevel namespace BallastStatus { -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // bitmap8 -EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); +EmberAfStatus Get(chip::EndpointId endpoint, + chip::BitMask * value); // BallastStatusBitmap +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitMask value); } // namespace BallastStatus namespace MinLevel { @@ -3079,8 +3080,9 @@ EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullabl } // namespace LampBurnHours namespace LampAlarmMode { -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // bitmap8 -EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); +EmberAfStatus Get(chip::EndpointId endpoint, + chip::BitMask * value); // LampAlarmModeBitmap +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitMask value); } // namespace LampAlarmMode namespace LampBurnHoursTripPoint { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h index af53f77a8b9ef6..81baf06ac090c4 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h @@ -3014,7 +3014,21 @@ enum class Feature : uint32_t }; } // namespace ColorControl -namespace BallastConfiguration {} // namespace BallastConfiguration +namespace BallastConfiguration { + +// Bitmap for BallastStatusBitmap +enum class BallastStatusBitmap : uint8_t +{ + kBallastNonOperational = 0x1, + kLampFailure = 0x2, +}; + +// Bitmap for LampAlarmModeBitmap +enum class LampAlarmModeBitmap : uint8_t +{ + kLampBurnHours = 0x1, +}; +} // namespace BallastConfiguration namespace IlluminanceMeasurement { 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 ca41b4b25a3dcd..cbc4e2c721b9a0 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 @@ -24568,9 +24568,9 @@ struct TypeInfo namespace BallastStatus { struct TypeInfo { - using Type = uint8_t; - using DecodableType = uint8_t; - using DecodableArgType = uint8_t; + using Type = chip::BitMask; + using DecodableType = chip::BitMask; + using DecodableArgType = chip::BitMask; static constexpr ClusterId GetClusterId() { return Clusters::BallastConfiguration::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::BallastStatus::Id; } @@ -24690,9 +24690,9 @@ struct TypeInfo namespace LampAlarmMode { struct TypeInfo { - using Type = uint8_t; - using DecodableType = uint8_t; - using DecodableArgType = uint8_t; + using Type = chip::BitMask; + using DecodableType = chip::BitMask; + using DecodableArgType = chip::BitMask; static constexpr ClusterId GetClusterId() { return Clusters::BallastConfiguration::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::LampAlarmMode::Id; } @@ -24758,9 +24758,10 @@ struct TypeInfo Attributes::PhysicalMinLevel::TypeInfo::DecodableType physicalMinLevel = static_cast(0); Attributes::PhysicalMaxLevel::TypeInfo::DecodableType physicalMaxLevel = static_cast(0); - Attributes::BallastStatus::TypeInfo::DecodableType ballastStatus = static_cast(0); - Attributes::MinLevel::TypeInfo::DecodableType minLevel = static_cast(0); - Attributes::MaxLevel::TypeInfo::DecodableType maxLevel = static_cast(0); + Attributes::BallastStatus::TypeInfo::DecodableType ballastStatus = + static_cast>(0); + Attributes::MinLevel::TypeInfo::DecodableType minLevel = static_cast(0); + Attributes::MaxLevel::TypeInfo::DecodableType maxLevel = static_cast(0); Attributes::IntrinsicBallastFactor::TypeInfo::DecodableType intrinsicBallastFactor; Attributes::BallastFactorAdjustment::TypeInfo::DecodableType ballastFactorAdjustment; Attributes::LampQuantity::TypeInfo::DecodableType lampQuantity = static_cast(0); @@ -24768,7 +24769,8 @@ struct TypeInfo Attributes::LampManufacturer::TypeInfo::DecodableType lampManufacturer; Attributes::LampRatedHours::TypeInfo::DecodableType lampRatedHours; Attributes::LampBurnHours::TypeInfo::DecodableType lampBurnHours; - Attributes::LampAlarmMode::TypeInfo::DecodableType lampAlarmMode = static_cast(0); + Attributes::LampAlarmMode::TypeInfo::DecodableType lampAlarmMode = + static_cast>(0); Attributes::LampBurnHoursTripPoint::TypeInfo::DecodableType lampBurnHoursTripPoint; Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 653d8d659d2ed5..0797ea0223d3b8 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -17828,8 +17828,8 @@ void registerClusterBallastConfiguration(Commands & commands, CredentialIssuerCo WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>(Id, "physical-max-level", 0, UINT8_MAX, Attributes::PhysicalMaxLevel::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>(Id, "ballast-status", 0, UINT8_MAX, Attributes::BallastStatus::Id, - WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "ballast-status", 0, UINT8_MAX, Attributes::BallastStatus::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>(Id, "min-level", 0, UINT8_MAX, Attributes::MinLevel::Id, WriteCommandType::kWrite, credsIssuerConfig), // make_unique>(Id, "max-level", 0, UINT8_MAX, Attributes::MaxLevel::Id, WriteCommandType::kWrite, @@ -17850,8 +17850,8 @@ void registerClusterBallastConfiguration(Commands & commands, CredentialIssuerCo Id, "lamp-rated-hours", 0, UINT32_MAX, Attributes::LampRatedHours::Id, WriteCommandType::kWrite, credsIssuerConfig), // make_unique>>( Id, "lamp-burn-hours", 0, UINT32_MAX, Attributes::LampBurnHours::Id, WriteCommandType::kWrite, credsIssuerConfig), // - make_unique>(Id, "lamp-alarm-mode", 0, UINT8_MAX, Attributes::LampAlarmMode::Id, - WriteCommandType::kWrite, credsIssuerConfig), // + make_unique>>( + Id, "lamp-alarm-mode", 0, UINT8_MAX, Attributes::LampAlarmMode::Id, WriteCommandType::kWrite, credsIssuerConfig), // make_unique>>(Id, "lamp-burn-hours-trip-point", 0, UINT32_MAX, Attributes::LampBurnHoursTripPoint::Id, WriteCommandType::kWrite, 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 5fe79f45fa1b5f..4d231f57803a02 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -10346,7 +10346,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP return DataModelLogger::LogValue("PhysicalMaxLevel", 1, value); } case BallastConfiguration::Attributes::BallastStatus::Id: { - uint8_t value; + chip::BitMask value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("BallastStatus", 1, value); } @@ -10396,7 +10396,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP return DataModelLogger::LogValue("LampBurnHours", 1, value); } case BallastConfiguration::Attributes::LampAlarmMode::Id: { - uint8_t value; + chip::BitMask value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("LampAlarmMode", 1, value); }