From e912c38089bb4d892872b67c3b1fef4edba960d9 Mon Sep 17 00:00:00 2001 From: EricZijian_Siter Date: Wed, 24 May 2023 10:21:14 +0800 Subject: [PATCH] Smoke/CO: Update XML to spec changes (#26735) * Smoke/CO: Update XML to spec changes * Remove Unknown Enum states * Update description * Regen zap Close #26705 * Update Darwin availability annotations. --------- Co-authored-by: Hare Co-authored-by: Boris Zbarsky --- .../chip/smoke-co-alarm-cluster.xml | 32 ++++++++--------- .../data_model/controller-clusters.matter | 26 ++++++-------- .../python/chip/clusters/Objects.py | 34 ++++++++----------- .../CHIP/templates/availability.yaml | 4 --- .../CHIP/zap-generated/MTRBaseClusters.h | 26 ++++++-------- .../zap-generated/cluster-enums-check.h | 12 +++---- .../app-common/zap-generated/cluster-enums.h | 34 ++++++++----------- 7 files changed, 70 insertions(+), 98 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 d38ed4774409b4..97404c86a62a39 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 @@ -80,13 +80,13 @@ limitations under the License. This event SHALL be generated when the DeviceMuted attribute changes to True. - This event SHALL be generated when DeviceMuted attribute changes to False. + This event SHALL be generated when DeviceMuted attribute changes to NotMuted. - This event SHALL be generated when the device hosting the cluster receives a remote smoke alarm. + 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 cluster receives a remote CO alarm. + 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 ExpressedState attribute returns to Normal state. @@ -96,10 +96,9 @@ limitations under the License. - - - - + + + @@ -124,25 +123,22 @@ limitations under the License. - - - + + - - - + + - - - - - + + + + diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 0eb643f80cf4b3..67bb2c12b80092 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -2869,24 +2869,21 @@ client cluster AirQuality = 91 { /** This cluster provides an interface for observing and managing the state of smoke and CO alarms. */ client cluster SmokeCoAlarm = 92 { enum AlarmStateEnum : ENUM8 { - kUnknown = 0; - kNormal = 1; - kWarning = 2; - kCritical = 3; + kNormal = 0; + kWarning = 1; + kCritical = 2; } enum ContaminationStateEnum : ENUM8 { - kUnknown = 0; - kNormal = 1; - kLow = 2; - kWarning = 3; - kCritical = 4; + kNormal = 0; + kLow = 1; + kWarning = 2; + kCritical = 3; } enum EndOfServiceEnum : ENUM8 { - kUnknown = 0; - kExpired = 1; - kNormal = 2; + kExpired = 0; + kNormal = 1; } enum ExpressedStateEnum : ENUM8 { @@ -2902,9 +2899,8 @@ client cluster SmokeCoAlarm = 92 { } enum MuteStateEnum : ENUM8 { - kUnknown = 0; - kNotMuted = 1; - kMuted = 2; + kNotMuted = 0; + kMuted = 1; } enum SensitivityEnum : ENUM8 { diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 1b26cf02151a32..0a73b67b5a2131 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -15802,37 +15802,34 @@ def descriptor(cls) -> ClusterObjectDescriptor: class Enums: class AlarmStateEnum(MatterIntEnum): - kUnknown = 0x00 - kNormal = 0x01 - kWarning = 0x02 - kCritical = 0x03 + kNormal = 0x00 + kWarning = 0x01 + kCritical = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only # be used by code to process how it handles receiving and unknown # enum value. This specific should never be transmitted. - kUnknownEnumValue = 4, + kUnknownEnumValue = 3, class ContaminationStateEnum(MatterIntEnum): - kUnknown = 0x00 - kNormal = 0x01 - kLow = 0x02 - kWarning = 0x03 - kCritical = 0x04 + kNormal = 0x00 + kLow = 0x01 + kWarning = 0x02 + kCritical = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only # be used by code to process how it handles receiving and unknown # enum value. This specific should never be transmitted. - kUnknownEnumValue = 5, + kUnknownEnumValue = 4, class EndOfServiceEnum(MatterIntEnum): - kUnknown = 0x00 - kExpired = 0x01 - kNormal = 0x02 + kExpired = 0x00 + kNormal = 0x01 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only # be used by code to process how it handles receiving and unknown # enum value. This specific should never be transmitted. - kUnknownEnumValue = 3, + kUnknownEnumValue = 2, class ExpressedStateEnum(MatterIntEnum): kNormal = 0x00 @@ -15851,14 +15848,13 @@ class ExpressedStateEnum(MatterIntEnum): kUnknownEnumValue = 9, class MuteStateEnum(MatterIntEnum): - kUnknown = 0x00 - kNotMuted = 0x01 - kMuted = 0x02 + kNotMuted = 0x00 + kMuted = 0x01 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only # be used by code to process how it handles receiving and unknown # enum value. This specific should never be transmitted. - kUnknownEnumValue = 3, + kUnknownEnumValue = 2, class SensitivityEnum(MatterIntEnum): kHigh = 0x00 diff --git a/src/darwin/Framework/CHIP/templates/availability.yaml b/src/darwin/Framework/CHIP/templates/availability.yaml index 8b4c8c1b204665..9e555f56a20f68 100644 --- a/src/darwin/Framework/CHIP/templates/availability.yaml +++ b/src/darwin/Framework/CHIP/templates/availability.yaml @@ -7678,18 +7678,15 @@ - Unlatch SmokeCOAlarm: AlarmStateEnum: - - Unknown - Normal - Warning - Critical ContaminationStateEnum: - - Unknown - Normal - Low - Warning - Critical EndOfServiceEnum: - - Unknown - Expired - Normal ExpressedStateEnum: @@ -7703,7 +7700,6 @@ - InterconnectSmoke - InterconnectCO MuteStateEnum: - - Unknown - NotMuted - Muted SensitivityEnum: diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index 057bcd7b7efca4..1bf2eec2b9ff63 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -23359,24 +23359,21 @@ typedef NS_OPTIONS(uint32_t, MTRAirQualityFeature) { } MTR_NEWLY_AVAILABLE; typedef NS_ENUM(uint8_t, MTRSmokeCOAlarmAlarmState) { - MTRSmokeCOAlarmAlarmStateUnknown MTR_NEWLY_AVAILABLE = 0x00, - MTRSmokeCOAlarmAlarmStateNormal MTR_NEWLY_AVAILABLE = 0x01, - MTRSmokeCOAlarmAlarmStateWarning MTR_NEWLY_AVAILABLE = 0x02, - MTRSmokeCOAlarmAlarmStateCritical MTR_NEWLY_AVAILABLE = 0x03, + MTRSmokeCOAlarmAlarmStateNormal MTR_NEWLY_AVAILABLE = 0x00, + MTRSmokeCOAlarmAlarmStateWarning MTR_NEWLY_AVAILABLE = 0x01, + MTRSmokeCOAlarmAlarmStateCritical MTR_NEWLY_AVAILABLE = 0x02, } MTR_NEWLY_AVAILABLE; typedef NS_ENUM(uint8_t, MTRSmokeCOAlarmContaminationState) { - MTRSmokeCOAlarmContaminationStateUnknown MTR_NEWLY_AVAILABLE = 0x00, - MTRSmokeCOAlarmContaminationStateNormal MTR_NEWLY_AVAILABLE = 0x01, - MTRSmokeCOAlarmContaminationStateLow MTR_NEWLY_AVAILABLE = 0x02, - MTRSmokeCOAlarmContaminationStateWarning MTR_NEWLY_AVAILABLE = 0x03, - MTRSmokeCOAlarmContaminationStateCritical MTR_NEWLY_AVAILABLE = 0x04, + MTRSmokeCOAlarmContaminationStateNormal MTR_NEWLY_AVAILABLE = 0x00, + MTRSmokeCOAlarmContaminationStateLow MTR_NEWLY_AVAILABLE = 0x01, + MTRSmokeCOAlarmContaminationStateWarning MTR_NEWLY_AVAILABLE = 0x02, + MTRSmokeCOAlarmContaminationStateCritical MTR_NEWLY_AVAILABLE = 0x03, } MTR_NEWLY_AVAILABLE; typedef NS_ENUM(uint8_t, MTRSmokeCOAlarmEndOfService) { - MTRSmokeCOAlarmEndOfServiceUnknown MTR_NEWLY_AVAILABLE = 0x00, - MTRSmokeCOAlarmEndOfServiceExpired MTR_NEWLY_AVAILABLE = 0x01, - MTRSmokeCOAlarmEndOfServiceNormal MTR_NEWLY_AVAILABLE = 0x02, + MTRSmokeCOAlarmEndOfServiceExpired MTR_NEWLY_AVAILABLE = 0x00, + MTRSmokeCOAlarmEndOfServiceNormal MTR_NEWLY_AVAILABLE = 0x01, } MTR_NEWLY_AVAILABLE; typedef NS_ENUM(uint8_t, MTRSmokeCOAlarmExpressedState) { @@ -23392,9 +23389,8 @@ typedef NS_ENUM(uint8_t, MTRSmokeCOAlarmExpressedState) { } MTR_NEWLY_AVAILABLE; typedef NS_ENUM(uint8_t, MTRSmokeCOAlarmMuteState) { - MTRSmokeCOAlarmMuteStateUnknown MTR_NEWLY_AVAILABLE = 0x00, - MTRSmokeCOAlarmMuteStateNotMuted MTR_NEWLY_AVAILABLE = 0x01, - MTRSmokeCOAlarmMuteStateMuted MTR_NEWLY_AVAILABLE = 0x02, + MTRSmokeCOAlarmMuteStateNotMuted MTR_NEWLY_AVAILABLE = 0x00, + MTRSmokeCOAlarmMuteStateMuted MTR_NEWLY_AVAILABLE = 0x01, } MTR_NEWLY_AVAILABLE; typedef NS_ENUM(uint8_t, MTRSmokeCOAlarmSensitivity) { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h index 82f4417b28bb70..35bd49ff4d26f0 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h @@ -1307,13 +1307,12 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(SmokeCoAlarm::AlarmStat using EnumType = SmokeCoAlarm::AlarmStateEnum; switch (val) { - case EnumType::kUnknown: case EnumType::kNormal: case EnumType::kWarning: case EnumType::kCritical: return val; default: - return static_cast(4); + return static_cast(3); } } static auto __attribute__((unused)) EnsureKnownEnumValue(SmokeCoAlarm::ContaminationStateEnum val) @@ -1321,14 +1320,13 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(SmokeCoAlarm::Contamina using EnumType = SmokeCoAlarm::ContaminationStateEnum; switch (val) { - case EnumType::kUnknown: case EnumType::kNormal: case EnumType::kLow: case EnumType::kWarning: case EnumType::kCritical: return val; default: - return static_cast(5); + return static_cast(4); } } static auto __attribute__((unused)) EnsureKnownEnumValue(SmokeCoAlarm::EndOfServiceEnum val) @@ -1336,12 +1334,11 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(SmokeCoAlarm::EndOfServ using EnumType = SmokeCoAlarm::EndOfServiceEnum; switch (val) { - case EnumType::kUnknown: case EnumType::kExpired: case EnumType::kNormal: return val; default: - return static_cast(3); + return static_cast(2); } } static auto __attribute__((unused)) EnsureKnownEnumValue(SmokeCoAlarm::ExpressedStateEnum val) @@ -1368,12 +1365,11 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(SmokeCoAlarm::MuteState using EnumType = SmokeCoAlarm::MuteStateEnum; switch (val) { - case EnumType::kUnknown: case EnumType::kNotMuted: case EnumType::kMuted: return val; default: - return static_cast(3); + return static_cast(2); } } static auto __attribute__((unused)) EnsureKnownEnumValue(SmokeCoAlarm::SensitivityEnum val) 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 e950636dd0e8c5..7a210a34e81055 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 @@ -1557,43 +1557,40 @@ namespace SmokeCoAlarm { // Enum for AlarmStateEnum enum class AlarmStateEnum : uint8_t { - kUnknown = 0x00, - kNormal = 0x01, - kWarning = 0x02, - kCritical = 0x03, + kNormal = 0x00, + kWarning = 0x01, + kCritical = 0x02, // All received enum values that are not listed above will be mapped // to kUnknownEnumValue. This is a helper enum value that should only // be used by code to process how it handles receiving and unknown // enum value. This specific should never be transmitted. - kUnknownEnumValue = 4, + kUnknownEnumValue = 3, }; // Enum for ContaminationStateEnum enum class ContaminationStateEnum : uint8_t { - kUnknown = 0x00, - kNormal = 0x01, - kLow = 0x02, - kWarning = 0x03, - kCritical = 0x04, + kNormal = 0x00, + kLow = 0x01, + kWarning = 0x02, + kCritical = 0x03, // All received enum values that are not listed above will be mapped // to kUnknownEnumValue. This is a helper enum value that should only // be used by code to process how it handles receiving and unknown // enum value. This specific should never be transmitted. - kUnknownEnumValue = 5, + kUnknownEnumValue = 4, }; // Enum for EndOfServiceEnum enum class EndOfServiceEnum : uint8_t { - kUnknown = 0x00, - kExpired = 0x01, - kNormal = 0x02, + kExpired = 0x00, + kNormal = 0x01, // All received enum values that are not listed above will be mapped // to kUnknownEnumValue. This is a helper enum value that should only // be used by code to process how it handles receiving and unknown // enum value. This specific should never be transmitted. - kUnknownEnumValue = 3, + kUnknownEnumValue = 2, }; // Enum for ExpressedStateEnum @@ -1618,14 +1615,13 @@ enum class ExpressedStateEnum : uint8_t // Enum for MuteStateEnum enum class MuteStateEnum : uint8_t { - kUnknown = 0x00, - kNotMuted = 0x01, - kMuted = 0x02, + kNotMuted = 0x00, + kMuted = 0x01, // All received enum values that are not listed above will be mapped // to kUnknownEnumValue. This is a helper enum value that should only // be used by code to process how it handles receiving and unknown // enum value. This specific should never be transmitted. - kUnknownEnumValue = 3, + kUnknownEnumValue = 2, }; // Enum for SensitivityEnum