From 1381482750b1c30ec189347bffd7506d7d2df805 Mon Sep 17 00:00:00 2001 From: yunhanw-google Date: Wed, 17 Nov 2021 07:11:32 -0800 Subject: [PATCH] add event codegen for python (#11802) --- .../templates/app/cluster-objects.zapt | 4 +- .../python/chip/clusters/ClusterObjects.py | 56 +++ .../python/chip/clusters/Objects.py | 441 +++++++++++++++++- .../templates/python-cluster-Objects-py.zapt | 25 +- .../zap-generated/cluster-objects.h | 128 ++--- 5 files changed, 586 insertions(+), 68 deletions(-) diff --git a/src/app/zap-templates/templates/app/cluster-objects.zapt b/src/app/zap-templates/templates/app/cluster-objects.zapt index 3a9942ec88ceee..398fe44b8f4aad 100644 --- a/src/app/zap-templates/templates/app/cluster-objects.zapt +++ b/src/app/zap-templates/templates/app/cluster-objects.zapt @@ -195,8 +195,8 @@ enum class Fields { struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::{{asUpperCamelCase priority}}; - static constexpr EventId eventId = {{asMEI manufacturerCode code}}; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::{{asUpperCamelCase parent.name}}::Id; } {{#zcl_event_fields}} diff --git a/src/controller/python/chip/clusters/ClusterObjects.py b/src/controller/python/chip/clusters/ClusterObjects.py index efb6ff341341c2..31542dc5a288bd 100644 --- a/src/controller/python/chip/clusters/ClusterObjects.py +++ b/src/controller/python/chip/clusters/ClusterObjects.py @@ -275,3 +275,59 @@ def _cluster_object(cls) -> ClusterObject: ) ], bases=(ClusterObject,)) + + +class ClusterEventDescriptor: + ''' + The ClusterEventDescriptor is used for holding an event's metadata like its cluster id, event id and its type. + + Users should not initialize an object based on this class. Instead, users should pass the subclass objects to tell some methods what they want. + + The implementation of this functions is quite tricky, it will create a cluster object on-the-fly, and use it for actual encode / decode routine to save lines of code. + ''' + @classmethod + def ToTLV(cls, tag: Union[int, None], value): + writer = tlv.TLVWriter() + wrapped_value = cls._cluster_object(Value=value) + cls.event_type.PutFieldToTLV(tag, + asdict(wrapped_value)['Value'], writer, '') + return writer.encoding + + @classmethod + def FromTLV(cls, tlvBuffer: bytes): + obj_class = cls._cluster_object + return obj_class.FromDict(obj_class.descriptor.TagDictToLabelDict('', {0: tlv.TLVReader(tlvBuffer).get().get('Any', {})})).Value + + @classmethod + def FromTagDictOrRawValue(cls, val: Any): + obj_class = cls._cluster_object + return obj_class.FromDict(obj_class.descriptor.TagDictToLabelDict('', {0: val})).Value + + @ChipUtility.classproperty + def cluster_id(self) -> int: + raise NotImplementedError() + + @ChipUtility.classproperty + def event_id(self) -> int: + raise NotImplementedError() + + @ChipUtility.classproperty + def event_type(cls) -> ClusterObjectFieldDescriptor: + raise NotImplementedError() + + @ChipUtility.classproperty + def _cluster_object(cls) -> ClusterObject: + return make_dataclass('InternalClass', + [ + ('Value', List[cls.event_type.Type] + if cls.event_type.IsArray else cls.event_type.Type, field(default=None)), + ('descriptor', ClassVar[ClusterObjectDescriptor], + field( + default=ClusterObjectDescriptor( + Fields=[ClusterObjectFieldDescriptor( + Label='Value', Tag=0, Type=cls.event_type.Type, IsArray=cls.event_type.IsArray)] + ) + ) + ) + ], + bases=(ClusterObject,)) diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 73c0d3d830815f..6ce944593087b8 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -29,7 +29,7 @@ from chip.tlv import uint -from .ClusterObjects import ClusterObject, ClusterObjectDescriptor, ClusterObjectFieldDescriptor, ClusterCommand, ClusterAttributeDescriptor, Cluster +from .ClusterObjects import ClusterObject, ClusterObjectDescriptor, ClusterObjectFieldDescriptor, ClusterCommand, ClusterAttributeDescriptor, Cluster, ClusterEventDescriptor from .Types import Nullable, NullValue @@ -4934,6 +4934,59 @@ def attribute_id(cls) -> int: def attribute_type(cls) -> ClusterObjectFieldDescriptor: return ClusterObjectFieldDescriptor(Type=uint) + class Events: + @dataclass + class StartUp(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0028 + event_id: typing.ClassVar[int] = 0x00000000 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor( + Label="softwareVersion", Tag=0, Type=uint), + ]) + + softwareVersion: 'uint' = None + + @dataclass + class ShutDown(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0028 + event_id: typing.ClassVar[int] = 0x00000001 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ]) + + @dataclass + class Leave(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0028 + event_id: typing.ClassVar[int] = 0x00000002 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ]) + + @dataclass + class ReachableChanged(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0028 + event_id: typing.ClassVar[int] = 0x00000003 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor( + Label="reachableNewValue", Tag=0, Type=bool), + ]) + + reachableNewValue: 'bool' = None + @dataclass class OtaSoftwareUpdateProvider(Cluster): @@ -6604,6 +6657,76 @@ def attribute_id(cls) -> int: def attribute_type(cls) -> ClusterObjectFieldDescriptor: return ClusterObjectFieldDescriptor(Type=uint) + class Events: + @dataclass + class HardwareFaultChange(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0033 + event_id: typing.ClassVar[int] = 0x00000000 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor( + Label="current", Tag=0, Type=typing.List[GeneralDiagnostics.Enums.HardwareFaultType], IsArray=True), + ClusterObjectFieldDescriptor( + Label="previous", Tag=1, Type=typing.List[GeneralDiagnostics.Enums.HardwareFaultType], IsArray=True), + ]) + + current: typing.List['typing.List[GeneralDiagnostics.Enums.HardwareFaultType]'] = None + previous: typing.List['typing.List[GeneralDiagnostics.Enums.HardwareFaultType]'] = None + + @dataclass + class RadioFaultChange(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0033 + event_id: typing.ClassVar[int] = 0x00000001 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor( + Label="current", Tag=0, Type=typing.List[GeneralDiagnostics.Enums.RadioFaultType], IsArray=True), + ClusterObjectFieldDescriptor( + Label="previous", Tag=1, Type=typing.List[GeneralDiagnostics.Enums.RadioFaultType], IsArray=True), + ]) + + current: typing.List['typing.List[GeneralDiagnostics.Enums.RadioFaultType]'] = None + previous: typing.List['typing.List[GeneralDiagnostics.Enums.RadioFaultType]'] = None + + @dataclass + class NetworkFaultChange(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0033 + event_id: typing.ClassVar[int] = 0x00000002 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor( + Label="current", Tag=0, Type=typing.List[GeneralDiagnostics.Enums.NetworkFaultType], IsArray=True), + ClusterObjectFieldDescriptor( + Label="previous", Tag=1, Type=typing.List[GeneralDiagnostics.Enums.NetworkFaultType], IsArray=True), + ]) + + current: typing.List['typing.List[GeneralDiagnostics.Enums.NetworkFaultType]'] = None + previous: typing.List['typing.List[GeneralDiagnostics.Enums.NetworkFaultType]'] = None + + @dataclass + class BootReason(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0033 + event_id: typing.ClassVar[int] = 0x00000003 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor( + Label="bootReason", Tag=0, Type=GeneralDiagnostics.Enums.BootReasonType), + ]) + + bootReason: 'GeneralDiagnostics.Enums.BootReasonType' = None + @dataclass class SoftwareDiagnostics(Cluster): @@ -6744,6 +6867,22 @@ def attribute_id(cls) -> int: def attribute_type(cls) -> ClusterObjectFieldDescriptor: return ClusterObjectFieldDescriptor(Type=uint) + class Events: + @dataclass + class SoftwareFault(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0034 + event_id: typing.ClassVar[int] = 0x00000000 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor( + Label="softwareFault", Tag=0, Type=SoftwareDiagnostics.Structs.SoftwareFault), + ]) + + softwareFault: 'SoftwareDiagnostics.Structs.SoftwareFault' = None + @dataclass class ThreadNetworkDiagnostics(Cluster): @@ -7779,6 +7918,22 @@ def attribute_id(cls) -> int: def attribute_type(cls) -> ClusterObjectFieldDescriptor: return ClusterObjectFieldDescriptor(Type=uint) + class Events: + @dataclass + class ConnectionStatus(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0035 + event_id: typing.ClassVar[int] = 0x00000000 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor( + Label="connectionStatus", Tag=0, Type=ThreadNetworkDiagnostics.Enums.ThreadConnectionStatus), + ]) + + connectionStatus: 'ThreadNetworkDiagnostics.Enums.ThreadConnectionStatus' = None + @dataclass class WiFiNetworkDiagnostics(Cluster): @@ -8020,6 +8175,55 @@ def attribute_id(cls) -> int: def attribute_type(cls) -> ClusterObjectFieldDescriptor: return ClusterObjectFieldDescriptor(Type=uint) + class Events: + @dataclass + class Disconnection(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0036 + event_id: typing.ClassVar[int] = 0x00000000 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor( + Label="reasonCode", Tag=0, Type=uint), + ]) + + reasonCode: 'uint' = None + + @dataclass + class AssociationFailure(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0036 + event_id: typing.ClassVar[int] = 0x00000001 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor( + Label="associationFailure", Tag=0, Type=WiFiNetworkDiagnostics.Enums.AssociationFailureCause), + ClusterObjectFieldDescriptor( + Label="status", Tag=1, Type=uint), + ]) + + associationFailure: 'WiFiNetworkDiagnostics.Enums.AssociationFailureCause' = None + status: 'uint' = None + + @dataclass + class ConnectionStatus(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0036 + event_id: typing.ClassVar[int] = 0x00000002 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor( + Label="connectionStatus", Tag=0, Type=WiFiNetworkDiagnostics.Enums.WiFiConnectionStatus), + ]) + + connectionStatus: 'WiFiNetworkDiagnostics.Enums.WiFiConnectionStatus' = None + @dataclass class EthernetNetworkDiagnostics(Cluster): @@ -9122,6 +9326,22 @@ def attribute_id(cls) -> int: def attribute_type(cls) -> ClusterObjectFieldDescriptor: return ClusterObjectFieldDescriptor(Type=uint) + class Events: + @dataclass + class StateChange(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0045 + event_id: typing.ClassVar[int] = 0x00000000 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor( + Label="stateValue", Tag=0, Type=bool), + ]) + + stateValue: 'bool' = None + @dataclass class ModeSelect(Cluster): @@ -12100,6 +12320,194 @@ def attribute_id(cls) -> int: def attribute_type(cls) -> ClusterObjectFieldDescriptor: return ClusterObjectFieldDescriptor(Type=uint) + class Events: + @dataclass + class SupplyVoltageLow(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0200 + event_id: typing.ClassVar[int] = 0x00000000 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ]) + + @dataclass + class SupplyVoltageHigh(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0200 + event_id: typing.ClassVar[int] = 0x00000001 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ]) + + @dataclass + class PowerMissingPhase(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0200 + event_id: typing.ClassVar[int] = 0x00000002 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ]) + + @dataclass + class SystemPressureLow(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0200 + event_id: typing.ClassVar[int] = 0x00000003 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ]) + + @dataclass + class SystemPressureHigh(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0200 + event_id: typing.ClassVar[int] = 0x00000004 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ]) + + @dataclass + class DryRunning(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0200 + event_id: typing.ClassVar[int] = 0x00000005 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ]) + + @dataclass + class MotorTemperatureHigh(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0200 + event_id: typing.ClassVar[int] = 0x00000006 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ]) + + @dataclass + class PumpMotorFatalFailure(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0200 + event_id: typing.ClassVar[int] = 0x00000007 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ]) + + @dataclass + class ElectronicTemperatureHigh(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0200 + event_id: typing.ClassVar[int] = 0x00000008 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ]) + + @dataclass + class PumpBlocked(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0200 + event_id: typing.ClassVar[int] = 0x00000009 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ]) + + @dataclass + class SensorFailure(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0200 + event_id: typing.ClassVar[int] = 0x0000000A + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ]) + + @dataclass + class ElectronicNonFatalFailure(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0200 + event_id: typing.ClassVar[int] = 0x0000000B + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ]) + + @dataclass + class ElectronicFatalFailure(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0200 + event_id: typing.ClassVar[int] = 0x0000000C + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ]) + + @dataclass + class GeneralFault(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0200 + event_id: typing.ClassVar[int] = 0x0000000D + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ]) + + @dataclass + class Leakage(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0200 + event_id: typing.ClassVar[int] = 0x0000000E + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ]) + + @dataclass + class AirDetection(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0200 + event_id: typing.ClassVar[int] = 0x0000000F + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ]) + + @dataclass + class TurbineOperation(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x0200 + event_id: typing.ClassVar[int] = 0x00000010 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ]) + @dataclass class Thermostat(Cluster): @@ -21966,6 +22374,37 @@ def attribute_id(cls) -> int: def attribute_type(cls) -> ClusterObjectFieldDescriptor: return ClusterObjectFieldDescriptor(Type=uint) + class Events: + @dataclass + class TestEvent(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = 0x050F + event_id: typing.ClassVar[int] = 0x00000001 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor( + Label="arg1", Tag=1, Type=uint), + ClusterObjectFieldDescriptor( + Label="arg2", Tag=2, Type=TestCluster.Enums.SimpleEnum), + ClusterObjectFieldDescriptor( + Label="arg3", Tag=3, Type=bool), + ClusterObjectFieldDescriptor( + Label="arg4", Tag=4, Type=TestCluster.Structs.SimpleStruct), + ClusterObjectFieldDescriptor( + Label="arg5", Tag=5, Type=typing.List[TestCluster.Structs.SimpleStruct], IsArray=True), + ClusterObjectFieldDescriptor( + Label="arg6", Tag=6, Type=typing.List[TestCluster.Enums.SimpleEnum], IsArray=True), + ]) + + arg1: 'uint' = None + arg2: 'TestCluster.Enums.SimpleEnum' = None + arg3: 'bool' = None + arg4: 'TestCluster.Structs.SimpleStruct' = None + arg5: typing.List['typing.List[TestCluster.Structs.SimpleStruct]'] = None + arg6: typing.List['typing.List[TestCluster.Enums.SimpleEnum]'] = None + @dataclass class Messaging(Cluster): diff --git a/src/controller/python/templates/python-cluster-Objects-py.zapt b/src/controller/python/templates/python-cluster-Objects-py.zapt index 28276d70fdd0f3..70a7285c4f5721 100644 --- a/src/controller/python/templates/python-cluster-Objects-py.zapt +++ b/src/controller/python/templates/python-cluster-Objects-py.zapt @@ -12,7 +12,7 @@ from chip import ChipUtility from chip.tlv import uint -from .ClusterObjects import ClusterObject, ClusterObjectDescriptor, ClusterObjectFieldDescriptor, ClusterCommand, ClusterAttributeDescriptor, Cluster +from .ClusterObjects import ClusterObject, ClusterObjectDescriptor, ClusterObjectFieldDescriptor, ClusterCommand, ClusterAttributeDescriptor, Cluster, ClusterEventDescriptor from .Types import Nullable, NullValue {{#zcl_clusters}} @@ -107,5 +107,28 @@ class {{asUpperCamelCase name}}(Cluster): {{/zcl_attributes_server}} +{{#zcl_events}} +{{#first}} + class Events: +{{/first}} + @dataclass + class {{asUpperCamelCase name}}(ClusterEventDescriptor): + cluster_id: typing.ClassVar[int] = {{ asHex parent.code 4 }} + event_id: typing.ClassVar[int] = {{asMEI manufacturerCode code}} + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields = [ + {{#zcl_event_fields}} + ClusterObjectFieldDescriptor(Label="{{ asLowerCamelCase name }}", Tag={{ fieldIdentifier }}, Type={{zapTypeToPythonClusterObjectType type ns=(asUpperCamelCase parent.parent.name)}}{{#if isArray}}, IsArray=True{{/if}}), + {{/zcl_event_fields}} + ]) + + {{#zcl_event_fields}} + {{ asLowerCamelCase name }}: {{#if isArray}}typing.List[{{/if}}'{{zapTypeToPythonClusterObjectType type ns=(asUpperCamelCase parent.parent.name)}}'{{#if isArray}}]{{/if}} = None + {{/zcl_event_fields}} + +{{/zcl_events}} {{/zcl_clusters}} diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h index 5b2b480d9eb4a8..e38f3fe3b44080 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h @@ -6856,8 +6856,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Critical; - static constexpr EventId eventId = 0x00000000; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::Basic::Id; } uint32_t softwareVersion; @@ -6888,8 +6888,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Info; - static constexpr EventId eventId = 0x00000001; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::Basic::Id; } CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; @@ -6916,8 +6916,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Info; - static constexpr EventId eventId = 0x00000002; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::Basic::Id; } CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; @@ -6945,8 +6945,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Info; - static constexpr EventId eventId = 0x00000003; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::Basic::Id; } bool reachableNewValue; @@ -9266,8 +9266,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Critical; - static constexpr EventId eventId = 0x00000000; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::GeneralDiagnostics::Id; } DataModel::List current; @@ -9302,8 +9302,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Critical; - static constexpr EventId eventId = 0x00000001; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::GeneralDiagnostics::Id; } DataModel::List current; @@ -9338,8 +9338,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Critical; - static constexpr EventId eventId = 0x00000002; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::GeneralDiagnostics::Id; } DataModel::List current; @@ -9373,8 +9373,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Critical; - static constexpr EventId eventId = 0x00000003; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::GeneralDiagnostics::Id; } BootReasonType bootReason; @@ -9569,8 +9569,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Info; - static constexpr EventId eventId = 0x00000000; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::SoftwareDiagnostics::Id; } Structs::SoftwareFault::Type softwareFault; @@ -10549,8 +10549,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Info; - static constexpr EventId eventId = 0x00000000; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::ThreadNetworkDiagnostics::Id; } ThreadConnectionStatus connectionStatus; @@ -10851,8 +10851,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Info; - static constexpr EventId eventId = 0x00000000; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::WiFiNetworkDiagnostics::Id; } uint16_t reasonCode; @@ -10885,8 +10885,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Info; - static constexpr EventId eventId = 0x00000001; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::WiFiNetworkDiagnostics::Id; } AssociationFailureCause associationFailure; @@ -10920,8 +10920,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Info; - static constexpr EventId eventId = 0x00000002; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::WiFiNetworkDiagnostics::Id; } WiFiConnectionStatus connectionStatus; @@ -12419,8 +12419,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Info; - static constexpr EventId eventId = 0x00000000; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::BooleanState::Id; } bool stateValue; @@ -16554,8 +16554,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Info; - static constexpr EventId eventId = 0x00000000; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::PumpConfigurationAndControl::Id; } CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; @@ -16582,8 +16582,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Info; - static constexpr EventId eventId = 0x00000001; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::PumpConfigurationAndControl::Id; } CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; @@ -16610,8 +16610,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Info; - static constexpr EventId eventId = 0x00000002; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::PumpConfigurationAndControl::Id; } CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; @@ -16638,8 +16638,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Info; - static constexpr EventId eventId = 0x00000003; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::PumpConfigurationAndControl::Id; } CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; @@ -16666,8 +16666,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Info; - static constexpr EventId eventId = 0x00000004; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::PumpConfigurationAndControl::Id; } CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; @@ -16694,8 +16694,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Critical; - static constexpr EventId eventId = 0x00000005; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::PumpConfigurationAndControl::Id; } CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; @@ -16722,8 +16722,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Info; - static constexpr EventId eventId = 0x00000006; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::PumpConfigurationAndControl::Id; } CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; @@ -16750,8 +16750,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Critical; - static constexpr EventId eventId = 0x00000007; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::PumpConfigurationAndControl::Id; } CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; @@ -16778,8 +16778,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Info; - static constexpr EventId eventId = 0x00000008; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::PumpConfigurationAndControl::Id; } CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; @@ -16806,8 +16806,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Critical; - static constexpr EventId eventId = 0x00000009; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::PumpConfigurationAndControl::Id; } CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; @@ -16834,8 +16834,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Info; - static constexpr EventId eventId = 0x0000000A; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::PumpConfigurationAndControl::Id; } CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; @@ -16862,8 +16862,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Info; - static constexpr EventId eventId = 0x0000000B; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::PumpConfigurationAndControl::Id; } CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; @@ -16890,8 +16890,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Critical; - static constexpr EventId eventId = 0x0000000C; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::PumpConfigurationAndControl::Id; } CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; @@ -16918,8 +16918,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Info; - static constexpr EventId eventId = 0x0000000D; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::PumpConfigurationAndControl::Id; } CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; @@ -16946,8 +16946,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Info; - static constexpr EventId eventId = 0x0000000E; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::PumpConfigurationAndControl::Id; } CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; @@ -16974,8 +16974,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Info; - static constexpr EventId eventId = 0x0000000F; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::PumpConfigurationAndControl::Id; } CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; @@ -17002,8 +17002,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Info; - static constexpr EventId eventId = 0x00000010; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::PumpConfigurationAndControl::Id; } CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; @@ -28890,8 +28890,8 @@ enum class Fields struct Type { public: - static constexpr PriorityLevel priorityLevel = PriorityLevel::Info; - static constexpr EventId eventId = 0x00000001; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::TestCluster::Id; } uint8_t arg1;