From 0fa9cdca39684a5b58427843d4dc2bd66c241bf4 Mon Sep 17 00:00:00 2001 From: Hare Date: Tue, 4 Jul 2023 11:03:34 +0800 Subject: [PATCH 1/2] [SMCO] Update XML to spec changes --- .../chip/smoke-co-alarm-cluster.xml | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 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 a6dc0fe72e85dd..83eb6ffeda9d80 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 @@ -18,7 +18,7 @@ limitations under the License. - Closures + Measurement & Sensing Smoke CO Alarm 0x005C SMOKE_CO_ALARM_CLUSTER @@ -57,35 +57,40 @@ limitations under the License. - + This event SHALL be generated when SmokeState attribute changes to either Warning or Critical state. + - + This event SHALL be generated when COState attribute changes to either Warning or Critical state. + This event SHALL be generated when BatteryAlert attribute changes to either Warning or Critical state. + This event SHALL be generated when the device detects a hardware fault that leads to setting HardwareFaultAlert to True. - This event SHALL be generated when the EndOfServiceAlert is set to True. + This event SHALL be generated when the EndOfServiceAlert is set to Expired. This event SHALL be generated when the SelfTest completes, and the attribute TestInProgress changes to False. - This event SHALL be generated when the DeviceMuted attribute changes to True. + This event SHALL be generated when the DeviceMuted attribute changes to Muted. This event SHALL be generated when DeviceMuted attribute changes to NotMuted. - - This event SHALL be generated when the device hosting the cluster receives a smoke alarm from an interconnected sensor. + + This event SHALL be generated when the device hosting the server receives a smoke alarm from an interconnected sensor. + - - This event SHALL be generated when the device hosting the cluster receives a CO alarm from an interconnected sensor. + + This event SHALL be generated when the device hosting the server receives a smoke alarm from an interconnected sensor. + This event SHALL be generated when ExpressedState attribute returns to Normal state. From 3f57a15bc9738b62752ed4d408f7009b41443b77 Mon Sep 17 00:00:00 2001 From: Hare Date: Tue, 4 Jul 2023 11:08:10 +0800 Subject: [PATCH 2/2] [SMCO] Regen zap --- .../smoke-co-alarm-app.matter | 13 +++-- .../data_model/controller-clusters.matter | 13 +++-- .../CHIPEventTLVValueDecoder.cpp | 58 +++++++++++++++---- .../devicecontroller/ChipEventStructs.java | 40 +++++++++++-- .../python/chip/clusters/Objects.py | 15 +++++ .../zap-generated/MTREventTLVValueDecoder.mm | 30 ++++++++++ .../CHIP/zap-generated/MTRStructsObjc.h | 5 ++ .../CHIP/zap-generated/MTRStructsObjc.mm | 35 +++++++++-- .../zap-generated/cluster-objects.cpp | 20 +++++++ .../zap-generated/cluster-objects.h | 33 +++++++++-- .../cluster/logging/DataModelLogger.cpp | 40 +++++++++++++ 11 files changed, 270 insertions(+), 32 deletions(-) diff --git a/examples/smoke-co-alarm-app/smoke-co-alarm-common/smoke-co-alarm-app.matter b/examples/smoke-co-alarm-app/smoke-co-alarm-common/smoke-co-alarm-app.matter index ee119bf83f9813..f2428d0cd24af7 100644 --- a/examples/smoke-co-alarm-app/smoke-co-alarm-common/smoke-co-alarm-app.matter +++ b/examples/smoke-co-alarm-app/smoke-co-alarm-common/smoke-co-alarm-app.matter @@ -1666,13 +1666,16 @@ server cluster SmokeCoAlarm = 92 { kCOAlarm = 0x2; } - info event SmokeAlarm = 0 { + critical event SmokeAlarm = 0 { + AlarmStateEnum alarmSeverityLevel = 0; } - info event COAlarm = 1 { + critical event COAlarm = 1 { + AlarmStateEnum alarmSeverityLevel = 0; } info event LowBattery = 2 { + AlarmStateEnum alarmSeverityLevel = 0; } info event HardwareFault = 3 { @@ -1690,10 +1693,12 @@ server cluster SmokeCoAlarm = 92 { info event MuteEnded = 7 { } - info event InterconnectSmokeAlarm = 8 { + critical event InterconnectSmokeAlarm = 8 { + AlarmStateEnum alarmSeverityLevel = 0; } - info event InterconnectCOAlarm = 9 { + critical event InterconnectCOAlarm = 9 { + AlarmStateEnum alarmSeverityLevel = 0; } info event AllClear = 10 { diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 2bc465ddead0af..6e86a583125a7a 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -3208,13 +3208,16 @@ client cluster SmokeCoAlarm = 92 { kCOAlarm = 0x2; } - info event SmokeAlarm = 0 { + critical event SmokeAlarm = 0 { + AlarmStateEnum alarmSeverityLevel = 0; } - info event COAlarm = 1 { + critical event COAlarm = 1 { + AlarmStateEnum alarmSeverityLevel = 0; } info event LowBattery = 2 { + AlarmStateEnum alarmSeverityLevel = 0; } info event HardwareFault = 3 { @@ -3232,10 +3235,12 @@ client cluster SmokeCoAlarm = 92 { info event MuteEnded = 7 { } - info event InterconnectSmokeAlarm = 8 { + critical event InterconnectSmokeAlarm = 8 { + AlarmStateEnum alarmSeverityLevel = 0; } - info event InterconnectCOAlarm = 9 { + critical event InterconnectCOAlarm = 9 { + AlarmStateEnum alarmSeverityLevel = 0; } info event AllClear = 10 { diff --git a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp index 96c6f70a45ff5b..e4895627f54124 100644 --- a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp @@ -2578,6 +2578,13 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & { return nullptr; } + jobject value_alarmSeverityLevel; + std::string value_alarmSeverityLevelClassName = "java/lang/Integer"; + std::string value_alarmSeverityLevelCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + value_alarmSeverityLevelClassName.c_str(), value_alarmSeverityLevelCtorSignature.c_str(), + static_cast(cppValue.alarmSeverityLevel), value_alarmSeverityLevel); + jclass smokeAlarmStructClass; err = chip::JniReferences::GetInstance().GetClassRef( env, "chip/devicecontroller/ChipEventStructs$SmokeCoAlarmClusterSmokeAlarmEvent", smokeAlarmStructClass); @@ -2586,14 +2593,14 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & ChipLogError(Zcl, "Could not find class ChipEventStructs$SmokeCoAlarmClusterSmokeAlarmEvent"); return nullptr; } - jmethodID smokeAlarmStructCtor = env->GetMethodID(smokeAlarmStructClass, "", "()V"); + jmethodID smokeAlarmStructCtor = env->GetMethodID(smokeAlarmStructClass, "", "(Ljava/lang/Integer;)V"); if (smokeAlarmStructCtor == nullptr) { ChipLogError(Zcl, "Could not find ChipEventStructs$SmokeCoAlarmClusterSmokeAlarmEvent constructor"); return nullptr; } - jobject value = env->NewObject(smokeAlarmStructClass, smokeAlarmStructCtor); + jobject value = env->NewObject(smokeAlarmStructClass, smokeAlarmStructCtor, value_alarmSeverityLevel); return value; } @@ -2604,6 +2611,13 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & { return nullptr; } + jobject value_alarmSeverityLevel; + std::string value_alarmSeverityLevelClassName = "java/lang/Integer"; + std::string value_alarmSeverityLevelCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + value_alarmSeverityLevelClassName.c_str(), value_alarmSeverityLevelCtorSignature.c_str(), + static_cast(cppValue.alarmSeverityLevel), value_alarmSeverityLevel); + jclass COAlarmStructClass; err = chip::JniReferences::GetInstance().GetClassRef( env, "chip/devicecontroller/ChipEventStructs$SmokeCoAlarmClusterCOAlarmEvent", COAlarmStructClass); @@ -2612,14 +2626,14 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & ChipLogError(Zcl, "Could not find class ChipEventStructs$SmokeCoAlarmClusterCOAlarmEvent"); return nullptr; } - jmethodID COAlarmStructCtor = env->GetMethodID(COAlarmStructClass, "", "()V"); + jmethodID COAlarmStructCtor = env->GetMethodID(COAlarmStructClass, "", "(Ljava/lang/Integer;)V"); if (COAlarmStructCtor == nullptr) { ChipLogError(Zcl, "Could not find ChipEventStructs$SmokeCoAlarmClusterCOAlarmEvent constructor"); return nullptr; } - jobject value = env->NewObject(COAlarmStructClass, COAlarmStructCtor); + jobject value = env->NewObject(COAlarmStructClass, COAlarmStructCtor, value_alarmSeverityLevel); return value; } @@ -2630,6 +2644,13 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & { return nullptr; } + jobject value_alarmSeverityLevel; + std::string value_alarmSeverityLevelClassName = "java/lang/Integer"; + std::string value_alarmSeverityLevelCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + value_alarmSeverityLevelClassName.c_str(), value_alarmSeverityLevelCtorSignature.c_str(), + static_cast(cppValue.alarmSeverityLevel), value_alarmSeverityLevel); + jclass lowBatteryStructClass; err = chip::JniReferences::GetInstance().GetClassRef( env, "chip/devicecontroller/ChipEventStructs$SmokeCoAlarmClusterLowBatteryEvent", lowBatteryStructClass); @@ -2638,14 +2659,14 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & ChipLogError(Zcl, "Could not find class ChipEventStructs$SmokeCoAlarmClusterLowBatteryEvent"); return nullptr; } - jmethodID lowBatteryStructCtor = env->GetMethodID(lowBatteryStructClass, "", "()V"); + jmethodID lowBatteryStructCtor = env->GetMethodID(lowBatteryStructClass, "", "(Ljava/lang/Integer;)V"); if (lowBatteryStructCtor == nullptr) { ChipLogError(Zcl, "Could not find ChipEventStructs$SmokeCoAlarmClusterLowBatteryEvent constructor"); return nullptr; } - jobject value = env->NewObject(lowBatteryStructClass, lowBatteryStructCtor); + jobject value = env->NewObject(lowBatteryStructClass, lowBatteryStructCtor, value_alarmSeverityLevel); return value; } @@ -2787,6 +2808,13 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & { return nullptr; } + jobject value_alarmSeverityLevel; + std::string value_alarmSeverityLevelClassName = "java/lang/Integer"; + std::string value_alarmSeverityLevelCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + value_alarmSeverityLevelClassName.c_str(), value_alarmSeverityLevelCtorSignature.c_str(), + static_cast(cppValue.alarmSeverityLevel), value_alarmSeverityLevel); + jclass interconnectSmokeAlarmStructClass; err = chip::JniReferences::GetInstance().GetClassRef( env, "chip/devicecontroller/ChipEventStructs$SmokeCoAlarmClusterInterconnectSmokeAlarmEvent", @@ -2796,14 +2824,16 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & ChipLogError(Zcl, "Could not find class ChipEventStructs$SmokeCoAlarmClusterInterconnectSmokeAlarmEvent"); return nullptr; } - jmethodID interconnectSmokeAlarmStructCtor = env->GetMethodID(interconnectSmokeAlarmStructClass, "", "()V"); + jmethodID interconnectSmokeAlarmStructCtor = + env->GetMethodID(interconnectSmokeAlarmStructClass, "", "(Ljava/lang/Integer;)V"); if (interconnectSmokeAlarmStructCtor == nullptr) { ChipLogError(Zcl, "Could not find ChipEventStructs$SmokeCoAlarmClusterInterconnectSmokeAlarmEvent constructor"); return nullptr; } - jobject value = env->NewObject(interconnectSmokeAlarmStructClass, interconnectSmokeAlarmStructCtor); + jobject value = + env->NewObject(interconnectSmokeAlarmStructClass, interconnectSmokeAlarmStructCtor, value_alarmSeverityLevel); return value; } @@ -2814,6 +2844,13 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & { return nullptr; } + jobject value_alarmSeverityLevel; + std::string value_alarmSeverityLevelClassName = "java/lang/Integer"; + std::string value_alarmSeverityLevelCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + value_alarmSeverityLevelClassName.c_str(), value_alarmSeverityLevelCtorSignature.c_str(), + static_cast(cppValue.alarmSeverityLevel), value_alarmSeverityLevel); + jclass interconnectCOAlarmStructClass; err = chip::JniReferences::GetInstance().GetClassRef( env, "chip/devicecontroller/ChipEventStructs$SmokeCoAlarmClusterInterconnectCOAlarmEvent", @@ -2823,14 +2860,15 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & ChipLogError(Zcl, "Could not find class ChipEventStructs$SmokeCoAlarmClusterInterconnectCOAlarmEvent"); return nullptr; } - jmethodID interconnectCOAlarmStructCtor = env->GetMethodID(interconnectCOAlarmStructClass, "", "()V"); + jmethodID interconnectCOAlarmStructCtor = + env->GetMethodID(interconnectCOAlarmStructClass, "", "(Ljava/lang/Integer;)V"); if (interconnectCOAlarmStructCtor == nullptr) { ChipLogError(Zcl, "Could not find ChipEventStructs$SmokeCoAlarmClusterInterconnectCOAlarmEvent constructor"); return nullptr; } - jobject value = env->NewObject(interconnectCOAlarmStructClass, interconnectCOAlarmStructCtor); + jobject value = env->NewObject(interconnectCOAlarmStructClass, interconnectCOAlarmStructCtor, value_alarmSeverityLevel); return value; } diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipEventStructs.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipEventStructs.java index c3dbcb84c12ca2..61eeb49bb048c2 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipEventStructs.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipEventStructs.java @@ -1087,45 +1087,63 @@ public String toString() { } public static class SmokeCoAlarmClusterSmokeAlarmEvent { +public Integer alarmSeverityLevel; public SmokeCoAlarmClusterSmokeAlarmEvent( -) { + Integer alarmSeverityLevel + ) { + this.alarmSeverityLevel = alarmSeverityLevel; } @Override public String toString() { StringBuilder output = new StringBuilder(); output.append("SmokeCoAlarmClusterSmokeAlarmEvent {\n"); + output.append("\talarmSeverityLevel: "); + output.append(alarmSeverityLevel); + output.append("\n"); output.append("}\n"); return output.toString(); } } public static class SmokeCoAlarmClusterCOAlarmEvent { +public Integer alarmSeverityLevel; public SmokeCoAlarmClusterCOAlarmEvent( -) { + Integer alarmSeverityLevel + ) { + this.alarmSeverityLevel = alarmSeverityLevel; } @Override public String toString() { StringBuilder output = new StringBuilder(); output.append("SmokeCoAlarmClusterCOAlarmEvent {\n"); + output.append("\talarmSeverityLevel: "); + output.append(alarmSeverityLevel); + output.append("\n"); output.append("}\n"); return output.toString(); } } public static class SmokeCoAlarmClusterLowBatteryEvent { +public Integer alarmSeverityLevel; public SmokeCoAlarmClusterLowBatteryEvent( -) { + Integer alarmSeverityLevel + ) { + this.alarmSeverityLevel = alarmSeverityLevel; } @Override public String toString() { StringBuilder output = new StringBuilder(); output.append("SmokeCoAlarmClusterLowBatteryEvent {\n"); + output.append("\talarmSeverityLevel: "); + output.append(alarmSeverityLevel); + output.append("\n"); output.append("}\n"); return output.toString(); } @@ -1207,30 +1225,42 @@ public String toString() { } public static class SmokeCoAlarmClusterInterconnectSmokeAlarmEvent { +public Integer alarmSeverityLevel; public SmokeCoAlarmClusterInterconnectSmokeAlarmEvent( -) { + Integer alarmSeverityLevel + ) { + this.alarmSeverityLevel = alarmSeverityLevel; } @Override public String toString() { StringBuilder output = new StringBuilder(); output.append("SmokeCoAlarmClusterInterconnectSmokeAlarmEvent {\n"); + output.append("\talarmSeverityLevel: "); + output.append(alarmSeverityLevel); + output.append("\n"); output.append("}\n"); return output.toString(); } } public static class SmokeCoAlarmClusterInterconnectCOAlarmEvent { +public Integer alarmSeverityLevel; public SmokeCoAlarmClusterInterconnectCOAlarmEvent( -) { + Integer alarmSeverityLevel + ) { + this.alarmSeverityLevel = alarmSeverityLevel; } @Override public String toString() { StringBuilder output = new StringBuilder(); output.append("SmokeCoAlarmClusterInterconnectCOAlarmEvent {\n"); + output.append("\talarmSeverityLevel: "); + output.append(alarmSeverityLevel); + output.append("\n"); output.append("}\n"); return output.toString(); } diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index dcb399f51733b5..a232b3d8ae7360 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -17805,8 +17805,11 @@ def event_id(cls) -> int: def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ + ClusterObjectFieldDescriptor(Label="alarmSeverityLevel", Tag=0, Type=SmokeCoAlarm.Enums.AlarmStateEnum), ]) + alarmSeverityLevel: 'SmokeCoAlarm.Enums.AlarmStateEnum' = 0 + @dataclass class COAlarm(ClusterEvent): @ChipUtility.classproperty @@ -17821,8 +17824,11 @@ def event_id(cls) -> int: def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ + ClusterObjectFieldDescriptor(Label="alarmSeverityLevel", Tag=0, Type=SmokeCoAlarm.Enums.AlarmStateEnum), ]) + alarmSeverityLevel: 'SmokeCoAlarm.Enums.AlarmStateEnum' = 0 + @dataclass class LowBattery(ClusterEvent): @ChipUtility.classproperty @@ -17837,8 +17843,11 @@ def event_id(cls) -> int: def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ + ClusterObjectFieldDescriptor(Label="alarmSeverityLevel", Tag=0, Type=SmokeCoAlarm.Enums.AlarmStateEnum), ]) + alarmSeverityLevel: 'SmokeCoAlarm.Enums.AlarmStateEnum' = 0 + @dataclass class HardwareFault(ClusterEvent): @ChipUtility.classproperty @@ -17933,8 +17942,11 @@ def event_id(cls) -> int: def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ + ClusterObjectFieldDescriptor(Label="alarmSeverityLevel", Tag=0, Type=SmokeCoAlarm.Enums.AlarmStateEnum), ]) + alarmSeverityLevel: 'SmokeCoAlarm.Enums.AlarmStateEnum' = 0 + @dataclass class InterconnectCOAlarm(ClusterEvent): @ChipUtility.classproperty @@ -17949,8 +17961,11 @@ def event_id(cls) -> int: def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ + ClusterObjectFieldDescriptor(Label="alarmSeverityLevel", Tag=0, Type=SmokeCoAlarm.Enums.AlarmStateEnum), ]) + alarmSeverityLevel: 'SmokeCoAlarm.Enums.AlarmStateEnum' = 0 + @dataclass class AllClear(ClusterEvent): @ChipUtility.classproperty diff --git a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm index 7705e88b2bda4e..1e00dc1e6905e4 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm @@ -1635,6 +1635,12 @@ static id _Nullable DecodeEventPayloadForSmokeCOAlarmCluster(EventId aEventId, T __auto_type * value = [MTRSmokeCOAlarmClusterSmokeAlarmEvent new]; + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.alarmSeverityLevel)]; + value.alarmSeverityLevel = memberValue; + } while (0); + return value; } case Events::COAlarm::Id: { @@ -1646,6 +1652,12 @@ static id _Nullable DecodeEventPayloadForSmokeCOAlarmCluster(EventId aEventId, T __auto_type * value = [MTRSmokeCOAlarmClusterCOAlarmEvent new]; + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.alarmSeverityLevel)]; + value.alarmSeverityLevel = memberValue; + } while (0); + return value; } case Events::LowBattery::Id: { @@ -1657,6 +1669,12 @@ static id _Nullable DecodeEventPayloadForSmokeCOAlarmCluster(EventId aEventId, T __auto_type * value = [MTRSmokeCOAlarmClusterLowBatteryEvent new]; + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.alarmSeverityLevel)]; + value.alarmSeverityLevel = memberValue; + } while (0); + return value; } case Events::HardwareFault::Id: { @@ -1723,6 +1741,12 @@ static id _Nullable DecodeEventPayloadForSmokeCOAlarmCluster(EventId aEventId, T __auto_type * value = [MTRSmokeCOAlarmClusterInterconnectSmokeAlarmEvent new]; + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.alarmSeverityLevel)]; + value.alarmSeverityLevel = memberValue; + } while (0); + return value; } case Events::InterconnectCOAlarm::Id: { @@ -1734,6 +1758,12 @@ static id _Nullable DecodeEventPayloadForSmokeCOAlarmCluster(EventId aEventId, T __auto_type * value = [MTRSmokeCOAlarmClusterInterconnectCOAlarmEvent new]; + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.alarmSeverityLevel)]; + value.alarmSeverityLevel = memberValue; + } while (0); + return value; } case Events::AllClear::Id: { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index c169c3c37aba91..9f67c7f7745024 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -714,14 +714,17 @@ MTR_NEWLY_AVAILABLE MTR_NEWLY_AVAILABLE @interface MTRSmokeCOAlarmClusterSmokeAlarmEvent : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull alarmSeverityLevel MTR_NEWLY_AVAILABLE; @end MTR_NEWLY_AVAILABLE @interface MTRSmokeCOAlarmClusterCOAlarmEvent : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull alarmSeverityLevel MTR_NEWLY_AVAILABLE; @end MTR_NEWLY_AVAILABLE @interface MTRSmokeCOAlarmClusterLowBatteryEvent : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull alarmSeverityLevel MTR_NEWLY_AVAILABLE; @end MTR_NEWLY_AVAILABLE @@ -746,10 +749,12 @@ MTR_NEWLY_AVAILABLE MTR_NEWLY_AVAILABLE @interface MTRSmokeCOAlarmClusterInterconnectSmokeAlarmEvent : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull alarmSeverityLevel MTR_NEWLY_AVAILABLE; @end MTR_NEWLY_AVAILABLE @interface MTRSmokeCOAlarmClusterInterconnectCOAlarmEvent : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull alarmSeverityLevel MTR_NEWLY_AVAILABLE; @end MTR_NEWLY_AVAILABLE diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index 9aed49bb01c3e6..3e57cafcd92b7c 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -2727,6 +2727,8 @@ @implementation MTRSmokeCOAlarmClusterSmokeAlarmEvent - (instancetype)init { if (self = [super init]) { + + _alarmSeverityLevel = @(0); } return self; } @@ -2735,12 +2737,15 @@ - (id)copyWithZone:(NSZone * _Nullable)zone { auto other = [[MTRSmokeCOAlarmClusterSmokeAlarmEvent alloc] init]; + other.alarmSeverityLevel = self.alarmSeverityLevel; + return other; } - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: >", NSStringFromClass([self class])]; + NSString * descriptionString = + [NSString stringWithFormat:@"<%@: alarmSeverityLevel:%@; >", NSStringFromClass([self class]), _alarmSeverityLevel]; return descriptionString; } @@ -2750,6 +2755,8 @@ @implementation MTRSmokeCOAlarmClusterCOAlarmEvent - (instancetype)init { if (self = [super init]) { + + _alarmSeverityLevel = @(0); } return self; } @@ -2758,12 +2765,15 @@ - (id)copyWithZone:(NSZone * _Nullable)zone { auto other = [[MTRSmokeCOAlarmClusterCOAlarmEvent alloc] init]; + other.alarmSeverityLevel = self.alarmSeverityLevel; + return other; } - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: >", NSStringFromClass([self class])]; + NSString * descriptionString = + [NSString stringWithFormat:@"<%@: alarmSeverityLevel:%@; >", NSStringFromClass([self class]), _alarmSeverityLevel]; return descriptionString; } @@ -2773,6 +2783,8 @@ @implementation MTRSmokeCOAlarmClusterLowBatteryEvent - (instancetype)init { if (self = [super init]) { + + _alarmSeverityLevel = @(0); } return self; } @@ -2781,12 +2793,15 @@ - (id)copyWithZone:(NSZone * _Nullable)zone { auto other = [[MTRSmokeCOAlarmClusterLowBatteryEvent alloc] init]; + other.alarmSeverityLevel = self.alarmSeverityLevel; + return other; } - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: >", NSStringFromClass([self class])]; + NSString * descriptionString = + [NSString stringWithFormat:@"<%@: alarmSeverityLevel:%@; >", NSStringFromClass([self class]), _alarmSeverityLevel]; return descriptionString; } @@ -2911,6 +2926,8 @@ @implementation MTRSmokeCOAlarmClusterInterconnectSmokeAlarmEvent - (instancetype)init { if (self = [super init]) { + + _alarmSeverityLevel = @(0); } return self; } @@ -2919,12 +2936,15 @@ - (id)copyWithZone:(NSZone * _Nullable)zone { auto other = [[MTRSmokeCOAlarmClusterInterconnectSmokeAlarmEvent alloc] init]; + other.alarmSeverityLevel = self.alarmSeverityLevel; + return other; } - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: >", NSStringFromClass([self class])]; + NSString * descriptionString = + [NSString stringWithFormat:@"<%@: alarmSeverityLevel:%@; >", NSStringFromClass([self class]), _alarmSeverityLevel]; return descriptionString; } @@ -2934,6 +2954,8 @@ @implementation MTRSmokeCOAlarmClusterInterconnectCOAlarmEvent - (instancetype)init { if (self = [super init]) { + + _alarmSeverityLevel = @(0); } return self; } @@ -2942,12 +2964,15 @@ - (id)copyWithZone:(NSZone * _Nullable)zone { auto other = [[MTRSmokeCOAlarmClusterInterconnectCOAlarmEvent alloc] init]; + other.alarmSeverityLevel = self.alarmSeverityLevel; + return other; } - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: >", NSStringFromClass([self class])]; + NSString * descriptionString = + [NSString stringWithFormat:@"<%@: alarmSeverityLevel:%@; >", NSStringFromClass([self class]), _alarmSeverityLevel]; return descriptionString; } 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 edf1be6ff666ef..ac12f57532f886 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 @@ -12660,6 +12660,7 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const { TLV::TLVType outer; ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(Fields::kAlarmSeverityLevel), alarmSeverityLevel)); ReturnErrorOnFailure(writer.EndContainer(outer)); return CHIP_NO_ERROR; } @@ -12678,6 +12679,9 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } switch (TLV::TagNumFromTag(reader.GetTag())) { + case to_underlying(Fields::kAlarmSeverityLevel): + ReturnErrorOnFailure(DataModel::Decode(reader, alarmSeverityLevel)); + break; default: break; } @@ -12693,6 +12697,7 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const { TLV::TLVType outer; ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(Fields::kAlarmSeverityLevel), alarmSeverityLevel)); ReturnErrorOnFailure(writer.EndContainer(outer)); return CHIP_NO_ERROR; } @@ -12711,6 +12716,9 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } switch (TLV::TagNumFromTag(reader.GetTag())) { + case to_underlying(Fields::kAlarmSeverityLevel): + ReturnErrorOnFailure(DataModel::Decode(reader, alarmSeverityLevel)); + break; default: break; } @@ -12726,6 +12734,7 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const { TLV::TLVType outer; ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(Fields::kAlarmSeverityLevel), alarmSeverityLevel)); ReturnErrorOnFailure(writer.EndContainer(outer)); return CHIP_NO_ERROR; } @@ -12744,6 +12753,9 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } switch (TLV::TagNumFromTag(reader.GetTag())) { + case to_underlying(Fields::kAlarmSeverityLevel): + ReturnErrorOnFailure(DataModel::Decode(reader, alarmSeverityLevel)); + break; default: break; } @@ -12924,6 +12936,7 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const { TLV::TLVType outer; ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(Fields::kAlarmSeverityLevel), alarmSeverityLevel)); ReturnErrorOnFailure(writer.EndContainer(outer)); return CHIP_NO_ERROR; } @@ -12942,6 +12955,9 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } switch (TLV::TagNumFromTag(reader.GetTag())) { + case to_underlying(Fields::kAlarmSeverityLevel): + ReturnErrorOnFailure(DataModel::Decode(reader, alarmSeverityLevel)); + break; default: break; } @@ -12957,6 +12973,7 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const { TLV::TLVType outer; ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(Fields::kAlarmSeverityLevel), alarmSeverityLevel)); ReturnErrorOnFailure(writer.EndContainer(outer)); return CHIP_NO_ERROR; } @@ -12975,6 +12992,9 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } switch (TLV::TagNumFromTag(reader.GetTag())) { + case to_underlying(Fields::kAlarmSeverityLevel): + ReturnErrorOnFailure(DataModel::Decode(reader, alarmSeverityLevel)); + break; default: 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 61dcd525815ab6..0a58cb6d4de1a3 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 @@ -16120,10 +16120,11 @@ struct TypeInfo } // namespace Attributes namespace Events { namespace SmokeAlarm { -static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; +static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Critical; enum class Fields : uint8_t { + kAlarmSeverityLevel = 0, }; struct Type @@ -16134,6 +16135,8 @@ struct Type static constexpr ClusterId GetClusterId() { return Clusters::SmokeCoAlarm::Id; } static constexpr bool kIsFabricScoped = false; + AlarmStateEnum alarmSeverityLevel = static_cast(0); + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; }; @@ -16144,14 +16147,17 @@ struct DecodableType static constexpr EventId GetEventId() { return Events::SmokeAlarm::Id; } static constexpr ClusterId GetClusterId() { return Clusters::SmokeCoAlarm::Id; } + AlarmStateEnum alarmSeverityLevel = static_cast(0); + CHIP_ERROR Decode(TLV::TLVReader & reader); }; } // namespace SmokeAlarm namespace COAlarm { -static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; +static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Critical; enum class Fields : uint8_t { + kAlarmSeverityLevel = 0, }; struct Type @@ -16162,6 +16168,8 @@ struct Type static constexpr ClusterId GetClusterId() { return Clusters::SmokeCoAlarm::Id; } static constexpr bool kIsFabricScoped = false; + AlarmStateEnum alarmSeverityLevel = static_cast(0); + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; }; @@ -16172,6 +16180,8 @@ struct DecodableType static constexpr EventId GetEventId() { return Events::COAlarm::Id; } static constexpr ClusterId GetClusterId() { return Clusters::SmokeCoAlarm::Id; } + AlarmStateEnum alarmSeverityLevel = static_cast(0); + CHIP_ERROR Decode(TLV::TLVReader & reader); }; } // namespace COAlarm @@ -16180,6 +16190,7 @@ static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; enum class Fields : uint8_t { + kAlarmSeverityLevel = 0, }; struct Type @@ -16190,6 +16201,8 @@ struct Type static constexpr ClusterId GetClusterId() { return Clusters::SmokeCoAlarm::Id; } static constexpr bool kIsFabricScoped = false; + AlarmStateEnum alarmSeverityLevel = static_cast(0); + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; }; @@ -16200,6 +16213,8 @@ struct DecodableType static constexpr EventId GetEventId() { return Events::LowBattery::Id; } static constexpr ClusterId GetClusterId() { return Clusters::SmokeCoAlarm::Id; } + AlarmStateEnum alarmSeverityLevel = static_cast(0); + CHIP_ERROR Decode(TLV::TLVReader & reader); }; } // namespace LowBattery @@ -16344,10 +16359,11 @@ struct DecodableType }; } // namespace MuteEnded namespace InterconnectSmokeAlarm { -static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; +static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Critical; enum class Fields : uint8_t { + kAlarmSeverityLevel = 0, }; struct Type @@ -16358,6 +16374,8 @@ struct Type static constexpr ClusterId GetClusterId() { return Clusters::SmokeCoAlarm::Id; } static constexpr bool kIsFabricScoped = false; + AlarmStateEnum alarmSeverityLevel = static_cast(0); + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; }; @@ -16368,14 +16386,17 @@ struct DecodableType static constexpr EventId GetEventId() { return Events::InterconnectSmokeAlarm::Id; } static constexpr ClusterId GetClusterId() { return Clusters::SmokeCoAlarm::Id; } + AlarmStateEnum alarmSeverityLevel = static_cast(0); + CHIP_ERROR Decode(TLV::TLVReader & reader); }; } // namespace InterconnectSmokeAlarm namespace InterconnectCOAlarm { -static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; +static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Critical; enum class Fields : uint8_t { + kAlarmSeverityLevel = 0, }; struct Type @@ -16386,6 +16407,8 @@ struct Type static constexpr ClusterId GetClusterId() { return Clusters::SmokeCoAlarm::Id; } static constexpr bool kIsFabricScoped = false; + AlarmStateEnum alarmSeverityLevel = static_cast(0); + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; }; @@ -16396,6 +16419,8 @@ struct DecodableType static constexpr EventId GetEventId() { return Events::InterconnectCOAlarm::Id; } static constexpr ClusterId GetClusterId() { return Clusters::SmokeCoAlarm::Id; } + AlarmStateEnum alarmSeverityLevel = static_cast(0); + CHIP_ERROR Decode(TLV::TLVReader & reader); }; } // namespace InterconnectCOAlarm 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 aa805aa56696a2..290db86490f18c 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -3632,6 +3632,14 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const SmokeCoAlarm::Events::SmokeAlarm::DecodableType & value) { DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = DataModelLogger::LogValue("AlarmSeverityLevel", indent + 1, value.alarmSeverityLevel); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'AlarmSeverityLevel'"); + return err; + } + } DataModelLogger::LogString(indent, "}"); return CHIP_NO_ERROR; @@ -3639,6 +3647,14 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const SmokeCoAlarm::Events::COAlarm::DecodableType & value) { DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = DataModelLogger::LogValue("AlarmSeverityLevel", indent + 1, value.alarmSeverityLevel); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'AlarmSeverityLevel'"); + return err; + } + } DataModelLogger::LogString(indent, "}"); return CHIP_NO_ERROR; @@ -3647,6 +3663,14 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const SmokeCoAlarm::Events::LowBattery::DecodableType & value) { DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = DataModelLogger::LogValue("AlarmSeverityLevel", indent + 1, value.alarmSeverityLevel); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'AlarmSeverityLevel'"); + return err; + } + } DataModelLogger::LogString(indent, "}"); return CHIP_NO_ERROR; @@ -3695,6 +3719,14 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const SmokeCoAlarm::Events::InterconnectSmokeAlarm::DecodableType & value) { DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = DataModelLogger::LogValue("AlarmSeverityLevel", indent + 1, value.alarmSeverityLevel); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'AlarmSeverityLevel'"); + return err; + } + } DataModelLogger::LogString(indent, "}"); return CHIP_NO_ERROR; @@ -3703,6 +3735,14 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const SmokeCoAlarm::Events::InterconnectCOAlarm::DecodableType & value) { DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = DataModelLogger::LogValue("AlarmSeverityLevel", indent + 1, value.alarmSeverityLevel); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'AlarmSeverityLevel'"); + return err; + } + } DataModelLogger::LogString(indent, "}"); return CHIP_NO_ERROR;