From 10537942f0cef1e33ae316f1d9f04392e5a17acb Mon Sep 17 00:00:00 2001 From: EricZijian_Siter Date: Thu, 13 Jul 2023 22:09:19 +0800 Subject: [PATCH] [SMCO] Update XML to spec changes (#27606) * [SMCO] Update XML to spec changes * [SMCO] Regen zap --------- Co-authored-by: Hare --- .../smoke-co-alarm-app.matter | 13 +++-- .../chip/smoke-co-alarm-cluster.xml | 23 +++++--- .../data_model/controller-clusters.matter | 13 +++-- .../CHIPEventTLVValueDecoder.cpp | 58 +++++++++++++++---- .../devicecontroller/ChipEventStructs.java | 40 +++++++++++-- .../python/chip/clusters/Objects.py | 15 +++++ .../zap-generated/cluster-objects.cpp | 20 +++++++ .../zap-generated/cluster-objects.h | 33 +++++++++-- .../cluster/logging/DataModelLogger.cpp | 40 +++++++++++++ 9 files changed, 219 insertions(+), 36 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/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. diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 5ba5df68dd1129..c1316f2683d275 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 8413d9e417e252..b02ced42ad05ad 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/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp index 5689c94797d43d..fb5070d0d67700 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 e87c3ec19511ba..c2330c03eac793 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 70e10471ca7b5d..2db93696bc282c 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -3944,6 +3944,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; @@ -3951,6 +3959,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; @@ -3959,6 +3975,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; @@ -4007,6 +4031,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; @@ -4015,6 +4047,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;