From e959c0a035932bfbb4123ff07d6b510e70814c46 Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Tue, 10 Jan 2023 13:51:07 +0000 Subject: [PATCH 01/12] Proof of concept for allowing chip-repl test to send invalid enum values --- src/controller/python/chip/clusters/Objects.py | 4 +++- .../python/chip/yaml/format_converter.py | 14 +++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 07594ef887e438..8ba0decbe00ec3 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -26,7 +26,7 @@ import typing from dataclasses import dataclass, field -from enum import IntEnum +from aenum import IntEnum from chip import ChipUtility from chip.tlv import float32, uint @@ -27293,6 +27293,8 @@ class SimpleEnum(IntEnum): kValueA = 0x01 kValueB = 0x02 kValueC = 0x03 + # kUnknownEnumValue will be generated the same way it is generated for .h by zap codegen + kUnknownEnumValue = 0x04 class Structs: diff --git a/src/controller/python/chip/yaml/format_converter.py b/src/controller/python/chip/yaml/format_converter.py index 3f740d7e1d0e1e..00c4302190cf54 100644 --- a/src/controller/python/chip/yaml/format_converter.py +++ b/src/controller/python/chip/yaml/format_converter.py @@ -15,13 +15,15 @@ # limitations under the License. # -import enum +from aenum import Enum, extend_enum import typing from chip.clusters.Types import Nullable, NullValue from chip.tlv import float32, uint from chip.yaml.errors import ValidationError +_dummy_count = 0 + def _case_insensitive_getattr(object, attr_name, default): for attr in dir(object): @@ -183,8 +185,14 @@ def convert_to_data_model_type(field_value, field_type): value = int(field_value) return field_type(value) # YAML treats enums as ints. Convert to the typed enum class. - elif (issubclass(field_type, enum.Enum)): - return field_type(field_value) + elif (issubclass(field_type, Enum)): + try: + return field_type(field_value) + except ValueError: + global _dummy_count + extend_enum(field_type, F'kDummy{_dummy_count}', field_value) + _dummy_count = _dummy_count + 1 + return field_type(field_value) # By default, just return the field_value casted to field_type. else: return field_type(field_value) From 07d8a4197f3d0e322ab3e61ae5d626a106d7d740 Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Thu, 12 Jan 2023 20:20:23 +0000 Subject: [PATCH 02/12] Prototype after latest round of discussions --- src/controller/python/BUILD.gn | 1 + .../python/chip/clusters/Objects.py | 6 +-- src/controller/python/chip/enum.py | 49 +++++++++++++++++++ .../python/chip/yaml/format_converter.py | 12 ++--- src/controller/python/chip/yaml/runner.py | 2 + 5 files changed, 57 insertions(+), 13 deletions(-) create mode 100644 src/controller/python/chip/enum.py diff --git a/src/controller/python/BUILD.gn b/src/controller/python/BUILD.gn index 4f4c09cef32ad5..f9c6b901a8ade2 100644 --- a/src/controller/python/BUILD.gn +++ b/src/controller/python/BUILD.gn @@ -198,6 +198,7 @@ chip_python_wheel_action("chip-core") { "chip/ChipCommissionableNodeCtrl.py", "chip/ChipCoreBluetoothMgr.py", "chip/ChipStack.py", + "chip/enum.py", "chip/FabricAdmin.py", "chip/__init__.py", "chip/ble/__init__.py", diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 8ba0decbe00ec3..10888bd3b73ad8 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -26,9 +26,9 @@ import typing from dataclasses import dataclass, field -from aenum import IntEnum from chip import ChipUtility +from chip.enum import IntEnum from chip.tlv import float32, uint from .ClusterObjects import (Cluster, ClusterAttributeDescriptor, ClusterCommand, ClusterEvent, ClusterObject, @@ -27294,6 +27294,7 @@ class SimpleEnum(IntEnum): kValueB = 0x02 kValueC = 0x03 # kUnknownEnumValue will be generated the same way it is generated for .h by zap codegen + # and will be done for all IntEnum types kUnknownEnumValue = 0x04 @@ -29702,6 +29703,3 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: return ClusterObjectFieldDescriptor(Type=uint) value: 'uint' = 0 - - - diff --git a/src/controller/python/chip/enum.py b/src/controller/python/chip/enum.py new file mode 100644 index 00000000000000..bb7f74b79e6385 --- /dev/null +++ b/src/controller/python/chip/enum.py @@ -0,0 +1,49 @@ +# +# Copyright (c) 2023 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from aenum import IntEnum as AenumsIntEnum +from aenum import extend_enum + +_add_missing_enum_value_as_is = False +_map_missing_enum_to_unknown_enum_value = True +_dummy_count = 0 + + +class IntEnum(AenumsIntEnum): + @classmethod + def _missing_(cls, value): + global _add_missing_enum_value_as_is + if _add_missing_enum_value_as_is: + global _dummy_count + return_value = extend_enum(cls, f'kDummy{_dummy_count}', value) + _dummy_count = _dummy_count + 1 + return return_value + global _map_missing_enum_to_unknown_enum_value + if _map_missing_enum_to_unknown_enum_value: + return cls.kUnknownEnumValue + + return None + + +def set_add_missing_enum_value_as_is(value: bool): + global _add_missing_enum_value_as_is + _add_missing_enum_value_as_is = value + + +def set_map_missing_enum_to_unknown_enum_value(value: bool): + global _map_missing_enum_to_unknown_enum_value + _map_missing_enum_to_unknown_enum_value = value diff --git a/src/controller/python/chip/yaml/format_converter.py b/src/controller/python/chip/yaml/format_converter.py index 00c4302190cf54..9352c622f87d55 100644 --- a/src/controller/python/chip/yaml/format_converter.py +++ b/src/controller/python/chip/yaml/format_converter.py @@ -15,7 +15,7 @@ # limitations under the License. # -from aenum import Enum, extend_enum +import enum import typing from chip.clusters.Types import Nullable, NullValue @@ -185,14 +185,8 @@ def convert_to_data_model_type(field_value, field_type): value = int(field_value) return field_type(value) # YAML treats enums as ints. Convert to the typed enum class. - elif (issubclass(field_type, Enum)): - try: - return field_type(field_value) - except ValueError: - global _dummy_count - extend_enum(field_type, F'kDummy{_dummy_count}', field_value) - _dummy_count = _dummy_count + 1 - return field_type(field_value) + elif (issubclass(field_type, enum.Enum)): + return field_type(field_value) # By default, just return the field_value casted to field_type. else: return field_type(field_value) diff --git a/src/controller/python/chip/yaml/runner.py b/src/controller/python/chip/yaml/runner.py index c901c0ee748204..f09b417861ab7a 100644 --- a/src/controller/python/chip/yaml/runner.py +++ b/src/controller/python/chip/yaml/runner.py @@ -26,6 +26,7 @@ import stringcase from chip import ChipDeviceCtrl from chip.clusters.Attribute import AttributeStatus, ValueDecodeFailure +from chip.enum import set_add_missing_enum_value_as_is from chip.yaml.errors import ParsingError, UnexpectedParsingError from .data_model_lookup import * @@ -265,6 +266,7 @@ class ReplTestRunner: ''' def __init__(self, test_spec_definition, dev_ctrl): + set_add_missing_enum_value_as_is(True) self._test_spec_definition = test_spec_definition self._dev_ctrl = dev_ctrl self._context = _ExecutionContext(data_model_lookup=PreDefinedDataModelLookup()) From 482da214984cbfd48a572f949efd4018f58c7aef Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Thu, 12 Jan 2023 20:21:57 +0000 Subject: [PATCH 03/12] Quick cleanup --- src/controller/python/chip/yaml/format_converter.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/controller/python/chip/yaml/format_converter.py b/src/controller/python/chip/yaml/format_converter.py index 9352c622f87d55..3f740d7e1d0e1e 100644 --- a/src/controller/python/chip/yaml/format_converter.py +++ b/src/controller/python/chip/yaml/format_converter.py @@ -22,8 +22,6 @@ from chip.tlv import float32, uint from chip.yaml.errors import ValidationError -_dummy_count = 0 - def _case_insensitive_getattr(object, attr_name, default): for attr in dir(object): From ced569b9ee42bdcac2a9a41d28de4a97419b3ffa Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Mon, 16 Jan 2023 18:12:16 +0000 Subject: [PATCH 04/12] Moving to properly done version --- .../templates/app/cluster-enums.zapt | 4 + .../python/chip/clusters/Objects.py | 806 ++++++++++-- src/controller/python/chip/enum.py | 31 +- .../python/chip/yaml/format_converter.py | 5 +- src/controller/python/chip/yaml/runner.py | 2 - .../templates/python-cluster-Objects-py.zapt | 9 +- .../app-common/zap-generated/cluster-enums.h | 1088 ++++++++++++----- 7 files changed, 1490 insertions(+), 455 deletions(-) diff --git a/src/app/zap-templates/templates/app/cluster-enums.zapt b/src/app/zap-templates/templates/app/cluster-enums.zapt index 88cadd44738a0d..23e9a7c92ca888 100644 --- a/src/app/zap-templates/templates/app/cluster-enums.zapt +++ b/src/app/zap-templates/templates/app/cluster-enums.zapt @@ -24,6 +24,10 @@ enum class {{asType label}} : {{asUnderlyingZclType name}} { {{#zcl_enum_items}} k{{asUpperCamelCase label}} = {{asHex value 2}}, {{/zcl_enum_items}} +// 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 = {{first_unused_enum_value mode="first_unused"}}, }; {{#if (isWeaklyTypedEnum label)}} diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 10888bd3b73ad8..b45a487d4888f7 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -28,7 +28,7 @@ from dataclasses import dataclass, field from chip import ChipUtility -from chip.enum import IntEnum +from chip.enum import MatterIntEnum from chip.tlv import float32, uint from .ClusterObjects import (Cluster, ClusterAttributeDescriptor, ClusterCommand, ClusterEvent, ClusterObject, @@ -62,24 +62,39 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class IdentifyEffectIdentifier(IntEnum): + class IdentifyEffectIdentifier(MatterIntEnum): kBlink = 0x00 kBreathe = 0x01 kOkay = 0x02 kChannelChange = 0x0B kFinishEffect = 0xFE kStopEffect = 0xFF + # 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, - class IdentifyEffectVariant(IntEnum): + class IdentifyEffectVariant(MatterIntEnum): kDefault = 0x00 + # 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 = 1, - class IdentifyIdentifyType(IntEnum): + class IdentifyIdentifyType(MatterIntEnum): kNone = 0x00 kVisibleLight = 0x01 kVisibleLED = 0x02 kAudibleBeep = 0x03 kDisplay = 0x04 kActuator = 0x05 + # 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 = 6, @@ -1196,22 +1211,42 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class OnOffDelayedAllOffEffectVariant(IntEnum): + class OnOffDelayedAllOffEffectVariant(MatterIntEnum): kFadeToOffIn0p8Seconds = 0x00 kNoFade = 0x01 k50PercentDimDownIn0p8SecondsThenFadeToOffIn12Seconds = 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 = 3, - class OnOffDyingLightEffectVariant(IntEnum): + class OnOffDyingLightEffectVariant(MatterIntEnum): k20PercenterDimUpIn0p5SecondsThenFadeToOffIn1Second = 0x00 + # 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 = 1, - class OnOffEffectIdentifier(IntEnum): + class OnOffEffectIdentifier(MatterIntEnum): kDelayedAllOff = 0x00 kDyingLight = 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 = 2, - class OnOffStartUpOnOff(IntEnum): + class OnOffStartUpOnOff(MatterIntEnum): kOff = 0x00 kOn = 0x01 kTogglePreviousOnOff = 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 = 3, @@ -1667,13 +1702,23 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class MoveMode(IntEnum): + class MoveMode(MatterIntEnum): kUp = 0x00 kDown = 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 = 2, - class StepMode(IntEnum): + class StepMode(MatterIntEnum): kUp = 0x00 kDown = 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 = 2, @@ -2922,22 +2967,37 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class AccessControlEntryAuthModeEnum(IntEnum): + class AccessControlEntryAuthModeEnum(MatterIntEnum): kPase = 0x01 kCase = 0x02 kGroup = 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 = 0, - class AccessControlEntryPrivilegeEnum(IntEnum): + class AccessControlEntryPrivilegeEnum(MatterIntEnum): kView = 0x01 kProxyView = 0x02 kOperate = 0x03 kManage = 0x04 kAdminister = 0x05 + # 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 = 0, - class ChangeTypeEnum(IntEnum): + class ChangeTypeEnum(MatterIntEnum): kChanged = 0x00 kAdded = 0x01 kRemoved = 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 = 3, class Structs: @@ -3237,17 +3297,27 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class ActionErrorEnum(IntEnum): + class ActionErrorEnum(MatterIntEnum): kUnknown = 0x00 kInterrupted = 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 = 2, - class ActionStateEnum(IntEnum): + class ActionStateEnum(MatterIntEnum): kInactive = 0x00 kActive = 0x01 kPaused = 0x02 kDisabled = 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 = 4, - class ActionTypeEnum(IntEnum): + class ActionTypeEnum(MatterIntEnum): kOther = 0x00 kScene = 0x01 kSequence = 0x02 @@ -3255,11 +3325,21 @@ class ActionTypeEnum(IntEnum): kException = 0x04 kNotification = 0x05 kAlarm = 0x06 + # 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 = 7, - class EndpointListTypeEnum(IntEnum): + class EndpointListTypeEnum(MatterIntEnum): kOther = 0x00 kRoom = 0x01 kZone = 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 = 3, class Structs: @@ -4305,22 +4385,37 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class OTAApplyUpdateAction(IntEnum): + class OTAApplyUpdateAction(MatterIntEnum): kProceed = 0x00 kAwaitNextAction = 0x01 kDiscontinue = 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 = 3, - class OTADownloadProtocol(IntEnum): + class OTADownloadProtocol(MatterIntEnum): kBDXSynchronous = 0x00 kBDXAsynchronous = 0x01 kHttps = 0x02 kVendorSpecific = 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 = 4, - class OTAQueryStatus(IntEnum): + class OTAQueryStatus(MatterIntEnum): kUpdateAvailable = 0x00 kBusy = 0x01 kNotAvailable = 0x02 kDownloadProtocolNotSupported = 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 = 4, @@ -4553,19 +4648,29 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class OTAAnnouncementReason(IntEnum): + class OTAAnnouncementReason(MatterIntEnum): kSimpleAnnouncement = 0x00 kUpdateAvailable = 0x01 kUrgentUpdateAvailable = 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 = 3, - class OTAChangeReasonEnum(IntEnum): + class OTAChangeReasonEnum(MatterIntEnum): kUnknown = 0x00 kSuccess = 0x01 kFailure = 0x02 kTimeOut = 0x03 kDelayByProvider = 0x04 + # 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, - class OTAUpdateStateEnum(IntEnum): + class OTAUpdateStateEnum(MatterIntEnum): kUnknown = 0x00 kIdle = 0x01 kQuerying = 0x02 @@ -4575,6 +4680,11 @@ class OTAUpdateStateEnum(IntEnum): kDelayedOnApply = 0x06 kRollingBack = 0x07 kDelayedOnUserConsent = 0x08 + # 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 = 9, class Structs: @@ -5011,7 +5121,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class CalendarType(IntEnum): + class CalendarType(MatterIntEnum): kBuddhist = 0x00 kChinese = 0x01 kCoptic = 0x02 @@ -5024,10 +5134,20 @@ class CalendarType(IntEnum): kKorean = 0x09 kPersian = 0x0A kTaiwanese = 0x0B + # 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 = 12, - class HourFormat(IntEnum): + class HourFormat(MatterIntEnum): k12hr = 0x00 k24hr = 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 = 2, @@ -5187,10 +5307,15 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class TempUnit(IntEnum): + class TempUnit(MatterIntEnum): kFahrenheit = 0x00 kCelsius = 0x01 kKelvin = 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 = 3, @@ -5503,7 +5628,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class BatChargeFault(IntEnum): + class BatChargeFault(MatterIntEnum): kUnspecfied = 0x00 kAmbientTooHot = 0x01 kAmbientTooCold = 0x02 @@ -5515,43 +5640,83 @@ class BatChargeFault(IntEnum): kChargerOverVoltage = 0x08 kChargerUnderVoltage = 0x09 kSafetyTimeout = 0x0A + # 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 = 11, - class BatChargeLevel(IntEnum): + class BatChargeLevel(MatterIntEnum): kOk = 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 = 3, - class BatChargeState(IntEnum): + class BatChargeState(MatterIntEnum): kUnknown = 0x00 kIsCharging = 0x01 kIsAtFullCharge = 0x02 kIsNotCharging = 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 = 4, - class BatFault(IntEnum): + class BatFault(MatterIntEnum): kUnspecfied = 0x00 kOverTemp = 0x01 kUnderTemp = 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 = 3, - class BatReplaceability(IntEnum): + class BatReplaceability(MatterIntEnum): kUnspecified = 0x00 kNotReplaceable = 0x01 kUserReplaceable = 0x02 kFactoryReplaceable = 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 = 4, - class PowerSourceStatus(IntEnum): + class PowerSourceStatus(MatterIntEnum): kUnspecfied = 0x00 kActive = 0x01 kStandby = 0x02 kUnavailable = 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 = 4, - class WiredCurrentType(IntEnum): + class WiredCurrentType(MatterIntEnum): kAc = 0x00 kDc = 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 = 2, - class WiredFault(IntEnum): + class WiredFault(MatterIntEnum): kUnspecfied = 0x00 kOverVoltage = 0x01 kUnderVoltage = 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 = 3, class Structs: @@ -6272,17 +6437,27 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class CommissioningError(IntEnum): + class CommissioningError(MatterIntEnum): kOk = 0x00 kValueOutsideRange = 0x01 kInvalidAuthentication = 0x02 kNoFailSafe = 0x03 kBusyWithOtherAdmin = 0x04 + # 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, - class RegulatoryLocationType(IntEnum): + class RegulatoryLocationType(MatterIntEnum): kIndoor = 0x00 kOutdoor = 0x01 kIndoorOutdoor = 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 = 3, class Structs: @@ -6610,7 +6785,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class NetworkCommissioningStatus(IntEnum): + class NetworkCommissioningStatus(MatterIntEnum): kSuccess = 0x00 kOutOfRange = 0x01 kBoundsExceeded = 0x02 @@ -6624,13 +6799,23 @@ class NetworkCommissioningStatus(IntEnum): kIPV6Failed = 0x0A kIPBindFailed = 0x0B kUnknownError = 0x0C + # 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 = 13, - class WiFiBand(IntEnum): + class WiFiBand(MatterIntEnum): k2g4 = 0x00 k3g65 = 0x01 k5g = 0x02 k6g = 0x03 k60g = 0x04 + # 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, class Structs: @@ -7104,21 +7289,36 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class LogsIntent(IntEnum): + class LogsIntent(MatterIntEnum): kEndUserSupport = 0x00 kNetworkDiag = 0x01 kCrashLogs = 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 = 3, - class LogsStatus(IntEnum): + class LogsStatus(MatterIntEnum): kSuccess = 0x00 kExhausted = 0x01 kNoLogs = 0x02 kBusy = 0x03 kDenied = 0x04 + # 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, - class LogsTransferProtocol(IntEnum): + class LogsTransferProtocol(MatterIntEnum): kResponsePayload = 0x00 kBdx = 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 = 2, @@ -7289,7 +7489,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class BootReasonType(IntEnum): + class BootReasonType(MatterIntEnum): kUnspecified = 0x00 kPowerOnReboot = 0x01 kBrownOutReset = 0x02 @@ -7297,8 +7497,13 @@ class BootReasonType(IntEnum): kHardwareWatchdogReset = 0x04 kSoftwareUpdateCompleted = 0x05 kSoftwareReset = 0x06 + # 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 = 7, - class HardwareFaultType(IntEnum): + class HardwareFaultType(MatterIntEnum): kUnspecified = 0x00 kRadio = 0x01 kSensor = 0x02 @@ -7310,21 +7515,36 @@ class HardwareFaultType(IntEnum): kUserInterfaceFault = 0x08 kNonVolatileMemoryError = 0x09 kTamperDetected = 0x0A + # 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 = 11, - class InterfaceType(IntEnum): + class InterfaceType(MatterIntEnum): kUnspecified = 0x00 kWiFi = 0x01 kEthernet = 0x02 kCellular = 0x03 kThread = 0x04 + # 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, - class NetworkFaultType(IntEnum): + class NetworkFaultType(MatterIntEnum): kUnspecified = 0x00 kHardwareFailure = 0x01 kNetworkJammed = 0x02 kConnectionFailed = 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 = 4, - class RadioFaultType(IntEnum): + class RadioFaultType(MatterIntEnum): kUnspecified = 0x00 kWiFiFault = 0x01 kCellularFault = 0x02 @@ -7332,6 +7552,11 @@ class RadioFaultType(IntEnum): kNFCFault = 0x04 kBLEFault = 0x05 kEthernetFault = 0x06 + # 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 = 7, class Structs: @@ -8079,17 +8304,27 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class ConnectionStatusEnum(IntEnum): + class ConnectionStatusEnum(MatterIntEnum): kConnected = 0x00 kNotConnected = 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 = 2, - class NetworkFault(IntEnum): + class NetworkFault(MatterIntEnum): kUnspecified = 0x00 kLinkDown = 0x01 kHardwareFailure = 0x02 kNetworkJammed = 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 = 4, - class RoutingRole(IntEnum): + class RoutingRole(MatterIntEnum): kUnspecified = 0x00 kUnassigned = 0x01 kSleepyEndDevice = 0x02 @@ -8097,6 +8332,11 @@ class RoutingRole(IntEnum): kReed = 0x04 kRouter = 0x05 kLeader = 0x06 + # 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 = 7, class Structs: @@ -9410,31 +9650,51 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class AssociationFailureCause(IntEnum): + class AssociationFailureCause(MatterIntEnum): kUnknown = 0x00 kAssociationFailed = 0x01 kAuthenticationFailed = 0x02 kSsidNotFound = 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 = 4, - class SecurityType(IntEnum): + class SecurityType(MatterIntEnum): kUnspecified = 0x00 kNone = 0x01 kWep = 0x02 kWpa = 0x03 kWpa2 = 0x04 kWpa3 = 0x05 + # 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 = 6, - class WiFiConnectionStatus(IntEnum): + class WiFiConnectionStatus(MatterIntEnum): kConnected = 0x00 kNotConnected = 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 = 2, - class WiFiVersionType(IntEnum): + class WiFiVersionType(MatterIntEnum): kA = 0x00 kB = 0x01 kG = 0x02 kN = 0x03 kAc = 0x04 kAx = 0x05 + # 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 = 6, @@ -9845,7 +10105,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class PHYRate(IntEnum): + class PHYRate(MatterIntEnum): kRate10M = 0x00 kRate100M = 0x01 kRate1G = 0x02 @@ -9856,6 +10116,11 @@ class PHYRate(IntEnum): kRate100G = 0x07 kRate200G = 0x08 kRate400G = 0x09 + # 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 = 10, @@ -10144,14 +10409,19 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class GranularityEnum(IntEnum): + class GranularityEnum(MatterIntEnum): kNoTimeGranularity = 0x00 kMinutesGranularity = 0x01 kSecondsGranularity = 0x02 kMillisecondsGranularity = 0x03 kMicrosecondsGranularity = 0x04 + # 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, - class TimeSourceEnum(IntEnum): + class TimeSourceEnum(MatterIntEnum): kNone = 0x00 kUnknown = 0x01 kAdmin = 0x02 @@ -10169,6 +10439,11 @@ class TimeSourceEnum(IntEnum): kCloudSource = 0x0E kPtp = 0x0F kGnss = 0x10 + # 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 = 17, class Structs: @@ -11246,15 +11521,25 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class CommissioningWindowStatus(IntEnum): + class CommissioningWindowStatus(MatterIntEnum): kWindowNotOpen = 0x00 kEnhancedWindowOpen = 0x01 kBasicWindowOpen = 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 = 3, - class StatusCode(IntEnum): + class StatusCode(MatterIntEnum): kBusy = 0x02 kPAKEParameterError = 0x03 kWindowNotOpen = 0x04 + # 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 = 0, @@ -11491,7 +11776,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class OperationalCertStatus(IntEnum): + class OperationalCertStatus(MatterIntEnum): kSuccess = 0x00 kInvalidPublicKey = 0x01 kInvalidNodeOpId = 0x02 @@ -11502,6 +11787,11 @@ class OperationalCertStatus(IntEnum): kFabricConflict = 0x09 kLabelConflict = 0x0A kInvalidFabricIndex = 0x0B + # 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 = 7, class Structs: @@ -11966,9 +12256,14 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class GroupKeySecurityPolicy(IntEnum): + class GroupKeySecurityPolicy(MatterIntEnum): kTrustFirst = 0x00 kCacheAndSync = 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 = 2, class Structs: @@ -13378,7 +13673,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class DlAlarmCode(IntEnum): + class DlAlarmCode(MatterIntEnum): kLockJammed = 0x00 kLockFactoryReset = 0x01 kLockRadioPowerCycled = 0x03 @@ -13387,34 +13682,59 @@ class DlAlarmCode(IntEnum): kDoorForcedOpen = 0x06 kDoorAjar = 0x07 kForcedUser = 0x08 + # 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 = 2, - class DlCredentialRule(IntEnum): + class DlCredentialRule(MatterIntEnum): kSingle = 0x00 kDouble = 0x01 kTri = 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 = 3, - class DlCredentialType(IntEnum): + class DlCredentialType(MatterIntEnum): kProgrammingPIN = 0x00 kPin = 0x01 kRfid = 0x02 kFingerprint = 0x03 kFingerVein = 0x04 kFace = 0x05 + # 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 = 6, - class DlDataOperationType(IntEnum): + class DlDataOperationType(MatterIntEnum): kAdd = 0x00 kClear = 0x01 kModify = 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 = 3, - class DlDoorState(IntEnum): + class DlDoorState(MatterIntEnum): kDoorOpen = 0x00 kDoorClosed = 0x01 kDoorJammed = 0x02 kDoorForcedOpen = 0x03 kDoorUnspecifiedError = 0x04 kDoorAjar = 0x05 + # 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 = 6, - class DlLockDataType(IntEnum): + class DlLockDataType(MatterIntEnum): kUnspecified = 0x00 kProgrammingCode = 0x01 kUserIndex = 0x02 @@ -13424,19 +13744,34 @@ class DlLockDataType(IntEnum): kPin = 0x06 kRfid = 0x07 kFingerprint = 0x08 + # 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 = 9, - class DlLockOperationType(IntEnum): + class DlLockOperationType(MatterIntEnum): kLock = 0x00 kUnlock = 0x01 kNonAccessUserEvent = 0x02 kForcedUserEvent = 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 = 4, - class DlLockState(IntEnum): + class DlLockState(MatterIntEnum): kNotFullyLocked = 0x00 kLocked = 0x01 kUnlocked = 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 = 3, - class DlLockType(IntEnum): + class DlLockType(MatterIntEnum): kDeadBolt = 0x00 kMagnetic = 0x01 kOther = 0x02 @@ -13448,22 +13783,37 @@ class DlLockType(IntEnum): kInterconnectedLock = 0x08 kDeadLatch = 0x09 kDoorFurniture = 0x0A + # 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 = 11, - class DlOperatingMode(IntEnum): + class DlOperatingMode(MatterIntEnum): kNormal = 0x00 kVacation = 0x01 kPrivacy = 0x02 kNoRemoteLockUnlock = 0x03 kPassage = 0x04 + # 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, - class DlOperationError(IntEnum): + class DlOperationError(MatterIntEnum): kUnspecified = 0x00 kInvalidCredential = 0x01 kDisabledUserDenied = 0x02 kRestricted = 0x03 kInsufficientBattery = 0x04 + # 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, - class DlOperationSource(IntEnum): + class DlOperationSource(MatterIntEnum): kUnspecified = 0x00 kManual = 0x01 kProprietaryRemote = 0x02 @@ -13474,8 +13824,13 @@ class DlOperationSource(IntEnum): kRemote = 0x07 kRfid = 0x08 kBiometric = 0x09 + # 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 = 10, - class DlStatus(IntEnum): + class DlStatus(MatterIntEnum): kSuccess = 0x00 kFailure = 0x01 kDuplicate = 0x02 @@ -13483,13 +13838,23 @@ class DlStatus(IntEnum): kInvalidField = 0x85 kResourceExhausted = 0x89 kNotFound = 0x8B + # 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, - class DlUserStatus(IntEnum): + class DlUserStatus(MatterIntEnum): kAvailable = 0x00 kOccupiedEnabled = 0x01 kOccupiedDisabled = 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 = 2, - class DlUserType(IntEnum): + class DlUserType(MatterIntEnum): kUnrestrictedUser = 0x00 kYearDayScheduleUser = 0x01 kWeekDayScheduleUser = 0x02 @@ -13500,8 +13865,13 @@ class DlUserType(IntEnum): kExpiringUser = 0x07 kScheduleRestrictedUser = 0x08 kRemoteOnlyUser = 0x09 + # 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 = 10, - class DoorLockOperationEventCode(IntEnum): + class DoorLockOperationEventCode(MatterIntEnum): kUnknownOrMfgSpecific = 0x00 kLock = 0x01 kUnlock = 0x02 @@ -13517,8 +13887,13 @@ class DoorLockOperationEventCode(IntEnum): kScheduleUnlock = 0x0C kManualLock = 0x0D kManualUnlock = 0x0E + # 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 = 15, - class DoorLockProgrammingEventCode(IntEnum): + class DoorLockProgrammingEventCode(MatterIntEnum): kUnknownOrMfgSpecific = 0x00 kMasterCodeChanged = 0x01 kPinAdded = 0x02 @@ -13526,26 +13901,46 @@ class DoorLockProgrammingEventCode(IntEnum): kPinChanged = 0x04 kIdAdded = 0x05 kIdDeleted = 0x06 + # 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 = 7, - class DoorLockSetPinOrIdStatus(IntEnum): + class DoorLockSetPinOrIdStatus(MatterIntEnum): kSuccess = 0x00 kGeneralFailure = 0x01 kMemoryFull = 0x02 kDuplicateCodeError = 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 = 4, - class DoorLockUserStatus(IntEnum): + class DoorLockUserStatus(MatterIntEnum): kAvailable = 0x00 kOccupiedEnabled = 0x01 kOccupiedDisabled = 0x03 kNotSupported = 0xFF + # 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 = 2, - class DoorLockUserType(IntEnum): + class DoorLockUserType(MatterIntEnum): kUnrestricted = 0x00 kYearDayScheduleUser = 0x01 kWeekDayScheduleUser = 0x02 kMasterUser = 0x03 kNonAccessUser = 0x04 kNotSupported = 0xFF + # 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, class Structs: @@ -14949,7 +15344,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class EndProductType(IntEnum): + class EndProductType(MatterIntEnum): kRollerShade = 0x00 kRomanShade = 0x01 kBalloonShade = 0x02 @@ -14975,8 +15370,13 @@ class EndProductType(IntEnum): kSwingingShutter = 0x16 kSlidingShutter = 0x17 kUnknown = 0xFF + # 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 = 24, - class Type(IntEnum): + class Type(MatterIntEnum): kRollerShade = 0x00 kRollerShade2Motor = 0x01 kRollerShadeExterior = 0x02 @@ -14988,6 +15388,11 @@ class Type(IntEnum): kTiltBlindLiftAndTilt = 0x08 kProjectorScreen = 0x09 kUnknown = 0xFF + # 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 = 10, @@ -15920,19 +16325,29 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class PumpControlMode(IntEnum): + class PumpControlMode(MatterIntEnum): kConstantSpeed = 0x00 kConstantPressure = 0x01 kProportionalPressure = 0x02 kConstantFlow = 0x03 kConstantTemperature = 0x05 kAutomatic = 0x07 + # 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, - class PumpOperationMode(IntEnum): + class PumpOperationMode(MatterIntEnum): kNormal = 0x00 kMinimum = 0x01 kMaximum = 0x02 kLocal = 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 = 4, @@ -16798,25 +17213,40 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class SetpointAdjustMode(IntEnum): + class SetpointAdjustMode(MatterIntEnum): kHeatSetpoint = 0x00 kCoolSetpoint = 0x01 kHeatAndCoolSetpoints = 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 = 3, - class ThermostatControlSequence(IntEnum): + class ThermostatControlSequence(MatterIntEnum): kCoolingOnly = 0x00 kCoolingWithReheat = 0x01 kHeatingOnly = 0x02 kHeatingWithReheat = 0x03 kCoolingAndHeating = 0x04 kCoolingAndHeatingWithReheat = 0x05 + # 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 = 6, - class ThermostatRunningMode(IntEnum): + class ThermostatRunningMode(MatterIntEnum): kOff = 0x00 kCool = 0x03 kHeat = 0x04 + # 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 = 1, - class ThermostatSystemMode(IntEnum): + class ThermostatSystemMode(MatterIntEnum): kOff = 0x00 kAuto = 0x01 kCool = 0x03 @@ -16824,6 +17254,11 @@ class ThermostatSystemMode(IntEnum): kEmergencyHeating = 0x05 kPrecooling = 0x06 kFanOnly = 0x07 + # 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 = 2, class Structs: @@ -17851,15 +18286,20 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class FanModeSequenceType(IntEnum): + class FanModeSequenceType(MatterIntEnum): kOffLowMedHigh = 0x00 kOffLowHigh = 0x01 kOffLowMedHighAuto = 0x02 kOffLowHighAuto = 0x03 kOffOnAuto = 0x04 kOffOn = 0x05 + # 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 = 6, - class FanModeType(IntEnum): + class FanModeType(MatterIntEnum): kOff = 0x00 kLow = 0x01 kMedium = 0x02 @@ -17867,6 +18307,11 @@ class FanModeType(IntEnum): kOn = 0x04 kAuto = 0x05 kSmart = 0x06 + # 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 = 7, @@ -18417,43 +18862,83 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class ColorLoopAction(IntEnum): + class ColorLoopAction(MatterIntEnum): kDeactivate = 0x00 kActivateFromColorLoopStartEnhancedHue = 0x01 kActivateFromEnhancedCurrentHue = 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 = 3, - class ColorLoopDirection(IntEnum): + class ColorLoopDirection(MatterIntEnum): kDecrementHue = 0x00 kIncrementHue = 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 = 2, - class ColorMode(IntEnum): + class ColorMode(MatterIntEnum): kCurrentHueAndCurrentSaturation = 0x00 kCurrentXAndCurrentY = 0x01 kColorTemperature = 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 = 3, - class HueDirection(IntEnum): + class HueDirection(MatterIntEnum): kShortestDistance = 0x00 kLongestDistance = 0x01 kUp = 0x02 kDown = 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 = 4, - class HueMoveMode(IntEnum): + class HueMoveMode(MatterIntEnum): kStop = 0x00 kUp = 0x01 kDown = 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 = 2, - class HueStepMode(IntEnum): + class HueStepMode(MatterIntEnum): kUp = 0x01 kDown = 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 = 0, - class SaturationMoveMode(IntEnum): + class SaturationMoveMode(MatterIntEnum): kStop = 0x00 kUp = 0x01 kDown = 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 = 2, - class SaturationStepMode(IntEnum): + class SaturationStepMode(MatterIntEnum): kUp = 0x01 kDown = 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 = 0, @@ -20213,9 +20698,14 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class LightSensorType(IntEnum): + class LightSensorType(MatterIntEnum): kPhotodiode = 0x00 kCmos = 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 = 2, @@ -21665,13 +22155,23 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class ChannelStatusEnum(IntEnum): + class ChannelStatusEnum(MatterIntEnum): kSuccess = 0x00 kMultipleMatches = 0x01 kNoMatches = 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 = 3, - class LineupInfoTypeEnum(IntEnum): + class LineupInfoTypeEnum(MatterIntEnum): kMso = 0x00 + # 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 = 1, class Structs: @@ -21940,10 +22440,15 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class TargetNavigatorStatusEnum(IntEnum): + class TargetNavigatorStatusEnum(MatterIntEnum): kSuccess = 0x00 kTargetNotFound = 0x01 kNotAllowed = 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 = 3, class Structs: @@ -22151,19 +22656,29 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class MediaPlaybackStatusEnum(IntEnum): + class MediaPlaybackStatusEnum(MatterIntEnum): kSuccess = 0x00 kInvalidStateForCommand = 0x01 kNotAllowed = 0x02 kNotActive = 0x03 kSpeedOutOfRange = 0x04 kSeekOutOfRange = 0x05 + # 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 = 6, - class PlaybackStateEnum(IntEnum): + class PlaybackStateEnum(MatterIntEnum): kPlaying = 0x00 kPaused = 0x01 kNotPlaying = 0x02 kBuffering = 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 = 4, class Structs: @@ -22583,7 +23098,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class InputTypeEnum(IntEnum): + class InputTypeEnum(MatterIntEnum): kInternal = 0x00 kAux = 0x01 kCoax = 0x02 @@ -22596,6 +23111,11 @@ class InputTypeEnum(IntEnum): kScart = 0x09 kUsb = 0x0A kOther = 0x0B + # 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 = 12, class Structs: @@ -22941,7 +23461,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class CecKeyCode(IntEnum): + class CecKeyCode(MatterIntEnum): kSelect = 0x00 kUp = 0x01 kDown = 0x02 @@ -23028,11 +23548,21 @@ class CecKeyCode(IntEnum): kF4Yellow = 0x74 kF5 = 0x75 kData = 0x76 + # 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 = 14, - class KeypadInputStatusEnum(IntEnum): + class KeypadInputStatusEnum(MatterIntEnum): kSuccess = 0x00 kUnsupportedKey = 0x01 kInvalidKeyInCurrentState = 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 = 3, @@ -23179,16 +23709,26 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class ContentLaunchStatusEnum(IntEnum): + class ContentLaunchStatusEnum(MatterIntEnum): kSuccess = 0x00 kUrlNotAvailable = 0x01 kAuthFailed = 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 = 3, - class MetricTypeEnum(IntEnum): + class MetricTypeEnum(MatterIntEnum): kPixels = 0x00 kPercentage = 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 = 2, - class ParameterEnum(IntEnum): + class ParameterEnum(MatterIntEnum): kActor = 0x00 kChannel = 0x01 kCharacter = 0x02 @@ -23202,6 +23742,11 @@ class ParameterEnum(IntEnum): kSport = 0x0A kSportsTeam = 0x0B kType = 0x0C + # 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 = 13, class Structs: @@ -23498,13 +24043,18 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class OutputTypeEnum(IntEnum): + class OutputTypeEnum(MatterIntEnum): kHdmi = 0x00 kBt = 0x01 kOptical = 0x02 kHeadphone = 0x03 kInternal = 0x04 kOther = 0x05 + # 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 = 6, class Structs: @@ -23702,10 +24252,15 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class ApplicationLauncherStatusEnum(IntEnum): + class ApplicationLauncherStatusEnum(MatterIntEnum): kSuccess = 0x00 kAppNotAvailable = 0x01 kSystemBusy = 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 = 3, class Structs: @@ -23960,11 +24515,16 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class ApplicationStatusEnum(IntEnum): + class ApplicationStatusEnum(MatterIntEnum): kStopped = 0x00 kActiveVisibleFocus = 0x01 kActiveHidden = 0x02 kActiveVisibleNotFocus = 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 = 4, class Structs: @@ -27288,14 +27848,16 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class SimpleEnum(IntEnum): + class SimpleEnum(MatterIntEnum): kUnspecified = 0x00 kValueA = 0x01 kValueB = 0x02 kValueC = 0x03 - # kUnknownEnumValue will be generated the same way it is generated for .h by zap codegen - # and will be done for all IntEnum types - kUnknownEnumValue = 0x04 + # 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, class Structs: @@ -29568,12 +30130,17 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class FaultType(IntEnum): + class FaultType(MatterIntEnum): kUnspecified = 0x00 kSystemFault = 0x01 kInetFault = 0x02 kChipFault = 0x03 kCertFault = 0x04 + # 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, @@ -29703,3 +30270,6 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: return ClusterObjectFieldDescriptor(Type=uint) value: 'uint' = 0 + + + diff --git a/src/controller/python/chip/enum.py b/src/controller/python/chip/enum.py index bb7f74b79e6385..af674e7e7de277 100644 --- a/src/controller/python/chip/enum.py +++ b/src/controller/python/chip/enum.py @@ -15,33 +15,34 @@ # limitations under the License. # -from aenum import IntEnum as AenumsIntEnum +from aenum import IntEnum from aenum import extend_enum -_add_missing_enum_value_as_is = False _map_missing_enum_to_unknown_enum_value = True -_dummy_count = 0 +_placeholder_count = 0 -class IntEnum(AenumsIntEnum): +class MatterIntEnum(IntEnum): + @classmethod def _missing_(cls, value): - global _add_missing_enum_value_as_is - if _add_missing_enum_value_as_is: - global _dummy_count - return_value = extend_enum(cls, f'kDummy{_dummy_count}', value) - _dummy_count = _dummy_count + 1 - return return_value global _map_missing_enum_to_unknown_enum_value if _map_missing_enum_to_unknown_enum_value: return cls.kUnknownEnumValue - return None - -def set_add_missing_enum_value_as_is(value: bool): - global _add_missing_enum_value_as_is - _add_missing_enum_value_as_is = value + @classmethod + def extend_enum_if_value_doesnt_exist(cls, value): + try: + return_value = cls(value) + except ValueError: + return_value = None + + if return_value is None or return_value.value != value: + global _placeholder_count + return_value = extend_enum(cls, f'kUnknownPlaceholder{_placeholder_count}', value) + _placeholder_count = _placeholder_count + 1 + return return_value def set_map_missing_enum_to_unknown_enum_value(value: bool): diff --git a/src/controller/python/chip/yaml/format_converter.py b/src/controller/python/chip/yaml/format_converter.py index 3f740d7e1d0e1e..439e1893207dfa 100644 --- a/src/controller/python/chip/yaml/format_converter.py +++ b/src/controller/python/chip/yaml/format_converter.py @@ -19,6 +19,7 @@ import typing from chip.clusters.Types import Nullable, NullValue +from chip.enum import MatterIntEnum from chip.tlv import float32, uint from chip.yaml.errors import ValidationError @@ -183,8 +184,8 @@ def convert_to_data_model_type(field_value, field_type): value = int(field_value) return field_type(value) # YAML treats enums as ints. Convert to the typed enum class. - elif (issubclass(field_type, enum.Enum)): - return field_type(field_value) + elif (issubclass(field_type, MatterIntEnum)): + return field_type.extend_enum_if_value_doesnt_exist(field_value) # By default, just return the field_value casted to field_type. else: return field_type(field_value) diff --git a/src/controller/python/chip/yaml/runner.py b/src/controller/python/chip/yaml/runner.py index f09b417861ab7a..c901c0ee748204 100644 --- a/src/controller/python/chip/yaml/runner.py +++ b/src/controller/python/chip/yaml/runner.py @@ -26,7 +26,6 @@ import stringcase from chip import ChipDeviceCtrl from chip.clusters.Attribute import AttributeStatus, ValueDecodeFailure -from chip.enum import set_add_missing_enum_value_as_is from chip.yaml.errors import ParsingError, UnexpectedParsingError from .data_model_lookup import * @@ -266,7 +265,6 @@ class ReplTestRunner: ''' def __init__(self, test_spec_definition, dev_ctrl): - set_add_missing_enum_value_as_is(True) self._test_spec_definition = test_spec_definition self._dev_ctrl = dev_ctrl self._context = _ExecutionContext(data_model_lookup=PreDefinedDataModelLookup()) diff --git a/src/controller/python/templates/python-cluster-Objects-py.zapt b/src/controller/python/templates/python-cluster-Objects-py.zapt index 59cf38258fc15f..6b6e0aa46aeb9e 100644 --- a/src/controller/python/templates/python-cluster-Objects-py.zapt +++ b/src/controller/python/templates/python-cluster-Objects-py.zapt @@ -9,9 +9,9 @@ import typing from dataclasses import dataclass, field -from enum import IntEnum from chip import ChipUtility +from chip.enum import MatterIntEnum from chip.tlv import float32, uint from .ClusterObjects import (Cluster, ClusterAttributeDescriptor, ClusterCommand, ClusterEvent, ClusterObject, @@ -49,10 +49,15 @@ class {{asUpperCamelCase name}}(Cluster): {{#first}} class Enums: {{/first}} - class {{asType label}}(IntEnum): + class {{asType label}}(MatterIntEnum): {{#zcl_enum_items}} k{{asUpperCamelCase label}} = {{asHex value 2}} {{/zcl_enum_items}} + # 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 = {{first_unused_enum_value mode="first_unused"}}, {{/zcl_enums}} 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 8d52ff5644a3c8..dee71de9529639 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 @@ -35,12 +35,16 @@ namespace Identify { // Enum for IdentifyEffectIdentifier enum class IdentifyEffectIdentifier : uint8_t { - kBlink = 0x00, - kBreathe = 0x01, - kOkay = 0x02, - kChannelChange = 0x0B, - kFinishEffect = 0xFE, - kStopEffect = 0xFF, + kBlink = 0x00, + kBreathe = 0x01, + kOkay = 0x02, + kChannelChange = 0x0B, + kFinishEffect = 0xFE, + kStopEffect = 0xFF, + // 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, }; #else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM @@ -55,7 +59,11 @@ static IdentifyEffectIdentifier __attribute__((unused)) kIdentifyEffectIdentifie // Enum for IdentifyEffectVariant enum class IdentifyEffectVariant : uint8_t { - kDefault = 0x00, + kDefault = 0x00, + // 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 = 1, }; #else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM @@ -70,12 +78,16 @@ static IdentifyEffectVariant __attribute__((unused)) kIdentifyEffectVariantkUnkn // Enum for IdentifyIdentifyType enum class IdentifyIdentifyType : uint8_t { - kNone = 0x00, - kVisibleLight = 0x01, - kVisibleLED = 0x02, - kAudibleBeep = 0x03, - kDisplay = 0x04, - kActuator = 0x05, + kNone = 0x00, + kVisibleLight = 0x01, + kVisibleLED = 0x02, + kAudibleBeep = 0x03, + kDisplay = 0x04, + kActuator = 0x05, + // 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 = 6, }; #else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM @@ -113,7 +125,11 @@ enum class OnOffDelayedAllOffEffectVariant : uint8_t kFadeToOffIn0p8Seconds = 0x00, kNoFade = 0x01, k50PercentDimDownIn0p8SecondsThenFadeToOffIn12Seconds = 0x02, - kUnknownEnumValue = 3, + // 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, }; #else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM using OnOffDelayedAllOffEffectVariant = EmberAfOnOffDelayedAllOffEffectVariant; @@ -128,7 +144,11 @@ static OnOffDelayedAllOffEffectVariant __attribute__((unused)) kOnOffDelayedAllO enum class OnOffDyingLightEffectVariant : uint8_t { k20PercenterDimUpIn0p5SecondsThenFadeToOffIn1Second = 0x00, - kUnknownEnumValue = 1, + // 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 = 1, }; #else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM using OnOffDyingLightEffectVariant = EmberAfOnOffDyingLightEffectVariant; @@ -142,8 +162,12 @@ static OnOffDyingLightEffectVariant __attribute__((unused)) kOnOffDyingLightEffe // Enum for OnOffEffectIdentifier enum class OnOffEffectIdentifier : uint8_t { - kDelayedAllOff = 0x00, - kDyingLight = 0x01, + kDelayedAllOff = 0x00, + kDyingLight = 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 = 2, }; #else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM @@ -158,7 +182,11 @@ enum class OnOffStartUpOnOff : uint8_t kOff = 0x00, kOn = 0x01, kTogglePreviousOnOff = 0x02, - kUnknownEnumValue = 3, + // 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, }; // Bitmap for OnOffControl @@ -191,8 +219,12 @@ namespace LevelControl { // Enum for MoveMode enum class MoveMode : uint8_t { - kUp = 0x00, - kDown = 0x01, + kUp = 0x00, + kDown = 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 = 2, }; #else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM @@ -206,8 +238,12 @@ static MoveMode __attribute__((unused)) kMoveModekUnknownEnumValue // Enum for StepMode enum class StepMode : uint8_t { - kUp = 0x00, - kDown = 0x01, + kUp = 0x00, + kDown = 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 = 2, }; #else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM @@ -248,29 +284,41 @@ namespace AccessControl { // Enum for AccessControlEntryAuthModeEnum enum class AccessControlEntryAuthModeEnum : uint8_t { - kPase = 0x01, - kCase = 0x02, - kGroup = 0x03, + kPase = 0x01, + kCase = 0x02, + kGroup = 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 = 0, }; // Enum for AccessControlEntryPrivilegeEnum enum class AccessControlEntryPrivilegeEnum : uint8_t { - kView = 0x01, - kProxyView = 0x02, - kOperate = 0x03, - kManage = 0x04, - kAdminister = 0x05, + kView = 0x01, + kProxyView = 0x02, + kOperate = 0x03, + kManage = 0x04, + kAdminister = 0x05, + // 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 = 0, }; // Enum for ChangeTypeEnum enum class ChangeTypeEnum : uint8_t { - kChanged = 0x00, - kAdded = 0x01, - kRemoved = 0x02, + kChanged = 0x00, + kAdded = 0x01, + kRemoved = 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 = 3, }; } // namespace AccessControl @@ -280,40 +328,56 @@ namespace Actions { // Enum for ActionErrorEnum enum class ActionErrorEnum : uint8_t { - kUnknown = 0x00, - kInterrupted = 0x01, + kUnknown = 0x00, + kInterrupted = 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 = 2, }; // Enum for ActionStateEnum enum class ActionStateEnum : uint8_t { - kInactive = 0x00, - kActive = 0x01, - kPaused = 0x02, - kDisabled = 0x03, + kInactive = 0x00, + kActive = 0x01, + kPaused = 0x02, + kDisabled = 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 = 4, }; // Enum for ActionTypeEnum enum class ActionTypeEnum : uint8_t { - kOther = 0x00, - kScene = 0x01, - kSequence = 0x02, - kAutomation = 0x03, - kException = 0x04, - kNotification = 0x05, - kAlarm = 0x06, + kOther = 0x00, + kScene = 0x01, + kSequence = 0x02, + kAutomation = 0x03, + kException = 0x04, + kNotification = 0x05, + kAlarm = 0x06, + // 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 = 7, }; // Enum for EndpointListTypeEnum enum class EndpointListTypeEnum : uint8_t { - kOther = 0x00, - kRoom = 0x01, - kZone = 0x02, + kOther = 0x00, + kRoom = 0x01, + kZone = 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 = 3, }; @@ -343,19 +407,27 @@ namespace OtaSoftwareUpdateProvider { // Enum for OTAApplyUpdateAction enum class OTAApplyUpdateAction : uint8_t { - kProceed = 0x00, - kAwaitNextAction = 0x01, - kDiscontinue = 0x02, + kProceed = 0x00, + kAwaitNextAction = 0x01, + kDiscontinue = 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 = 3, }; // Enum for OTADownloadProtocol enum class OTADownloadProtocol : uint8_t { - kBDXSynchronous = 0x00, - kBDXAsynchronous = 0x01, - kHttps = 0x02, - kVendorSpecific = 0x03, + kBDXSynchronous = 0x00, + kBDXAsynchronous = 0x01, + kHttps = 0x02, + kVendorSpecific = 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 = 4, }; @@ -366,7 +438,11 @@ enum class OTAQueryStatus : uint8_t kBusy = 0x01, kNotAvailable = 0x02, kDownloadProtocolNotSupported = 0x03, - kUnknownEnumValue = 4, + // 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, }; } // namespace OtaSoftwareUpdateProvider @@ -378,17 +454,25 @@ enum class OTAAnnouncementReason : uint8_t kSimpleAnnouncement = 0x00, kUpdateAvailable = 0x01, kUrgentUpdateAvailable = 0x02, - kUnknownEnumValue = 3, + // 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, }; // Enum for OTAChangeReasonEnum enum class OTAChangeReasonEnum : uint8_t { - kUnknown = 0x00, - kSuccess = 0x01, - kFailure = 0x02, - kTimeOut = 0x03, - kDelayByProvider = 0x04, + kUnknown = 0x00, + kSuccess = 0x01, + kFailure = 0x02, + kTimeOut = 0x03, + kDelayByProvider = 0x04, + // 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, }; @@ -404,7 +488,11 @@ enum class OTAUpdateStateEnum : uint8_t kDelayedOnApply = 0x06, kRollingBack = 0x07, kDelayedOnUserConsent = 0x08, - kUnknownEnumValue = 9, + // 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 = 9, }; } // namespace OtaSoftwareUpdateRequestor @@ -416,26 +504,34 @@ namespace TimeFormatLocalization { // Enum for CalendarType enum class CalendarType : uint8_t { - kBuddhist = 0x00, - kChinese = 0x01, - kCoptic = 0x02, - kEthiopian = 0x03, - kGregorian = 0x04, - kHebrew = 0x05, - kIndian = 0x06, - kIslamic = 0x07, - kJapanese = 0x08, - kKorean = 0x09, - kPersian = 0x0A, - kTaiwanese = 0x0B, + kBuddhist = 0x00, + kChinese = 0x01, + kCoptic = 0x02, + kEthiopian = 0x03, + kGregorian = 0x04, + kHebrew = 0x05, + kIndian = 0x06, + kIslamic = 0x07, + kJapanese = 0x08, + kKorean = 0x09, + kPersian = 0x0A, + kTaiwanese = 0x0B, + // 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 = 12, }; // Enum for HourFormat enum class HourFormat : uint8_t { - k12hr = 0x00, - k24hr = 0x01, + k12hr = 0x00, + k24hr = 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 = 2, }; } // namespace TimeFormatLocalization @@ -445,9 +541,13 @@ namespace UnitLocalization { // Enum for TempUnit enum class TempUnit : uint8_t { - kFahrenheit = 0x00, - kCelsius = 0x01, - kKelvin = 0x02, + kFahrenheit = 0x00, + kCelsius = 0x01, + kKelvin = 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 = 3, }; @@ -477,34 +577,50 @@ enum class BatChargeFault : uint8_t kChargerOverVoltage = 0x08, kChargerUnderVoltage = 0x09, kSafetyTimeout = 0x0A, - kUnknownEnumValue = 11, + // 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 = 11, }; // Enum for BatChargeLevel enum class BatChargeLevel : uint8_t { - kOk = 0x00, - kWarning = 0x01, - kCritical = 0x02, + kOk = 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 = 3, }; // Enum for BatChargeState enum class BatChargeState : uint8_t { - kUnknown = 0x00, - kIsCharging = 0x01, - kIsAtFullCharge = 0x02, - kIsNotCharging = 0x03, + kUnknown = 0x00, + kIsCharging = 0x01, + kIsAtFullCharge = 0x02, + kIsNotCharging = 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 = 4, }; // Enum for BatFault enum class BatFault : uint8_t { - kUnspecfied = 0x00, - kOverTemp = 0x01, - kUnderTemp = 0x02, + kUnspecfied = 0x00, + kOverTemp = 0x01, + kUnderTemp = 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 = 3, }; @@ -515,33 +631,49 @@ enum class BatReplaceability : uint8_t kNotReplaceable = 0x01, kUserReplaceable = 0x02, kFactoryReplaceable = 0x03, - kUnknownEnumValue = 4, + // 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, }; // Enum for PowerSourceStatus enum class PowerSourceStatus : uint8_t { - kUnspecfied = 0x00, - kActive = 0x01, - kStandby = 0x02, - kUnavailable = 0x03, + kUnspecfied = 0x00, + kActive = 0x01, + kStandby = 0x02, + kUnavailable = 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 = 4, }; // Enum for WiredCurrentType enum class WiredCurrentType : uint8_t { - kAc = 0x00, - kDc = 0x01, + kAc = 0x00, + kDc = 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 = 2, }; // Enum for WiredFault enum class WiredFault : uint8_t { - kUnspecfied = 0x00, - kOverVoltage = 0x01, - kUnderVoltage = 0x02, + kUnspecfied = 0x00, + kOverVoltage = 0x01, + kUnderVoltage = 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 = 3, }; @@ -565,15 +697,23 @@ enum class CommissioningError : uint8_t kInvalidAuthentication = 0x02, kNoFailSafe = 0x03, kBusyWithOtherAdmin = 0x04, - kUnknownEnumValue = 5, + // 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, }; // Enum for RegulatoryLocationType enum class RegulatoryLocationType : uint8_t { - kIndoor = 0x00, - kOutdoor = 0x01, - kIndoorOutdoor = 0x02, + kIndoor = 0x00, + kOutdoor = 0x01, + kIndoorOutdoor = 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 = 3, }; } // namespace GeneralCommissioning @@ -596,17 +736,25 @@ enum class NetworkCommissioningStatus : uint8_t kIPV6Failed = 0x0A, kIPBindFailed = 0x0B, kUnknownError = 0x0C, - kUnknownEnumValue = 13, + // 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 = 13, }; // Enum for WiFiBand enum class WiFiBand : uint8_t { - k2g4 = 0x00, - k3g65 = 0x01, - k5g = 0x02, - k6g = 0x03, - k60g = 0x04, + k2g4 = 0x00, + k3g65 = 0x01, + k5g = 0x02, + k6g = 0x03, + k60g = 0x04, + // 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, }; @@ -634,28 +782,40 @@ namespace DiagnosticLogs { // Enum for LogsIntent enum class LogsIntent : uint8_t { - kEndUserSupport = 0x00, - kNetworkDiag = 0x01, - kCrashLogs = 0x02, + kEndUserSupport = 0x00, + kNetworkDiag = 0x01, + kCrashLogs = 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 = 3, }; // Enum for LogsStatus enum class LogsStatus : uint8_t { - kSuccess = 0x00, - kExhausted = 0x01, - kNoLogs = 0x02, - kBusy = 0x03, - kDenied = 0x04, + kSuccess = 0x00, + kExhausted = 0x01, + kNoLogs = 0x02, + kBusy = 0x03, + kDenied = 0x04, + // 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, }; // Enum for LogsTransferProtocol enum class LogsTransferProtocol : uint8_t { - kResponsePayload = 0x00, - kBdx = 0x01, + kResponsePayload = 0x00, + kBdx = 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 = 2, }; } // namespace DiagnosticLogs @@ -672,7 +832,11 @@ enum class BootReasonType : uint8_t kHardwareWatchdogReset = 0x04, kSoftwareUpdateCompleted = 0x05, kSoftwareReset = 0x06, - kUnknownEnumValue = 7, + // 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 = 7, }; // Need to convert consumers to using the new enum classes, so we @@ -692,7 +856,11 @@ enum class HardwareFaultType : uint8_t kUserInterfaceFault = 0x08, kNonVolatileMemoryError = 0x09, kTamperDetected = 0x0A, - kUnknownEnumValue = 11, + // 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 = 11, }; #else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM using HardwareFaultType = EmberAfHardwareFaultType; @@ -705,11 +873,15 @@ static HardwareFaultType __attribute__((unused)) kHardwareFaultTypekUnknownEnumV // Enum for InterfaceType enum class InterfaceType : uint8_t { - kUnspecified = 0x00, - kWiFi = 0x01, - kEthernet = 0x02, - kCellular = 0x03, - kThread = 0x04, + kUnspecified = 0x00, + kWiFi = 0x01, + kEthernet = 0x02, + kCellular = 0x03, + kThread = 0x04, + // 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, }; #else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM @@ -727,6 +899,10 @@ enum class NetworkFaultType : uint8_t kHardwareFailure = 0x01, kNetworkJammed = 0x02, kConnectionFailed = 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 = 4, }; #else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM @@ -740,13 +916,17 @@ static NetworkFaultType __attribute__((unused)) kNetworkFaultTypekUnknownEnumVal // Enum for RadioFaultType enum class RadioFaultType : uint8_t { - kUnspecified = 0x00, - kWiFiFault = 0x01, - kCellularFault = 0x02, - kThreadFault = 0x03, - kNFCFault = 0x04, - kBLEFault = 0x05, - kEthernetFault = 0x06, + kUnspecified = 0x00, + kWiFiFault = 0x01, + kCellularFault = 0x02, + kThreadFault = 0x03, + kNFCFault = 0x04, + kBLEFault = 0x05, + kEthernetFault = 0x06, + // 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 = 7, }; #else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM @@ -769,18 +949,26 @@ namespace ThreadNetworkDiagnostics { // Enum for ConnectionStatusEnum enum class ConnectionStatusEnum : uint8_t { - kConnected = 0x00, - kNotConnected = 0x01, + kConnected = 0x00, + kNotConnected = 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 = 2, }; // Enum for NetworkFault enum class NetworkFault : uint8_t { - kUnspecified = 0x00, - kLinkDown = 0x01, - kHardwareFailure = 0x02, - kNetworkJammed = 0x03, + kUnspecified = 0x00, + kLinkDown = 0x01, + kHardwareFailure = 0x02, + kNetworkJammed = 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 = 4, }; @@ -790,13 +978,17 @@ enum class NetworkFault : uint8_t // Enum for RoutingRole enum class RoutingRole : uint8_t { - kUnspecified = 0x00, - kUnassigned = 0x01, - kSleepyEndDevice = 0x02, - kEndDevice = 0x03, - kReed = 0x04, - kRouter = 0x05, - kLeader = 0x06, + kUnspecified = 0x00, + kUnassigned = 0x01, + kSleepyEndDevice = 0x02, + kEndDevice = 0x03, + kReed = 0x04, + kRouter = 0x05, + kLeader = 0x06, + // 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 = 7, }; #else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM @@ -823,7 +1015,11 @@ enum class AssociationFailureCause : uint8_t kAssociationFailed = 0x01, kAuthenticationFailed = 0x02, kSsidNotFound = 0x03, - kUnknownEnumValue = 4, + // 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, }; // Need to convert consumers to using the new enum classes, so we @@ -832,12 +1028,16 @@ enum class AssociationFailureCause : uint8_t // Enum for SecurityType enum class SecurityType : uint8_t { - kUnspecified = 0x00, - kNone = 0x01, - kWep = 0x02, - kWpa = 0x03, - kWpa2 = 0x04, - kWpa3 = 0x05, + kUnspecified = 0x00, + kNone = 0x01, + kWep = 0x02, + kWpa = 0x03, + kWpa2 = 0x04, + kWpa3 = 0x05, + // 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 = 6, }; #else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM @@ -848,8 +1048,12 @@ static SecurityType __attribute__((unused)) kSecurityTypekUnknownEnumValue // Enum for WiFiConnectionStatus enum class WiFiConnectionStatus : uint8_t { - kConnected = 0x00, - kNotConnected = 0x01, + kConnected = 0x00, + kNotConnected = 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 = 2, }; @@ -859,12 +1063,16 @@ enum class WiFiConnectionStatus : uint8_t // Enum for WiFiVersionType enum class WiFiVersionType : uint8_t { - kA = 0x00, - kB = 0x01, - kG = 0x02, - kN = 0x03, - kAc = 0x04, - kAx = 0x05, + kA = 0x00, + kB = 0x01, + kG = 0x02, + kN = 0x03, + kAc = 0x04, + kAx = 0x05, + // 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 = 6, }; #else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM @@ -881,16 +1089,20 @@ namespace EthernetNetworkDiagnostics { // Enum for PHYRate enum class PHYRate : uint8_t { - kRate10M = 0x00, - kRate100M = 0x01, - kRate1G = 0x02, - kRate25g = 0x03, - kRate5G = 0x04, - kRate10G = 0x05, - kRate40G = 0x06, - kRate100G = 0x07, - kRate200G = 0x08, - kRate400G = 0x09, + kRate10M = 0x00, + kRate100M = 0x01, + kRate1G = 0x02, + kRate25g = 0x03, + kRate5G = 0x04, + kRate10G = 0x05, + kRate40G = 0x06, + kRate100G = 0x07, + kRate200G = 0x08, + kRate400G = 0x09, + // 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 = 10, }; #else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM @@ -909,7 +1121,11 @@ enum class GranularityEnum : uint8_t kSecondsGranularity = 0x02, kMillisecondsGranularity = 0x03, kMicrosecondsGranularity = 0x04, - kUnknownEnumValue = 5, + // 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, }; // Enum for TimeSourceEnum @@ -932,6 +1148,10 @@ enum class TimeSourceEnum : uint8_t kCloudSource = 0x0E, kPtp = 0x0F, kGnss = 0x10, + // 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 = 17, }; } // namespace TimeSynchronization @@ -960,7 +1180,11 @@ enum class CommissioningWindowStatus : uint8_t kWindowNotOpen = 0x00, kEnhancedWindowOpen = 0x01, kBasicWindowOpen = 0x02, - kUnknownEnumValue = 3, + // 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, }; // Need to convert consumers to using the new enum classes, so we @@ -972,7 +1196,11 @@ enum class StatusCode : uint8_t kBusy = 0x02, kPAKEParameterError = 0x03, kWindowNotOpen = 0x04, - kUnknownEnumValue = 0, + // 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 = 0, }; #else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM using StatusCode = EmberAfStatusCode; @@ -995,7 +1223,11 @@ enum class OperationalCertStatus : uint8_t kFabricConflict = 0x09, kLabelConflict = 0x0A, kInvalidFabricIndex = 0x0B, - kUnknownEnumValue = 7, + // 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 = 7, }; } // namespace OperationalCredentials @@ -1004,8 +1236,12 @@ namespace GroupKeyManagement { // Enum for GroupKeySecurityPolicy enum class GroupKeySecurityPolicy : uint8_t { - kTrustFirst = 0x00, - kCacheAndSync = 0x01, + kTrustFirst = 0x00, + kCacheAndSync = 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 = 2, }; } // namespace GroupKeyManagement @@ -1050,36 +1286,52 @@ enum class DlAlarmCode : uint8_t kDoorForcedOpen = 0x06, kDoorAjar = 0x07, kForcedUser = 0x08, - kUnknownEnumValue = 2, + // 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 = 2, }; // Enum for DlCredentialRule enum class DlCredentialRule : uint8_t { - kSingle = 0x00, - kDouble = 0x01, - kTri = 0x02, + kSingle = 0x00, + kDouble = 0x01, + kTri = 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 = 3, }; // Enum for DlCredentialType enum class DlCredentialType : uint8_t { - kProgrammingPIN = 0x00, - kPin = 0x01, - kRfid = 0x02, - kFingerprint = 0x03, - kFingerVein = 0x04, - kFace = 0x05, + kProgrammingPIN = 0x00, + kPin = 0x01, + kRfid = 0x02, + kFingerprint = 0x03, + kFingerVein = 0x04, + kFace = 0x05, + // 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 = 6, }; // Enum for DlDataOperationType enum class DlDataOperationType : uint8_t { - kAdd = 0x00, - kClear = 0x01, - kModify = 0x02, + kAdd = 0x00, + kClear = 0x01, + kModify = 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 = 3, }; @@ -1092,21 +1344,29 @@ enum class DlDoorState : uint8_t kDoorForcedOpen = 0x03, kDoorUnspecifiedError = 0x04, kDoorAjar = 0x05, - kUnknownEnumValue = 6, + // 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 = 6, }; // Enum for DlLockDataType enum class DlLockDataType : uint8_t { - kUnspecified = 0x00, - kProgrammingCode = 0x01, - kUserIndex = 0x02, - kWeekDaySchedule = 0x03, - kYearDaySchedule = 0x04, - kHolidaySchedule = 0x05, - kPin = 0x06, - kRfid = 0x07, - kFingerprint = 0x08, + kUnspecified = 0x00, + kProgrammingCode = 0x01, + kUserIndex = 0x02, + kWeekDaySchedule = 0x03, + kYearDaySchedule = 0x04, + kHolidaySchedule = 0x05, + kPin = 0x06, + kRfid = 0x07, + kFingerprint = 0x08, + // 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 = 9, }; @@ -1117,15 +1377,23 @@ enum class DlLockOperationType : uint8_t kUnlock = 0x01, kNonAccessUserEvent = 0x02, kForcedUserEvent = 0x03, - kUnknownEnumValue = 4, + // 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, }; // Enum for DlLockState enum class DlLockState : uint8_t { - kNotFullyLocked = 0x00, - kLocked = 0x01, - kUnlocked = 0x02, + kNotFullyLocked = 0x00, + kLocked = 0x01, + kUnlocked = 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 = 3, }; @@ -1143,7 +1411,11 @@ enum class DlLockType : uint8_t kInterconnectedLock = 0x08, kDeadLatch = 0x09, kDoorFurniture = 0x0A, - kUnknownEnumValue = 11, + // 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 = 11, }; // Enum for DlOperatingMode @@ -1154,7 +1426,11 @@ enum class DlOperatingMode : uint8_t kPrivacy = 0x02, kNoRemoteLockUnlock = 0x03, kPassage = 0x04, - kUnknownEnumValue = 5, + // 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, }; // Enum for DlOperationError @@ -1165,7 +1441,11 @@ enum class DlOperationError : uint8_t kDisabledUserDenied = 0x02, kRestricted = 0x03, kInsufficientBattery = 0x04, - kUnknownEnumValue = 5, + // 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, }; // Enum for DlOperationSource @@ -1181,7 +1461,11 @@ enum class DlOperationSource : uint8_t kRemote = 0x07, kRfid = 0x08, kBiometric = 0x09, - kUnknownEnumValue = 10, + // 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 = 10, }; // Enum for DlStatus @@ -1194,7 +1478,11 @@ enum class DlStatus : uint8_t kInvalidField = 0x85, kResourceExhausted = 0x89, kNotFound = 0x8B, - kUnknownEnumValue = 4, + // 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, }; // Enum for DlUserStatus @@ -1203,6 +1491,10 @@ enum class DlUserStatus : uint8_t kAvailable = 0x00, kOccupiedEnabled = 0x01, kOccupiedDisabled = 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 = 2, }; @@ -1219,7 +1511,11 @@ enum class DlUserType : uint8_t kExpiringUser = 0x07, kScheduleRestrictedUser = 0x08, kRemoteOnlyUser = 0x09, - kUnknownEnumValue = 10, + // 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 = 10, }; // Enum for DoorLockOperationEventCode @@ -1240,7 +1536,11 @@ enum class DoorLockOperationEventCode : uint8_t kScheduleUnlock = 0x0C, kManualLock = 0x0D, kManualUnlock = 0x0E, - kUnknownEnumValue = 15, + // 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 = 15, }; // Enum for DoorLockProgrammingEventCode @@ -1253,7 +1553,11 @@ enum class DoorLockProgrammingEventCode : uint8_t kPinChanged = 0x04, kIdAdded = 0x05, kIdDeleted = 0x06, - kUnknownEnumValue = 7, + // 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 = 7, }; // Enum for DoorLockSetPinOrIdStatus @@ -1263,7 +1567,11 @@ enum class DoorLockSetPinOrIdStatus : uint8_t kGeneralFailure = 0x01, kMemoryFull = 0x02, kDuplicateCodeError = 0x03, - kUnknownEnumValue = 4, + // 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, }; // Enum for DoorLockUserStatus @@ -1273,6 +1581,10 @@ enum class DoorLockUserStatus : uint8_t kOccupiedEnabled = 0x01, kOccupiedDisabled = 0x03, kNotSupported = 0xFF, + // 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 = 2, }; @@ -1285,7 +1597,11 @@ enum class DoorLockUserType : uint8_t kMasterUser = 0x03, kNonAccessUser = 0x04, kNotSupported = 0xFF, - kUnknownEnumValue = 5, + // 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, }; // Bitmap for DlCredentialRuleMask @@ -1489,7 +1805,11 @@ enum class EndProductType : uint8_t kSwingingShutter = 0x16, kSlidingShutter = 0x17, kUnknown = 0xFF, - kUnknownEnumValue = 24, + // 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 = 24, }; // Enum for Type @@ -1506,7 +1826,11 @@ enum class Type : uint8_t kTiltBlindLiftAndTilt = 0x08, kProjectorScreen = 0x09, kUnknown = 0xFF, - kUnknownEnumValue = 10, + // 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 = 10, }; // Bitmap for ConfigStatus @@ -1580,16 +1904,24 @@ enum class PumpControlMode : uint8_t kConstantFlow = 0x03, kConstantTemperature = 0x05, kAutomatic = 0x07, - kUnknownEnumValue = 4, + // 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, }; // Enum for PumpOperationMode enum class PumpOperationMode : uint8_t { - kNormal = 0x00, - kMinimum = 0x01, - kMaximum = 0x02, - kLocal = 0x03, + kNormal = 0x00, + kMinimum = 0x01, + kMaximum = 0x02, + kLocal = 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 = 4, }; @@ -1619,7 +1951,11 @@ enum class SetpointAdjustMode : uint8_t kHeatSetpoint = 0x00, kCoolSetpoint = 0x01, kHeatAndCoolSetpoints = 0x02, - kUnknownEnumValue = 3, + // 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, }; #else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM using SetpointAdjustMode = EmberAfSetpointAdjustMode; @@ -1635,15 +1971,23 @@ enum class ThermostatControlSequence : uint8_t kHeatingWithReheat = 0x03, kCoolingAndHeating = 0x04, kCoolingAndHeatingWithReheat = 0x05, - kUnknownEnumValue = 6, + // 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 = 6, }; // Enum for ThermostatRunningMode enum class ThermostatRunningMode : uint8_t { - kOff = 0x00, - kCool = 0x03, - kHeat = 0x04, + kOff = 0x00, + kCool = 0x03, + kHeat = 0x04, + // 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 = 1, }; @@ -1657,6 +2001,10 @@ enum class ThermostatSystemMode : uint8_t kEmergencyHeating = 0x05, kPrecooling = 0x06, kFanOnly = 0x07, + // 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 = 2, }; @@ -1703,19 +2051,27 @@ enum class FanModeSequenceType : uint8_t kOffLowHighAuto = 0x03, kOffOnAuto = 0x04, kOffOn = 0x05, - kUnknownEnumValue = 6, + // 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 = 6, }; // Enum for FanModeType enum class FanModeType : uint8_t { - kOff = 0x00, - kLow = 0x01, - kMedium = 0x02, - kHigh = 0x03, - kOn = 0x04, - kAuto = 0x05, - kSmart = 0x06, + kOff = 0x00, + kLow = 0x01, + kMedium = 0x02, + kHigh = 0x03, + kOn = 0x04, + kAuto = 0x05, + kSmart = 0x06, + // 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 = 7, }; @@ -1765,7 +2121,11 @@ enum class ColorLoopAction : uint8_t kDeactivate = 0x00, kActivateFromColorLoopStartEnhancedHue = 0x01, kActivateFromEnhancedCurrentHue = 0x02, - kUnknownEnumValue = 3, + // 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, }; #else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM using ColorLoopAction = EmberAfColorLoopAction; @@ -1778,8 +2138,12 @@ static ColorLoopAction __attribute__((unused)) kColorLoopActionkUnknownEnumValue // Enum for ColorLoopDirection enum class ColorLoopDirection : uint8_t { - kDecrementHue = 0x00, - kIncrementHue = 0x01, + kDecrementHue = 0x00, + kIncrementHue = 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 = 2, }; #else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM @@ -1796,7 +2160,11 @@ enum class ColorMode : uint8_t kCurrentHueAndCurrentSaturation = 0x00, kCurrentXAndCurrentY = 0x01, kColorTemperature = 0x02, - kUnknownEnumValue = 3, + // 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, }; #else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM using ColorMode = EmberAfColorMode; @@ -1813,6 +2181,10 @@ enum class HueDirection : uint8_t kLongestDistance = 0x01, kUp = 0x02, kDown = 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 = 4, }; #else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM @@ -1826,9 +2198,13 @@ static HueDirection __attribute__((unused)) kHueDirectionkUnknownEnumValue // Enum for HueMoveMode enum class HueMoveMode : uint8_t { - kStop = 0x00, - kUp = 0x01, - kDown = 0x03, + kStop = 0x00, + kUp = 0x01, + kDown = 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 = 2, }; #else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM @@ -1842,8 +2218,12 @@ static HueMoveMode __attribute__((unused)) kHueMoveModekUnknownEnumValue // Enum for HueStepMode enum class HueStepMode : uint8_t { - kUp = 0x01, - kDown = 0x03, + kUp = 0x01, + kDown = 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 = 0, }; #else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM @@ -1857,9 +2237,13 @@ static HueStepMode __attribute__((unused)) kHueStepModekUnknownEnumValue // Enum for SaturationMoveMode enum class SaturationMoveMode : uint8_t { - kStop = 0x00, - kUp = 0x01, - kDown = 0x03, + kStop = 0x00, + kUp = 0x01, + kDown = 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 = 2, }; #else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM @@ -1873,8 +2257,12 @@ static SaturationMoveMode __attribute__((unused)) kSaturationMoveModekUnknownEnu // Enum for SaturationStepMode enum class SaturationStepMode : uint8_t { - kUp = 0x01, - kDown = 0x03, + kUp = 0x01, + kDown = 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 = 0, }; #else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM @@ -1920,8 +2308,12 @@ namespace IlluminanceMeasurement { // Enum for LightSensorType enum class LightSensorType : uint8_t { - kPhotodiode = 0x00, - kCmos = 0x01, + kPhotodiode = 0x00, + kCmos = 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 = 2, }; } // namespace IlluminanceMeasurement @@ -1955,16 +2347,24 @@ namespace Channel { // Enum for ChannelStatusEnum enum class ChannelStatusEnum : uint8_t { - kSuccess = 0x00, - kMultipleMatches = 0x01, - kNoMatches = 0x02, + kSuccess = 0x00, + kMultipleMatches = 0x01, + kNoMatches = 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 = 3, }; // Enum for LineupInfoTypeEnum enum class LineupInfoTypeEnum : uint8_t { - kMso = 0x00, + kMso = 0x00, + // 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 = 1, }; @@ -1981,9 +2381,13 @@ namespace TargetNavigator { // Enum for TargetNavigatorStatusEnum enum class TargetNavigatorStatusEnum : uint8_t { - kSuccess = 0x00, - kTargetNotFound = 0x01, - kNotAllowed = 0x02, + kSuccess = 0x00, + kTargetNotFound = 0x01, + kNotAllowed = 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 = 3, }; } // namespace TargetNavigator @@ -1999,16 +2403,24 @@ enum class MediaPlaybackStatusEnum : uint8_t kNotActive = 0x03, kSpeedOutOfRange = 0x04, kSeekOutOfRange = 0x05, - kUnknownEnumValue = 6, + // 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 = 6, }; // Enum for PlaybackStateEnum enum class PlaybackStateEnum : uint8_t { - kPlaying = 0x00, - kPaused = 0x01, - kNotPlaying = 0x02, - kBuffering = 0x03, + kPlaying = 0x00, + kPaused = 0x01, + kNotPlaying = 0x02, + kBuffering = 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 = 4, }; @@ -2025,18 +2437,22 @@ namespace MediaInput { // Enum for InputTypeEnum enum class InputTypeEnum : uint8_t { - kInternal = 0x00, - kAux = 0x01, - kCoax = 0x02, - kComposite = 0x03, - kHdmi = 0x04, - kInput = 0x05, - kLine = 0x06, - kOptical = 0x07, - kVideo = 0x08, - kScart = 0x09, - kUsb = 0x0A, - kOther = 0x0B, + kInternal = 0x00, + kAux = 0x01, + kCoax = 0x02, + kComposite = 0x03, + kHdmi = 0x04, + kInput = 0x05, + kLine = 0x06, + kOptical = 0x07, + kVideo = 0x08, + kScart = 0x09, + kUsb = 0x0A, + kOther = 0x0B, + // 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 = 12, }; @@ -2141,7 +2557,11 @@ enum class CecKeyCode : uint8_t kF4Yellow = 0x74, kF5 = 0x75, kData = 0x76, - kUnknownEnumValue = 14, + // 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 = 14, }; // Enum for KeypadInputStatusEnum @@ -2150,7 +2570,11 @@ enum class KeypadInputStatusEnum : uint8_t kSuccess = 0x00, kUnsupportedKey = 0x01, kInvalidKeyInCurrentState = 0x02, - kUnknownEnumValue = 3, + // 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, }; // Bitmap for KeypadInputFeature @@ -2167,36 +2591,48 @@ namespace ContentLauncher { // Enum for ContentLaunchStatusEnum enum class ContentLaunchStatusEnum : uint8_t { - kSuccess = 0x00, - kUrlNotAvailable = 0x01, - kAuthFailed = 0x02, + kSuccess = 0x00, + kUrlNotAvailable = 0x01, + kAuthFailed = 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 = 3, }; // Enum for MetricTypeEnum enum class MetricTypeEnum : uint8_t { - kPixels = 0x00, - kPercentage = 0x01, + kPixels = 0x00, + kPercentage = 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 = 2, }; // Enum for ParameterEnum enum class ParameterEnum : uint8_t { - kActor = 0x00, - kChannel = 0x01, - kCharacter = 0x02, - kDirector = 0x03, - kEvent = 0x04, - kFranchise = 0x05, - kGenre = 0x06, - kLeague = 0x07, - kPopularity = 0x08, - kProvider = 0x09, - kSport = 0x0A, - kSportsTeam = 0x0B, - kType = 0x0C, + kActor = 0x00, + kChannel = 0x01, + kCharacter = 0x02, + kDirector = 0x03, + kEvent = 0x04, + kFranchise = 0x05, + kGenre = 0x06, + kLeague = 0x07, + kPopularity = 0x08, + kProvider = 0x09, + kSport = 0x0A, + kSportsTeam = 0x0B, + kType = 0x0C, + // 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 = 13, }; @@ -2220,12 +2656,16 @@ namespace AudioOutput { // Enum for OutputTypeEnum enum class OutputTypeEnum : uint8_t { - kHdmi = 0x00, - kBt = 0x01, - kOptical = 0x02, - kHeadphone = 0x03, - kInternal = 0x04, - kOther = 0x05, + kHdmi = 0x00, + kBt = 0x01, + kOptical = 0x02, + kHeadphone = 0x03, + kInternal = 0x04, + kOther = 0x05, + // 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 = 6, }; @@ -2241,9 +2681,13 @@ namespace ApplicationLauncher { // Enum for ApplicationLauncherStatusEnum enum class ApplicationLauncherStatusEnum : uint8_t { - kSuccess = 0x00, - kAppNotAvailable = 0x01, - kSystemBusy = 0x02, + kSuccess = 0x00, + kAppNotAvailable = 0x01, + kSystemBusy = 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 = 3, }; @@ -2263,7 +2707,11 @@ enum class ApplicationStatusEnum : uint8_t kActiveVisibleFocus = 0x01, kActiveHidden = 0x02, kActiveVisibleNotFocus = 0x03, - kUnknownEnumValue = 4, + // 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, }; } // namespace ApplicationBasic @@ -2281,10 +2729,14 @@ namespace UnitTesting { // Enum for SimpleEnum enum class SimpleEnum : uint8_t { - kUnspecified = 0x00, - kValueA = 0x01, - kValueB = 0x02, - kValueC = 0x03, + kUnspecified = 0x00, + kValueA = 0x01, + kValueB = 0x02, + kValueC = 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 = 4, }; @@ -2338,11 +2790,15 @@ namespace FaultInjection { // Enum for FaultType enum class FaultType : uint8_t { - kUnspecified = 0x00, - kSystemFault = 0x01, - kInetFault = 0x02, - kChipFault = 0x03, - kCertFault = 0x04, + kUnspecified = 0x00, + kSystemFault = 0x01, + kInetFault = 0x02, + kChipFault = 0x03, + kCertFault = 0x04, + // 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, }; } // namespace FaultInjection From fd593502e8d815ae51012a0f09a6dc0c2eda792d Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Mon, 16 Jan 2023 20:49:02 +0000 Subject: [PATCH 05/12] Couple extra fixes --- src/controller/python/BUILD.gn | 3 ++- src/controller/python/chip/enum.py | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/controller/python/BUILD.gn b/src/controller/python/BUILD.gn index f9c6b901a8ade2..a16c6d42347ff7 100644 --- a/src/controller/python/BUILD.gn +++ b/src/controller/python/BUILD.gn @@ -198,7 +198,6 @@ chip_python_wheel_action("chip-core") { "chip/ChipCommissionableNodeCtrl.py", "chip/ChipCoreBluetoothMgr.py", "chip/ChipStack.py", - "chip/enum.py", "chip/FabricAdmin.py", "chip/__init__.py", "chip/ble/__init__.py", @@ -214,6 +213,7 @@ chip_python_wheel_action("chip-core") { "chip/discovery/__init__.py", "chip/discovery/library_handle.py", "chip/discovery/types.py", + "chip/enum.py", "chip/exceptions/__init__.py", "chip/interaction_model/__init__.py", "chip/interaction_model/delegate.py", @@ -290,6 +290,7 @@ chip_python_wheel_action("chip-core") { } py_package_reqs = [ + "aenum", "coloredlogs", "construct", "dacite", diff --git a/src/controller/python/chip/enum.py b/src/controller/python/chip/enum.py index af674e7e7de277..8d5106bb95a04a 100644 --- a/src/controller/python/chip/enum.py +++ b/src/controller/python/chip/enum.py @@ -15,15 +15,24 @@ # limitations under the License. # -from aenum import IntEnum -from aenum import extend_enum +from aenum import IntEnum, extend_enum +# Flag on whether we should map unknown enum values to kUnknownEnumValue. _map_missing_enum_to_unknown_enum_value = True +# Count that is used to append the end of placeholder enum names in +# MatterIntEnum.extend_enum_if_value_doesnt_exist. _placeholder_count = 0 class MatterIntEnum(IntEnum): - + '''Matter implementation of integer enum. + + This provides flexibility so that we don't have to rely on the strongly typed + nature of built in enum. By default, globally, all unknown enum mapping are + turned into kUnknownEnumValue. This also give capability of extending the enum + at runtime allowing for test code to test behaviour of sending out out of scope + enum values. + ''' @classmethod def _missing_(cls, value): global _map_missing_enum_to_unknown_enum_value @@ -46,5 +55,6 @@ def extend_enum_if_value_doesnt_exist(cls, value): def set_map_missing_enum_to_unknown_enum_value(value: bool): + '''Sets flag that handles what to do on unknown enum value type.''' global _map_missing_enum_to_unknown_enum_value _map_missing_enum_to_unknown_enum_value = value From b90d807c2d32feed5cb51544c96c679847b66d79 Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Tue, 17 Jan 2023 21:33:12 +0000 Subject: [PATCH 06/12] Remove unneeded global --- src/controller/python/chip/enum.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/controller/python/chip/enum.py b/src/controller/python/chip/enum.py index 8d5106bb95a04a..ceddbfa01823b9 100644 --- a/src/controller/python/chip/enum.py +++ b/src/controller/python/chip/enum.py @@ -35,7 +35,6 @@ class MatterIntEnum(IntEnum): ''' @classmethod def _missing_(cls, value): - global _map_missing_enum_to_unknown_enum_value if _map_missing_enum_to_unknown_enum_value: return cls.kUnknownEnumValue return None From b367fdf55aa1d33c1534129bad584c5e01029250 Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Wed, 18 Jan 2023 14:40:56 +0000 Subject: [PATCH 07/12] Add lock for placeholder count --- src/controller/python/chip/enum.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/controller/python/chip/enum.py b/src/controller/python/chip/enum.py index ceddbfa01823b9..66ff85b11050e4 100644 --- a/src/controller/python/chip/enum.py +++ b/src/controller/python/chip/enum.py @@ -16,9 +16,11 @@ # from aenum import IntEnum, extend_enum +from threading import Lock # Flag on whether we should map unknown enum values to kUnknownEnumValue. _map_missing_enum_to_unknown_enum_value = True +_placeholder_count_lock = Lock() # Count that is used to append the end of placeholder enum names in # MatterIntEnum.extend_enum_if_value_doesnt_exist. _placeholder_count = 0 @@ -47,9 +49,12 @@ def extend_enum_if_value_doesnt_exist(cls, value): return_value = None if return_value is None or return_value.value != value: + global _placeholder_count_lock global _placeholder_count - return_value = extend_enum(cls, f'kUnknownPlaceholder{_placeholder_count}', value) - _placeholder_count = _placeholder_count + 1 + with _placeholder_count_lock: + return_value = extend_enum(cls, f'kUnknownPlaceholder{_placeholder_count}', value) + _placeholder_count = _placeholder_count + 1 + return return_value From 7e7f2c0de665f136dd0bec80bba8e2cfc61fd8d5 Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Wed, 18 Jan 2023 14:43:23 +0000 Subject: [PATCH 08/12] Restyle --- src/controller/python/chip/enum.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/controller/python/chip/enum.py b/src/controller/python/chip/enum.py index 66ff85b11050e4..ce545ebe88e727 100644 --- a/src/controller/python/chip/enum.py +++ b/src/controller/python/chip/enum.py @@ -15,9 +15,10 @@ # limitations under the License. # -from aenum import IntEnum, extend_enum from threading import Lock +from aenum import IntEnum, extend_enum + # Flag on whether we should map unknown enum values to kUnknownEnumValue. _map_missing_enum_to_unknown_enum_value = True _placeholder_count_lock = Lock() From 0cd4073531b0cf9a72d284adf42fe92ac976f55f Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Wed, 18 Jan 2023 19:29:48 +0000 Subject: [PATCH 09/12] add missing regen to cluster-enums.h after merging master --- .../app-common/app-common/zap-generated/cluster-enums.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 0763a221684e60..6a91c67563cafe 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 @@ -1204,8 +1204,12 @@ namespace OperationalCredentials { // Enum for CertificateChainTypeEnum enum class CertificateChainTypeEnum : uint8_t { - kDACCertificate = 0x01, - kPAICertificate = 0x02, + kDACCertificate = 0x01, + kPAICertificate = 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 = 0, }; From d2490ded4ea1ddafd0c821a436ba03fda185e19f Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Thu, 19 Jan 2023 13:34:56 +0000 Subject: [PATCH 10/12] Quick fix --- src/controller/python/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controller/python/BUILD.gn b/src/controller/python/BUILD.gn index a16c6d42347ff7..b1b7cdbd6310cc 100644 --- a/src/controller/python/BUILD.gn +++ b/src/controller/python/BUILD.gn @@ -209,11 +209,11 @@ chip_python_wheel_action("chip-core") { "chip/clusters/Attribute.py", "chip/clusters/Command.py", "chip/clusters/__init__.py", + "chip/clusters/enum.py", "chip/configuration/__init__.py", "chip/discovery/__init__.py", "chip/discovery/library_handle.py", "chip/discovery/types.py", - "chip/enum.py", "chip/exceptions/__init__.py", "chip/interaction_model/__init__.py", "chip/interaction_model/delegate.py", From 2ce3bad25ab7363766818719e0fd5cc2f41dce8d Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Thu, 19 Jan 2023 13:38:11 +0000 Subject: [PATCH 11/12] Quick Fix --- src/controller/python/chip/yaml/format_converter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controller/python/chip/yaml/format_converter.py b/src/controller/python/chip/yaml/format_converter.py index 7f7549d8896e6c..7e4dc4f9bc2fcf 100644 --- a/src/controller/python/chip/yaml/format_converter.py +++ b/src/controller/python/chip/yaml/format_converter.py @@ -20,7 +20,7 @@ from dataclasses import dataclass from chip.clusters.Types import Nullable, NullValue -from chip.enum import MatterIntEnum +from chip.clusters.enum import MatterIntEnum from chip.tlv import float32, uint from chip.yaml.errors import ValidationError from matter_idl import matter_idl_types From 09c23e885f788a496e1ff344308127e792059ec5 Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Thu, 19 Jan 2023 13:51:21 +0000 Subject: [PATCH 12/12] Restyle --- src/controller/python/chip/yaml/format_converter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controller/python/chip/yaml/format_converter.py b/src/controller/python/chip/yaml/format_converter.py index 7e4dc4f9bc2fcf..551e1e398ef85b 100644 --- a/src/controller/python/chip/yaml/format_converter.py +++ b/src/controller/python/chip/yaml/format_converter.py @@ -19,8 +19,8 @@ import typing from dataclasses import dataclass -from chip.clusters.Types import Nullable, NullValue from chip.clusters.enum import MatterIntEnum +from chip.clusters.Types import Nullable, NullValue from chip.tlv import float32, uint from chip.yaml.errors import ValidationError from matter_idl import matter_idl_types