From bfb87667de280d417ff1e24ca34f4c5298222f94 Mon Sep 17 00:00:00 2001 From: Mikhail Antropov Date: Mon, 17 Jun 2024 18:24:18 +0300 Subject: [PATCH 01/16] Add XML and generated files of the Energy Calendar cluster --- .github/workflows/tests.yaml | 1 + data_model/1.3/clusters/EnergyCalendar.xml | 297 +++ scripts/rules.matterlint | 1 + src/app/common/templates/config-data.yaml | 1 + .../chip/energy-calendar-cluster.xml | 126 ++ .../zcl/zcl-with-test-extensions.json | 1 + src/app/zap-templates/zcl/zcl.json | 1 + src/app/zap_cluster_list.json | 4 +- .../data_model/controller-clusters.matter | 92 + .../python/chip/clusters/CHIPClusters.py | 118 ++ .../python/chip/clusters/Objects.py | 457 +++++ .../zap-generated/attributes/Accessors.cpp | 1020 ++++++++++ .../zap-generated/attributes/Accessors.h | 172 ++ .../app-common/zap-generated/callback.h | 44 + .../zap-generated/cluster-enums-check.h | 15 + .../app-common/zap-generated/cluster-enums.h | 51 + .../zap-generated/cluster-objects.cpp | 301 +++ .../zap-generated/cluster-objects.h | 377 ++++ .../app-common/zap-generated/ids/Attributes.h | 78 + .../app-common/zap-generated/ids/Clusters.h | 3 + .../zap-generated/cluster/Commands.h | 136 ++ .../cluster/ComplexArgumentParser.cpp | 222 +++ .../cluster/ComplexArgumentParser.h | 25 + .../cluster/logging/DataModelLogger.cpp | 285 +++ .../cluster/logging/DataModelLogger.h | 15 + .../zap-generated/cluster/Commands.h | 1651 +++++++++++++++++ 26 files changed, 5493 insertions(+), 1 deletion(-) create mode 100644 data_model/1.3/clusters/EnergyCalendar.xml create mode 100644 src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index d14d188a2fb6e4..6ed2ea89cf9dd2 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -206,6 +206,7 @@ jobs: src/app/zap-templates/zcl/data-model/chip/sample-mei-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/electrical-energy-measurement-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/electrical-power-measurement-cluster.xml \ + src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml \ " - name: Build Apps run: | diff --git a/data_model/1.3/clusters/EnergyCalendar.xml b/data_model/1.3/clusters/EnergyCalendar.xml new file mode 100644 index 00000000000000..c920a2cc965145 --- /dev/null +++ b/data_model/1.3/clusters/EnergyCalendar.xml @@ -0,0 +1,297 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/scripts/rules.matterlint b/scripts/rules.matterlint index e7bd644249a13e..47b4712a7ff90d 100644 --- a/scripts/rules.matterlint +++ b/scripts/rules.matterlint @@ -117,6 +117,7 @@ load "../src/app/zap-templates/zcl/data-model/chip/resource-monitoring-cluster.x load "../src/app/zap-templates/zcl/data-model/chip/sample-mei-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/electrical-energy-measurement-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/electrical-power-measurement-cluster.xml"; +load "../src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml"; all endpoints { // These attributes follow a different code path and do not have to be diff --git a/src/app/common/templates/config-data.yaml b/src/app/common/templates/config-data.yaml index 61e7c45582268a..1ee9f9756e5b33 100644 --- a/src/app/common/templates/config-data.yaml +++ b/src/app/common/templates/config-data.yaml @@ -38,6 +38,7 @@ CommandHandlerInterfaceOnlyClusters: - Microwave Oven Control - Energy EVSE - Energy EVSE Mode + - Energy Calendar - Device Energy Management - Device Energy Management Mode - Electrical Power Measurement diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml new file mode 100644 index 00000000000000..82814a1215fc65 --- /dev/null +++ b/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Energy Calendar + Energy Management + 0x009A + ENERGY_CALENDAR_CLUSTER + true + true + The Energy Calendar Cluster provides a mechanism for communicating schedules associated with various forms of energy consumption. + + + + + + + + + + + + + + + + + + + CalendarID + Name + ProviderID + EventID + StartDate + CalendarPeriods + SpecialDays + CurrentDay + NextDay + CurrentTransition + CurrentPeakPeriod + NextPeakPeriod + + + diff --git a/src/app/zap-templates/zcl/zcl-with-test-extensions.json b/src/app/zap-templates/zcl/zcl-with-test-extensions.json index bc1a29c4b4aa3b..77aa4d5dc6406e 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -135,6 +135,7 @@ "window-covering.xml", "matter-devices.xml", "sample-mei-cluster.xml", + "energy-calendar-cluster.xml", "types/door-lock.xml", "types/occupancy-sensing.xml", "types/thermostat-user-interface-configuration.xml" diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index db4526e39cbbde..77376845e9874d 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -129,6 +129,7 @@ "window-covering.xml", "matter-devices.xml", "sample-mei-cluster.xml", + "energy-calendar-cluster.xml", "types/door-lock.xml", "types/occupancy-sensing.xml", "types/thermostat-user-interface-configuration.xml" diff --git a/src/app/zap_cluster_list.json b/src/app/zap_cluster_list.json index a047340147ece5..4052253aed5fa1 100644 --- a/src/app/zap_cluster_list.json +++ b/src/app/zap_cluster_list.json @@ -131,7 +131,8 @@ "WATER_HEATER_MANAGEMENT_CLUSTER": [], "WATER_HEATER_MODE_CLUSTER": [], "WIFI_NETWORK_DIAGNOSTICS_CLUSTER": [], - "WINDOW_COVERING_CLUSTER": [] + "WINDOW_COVERING_CLUSTER": [], + "ENERGY_CALENDAR_CLUSTER": [], }, "ServerDirectories": { "ACCESS_CONTROL_CLUSTER": ["access-control-server"], @@ -313,5 +314,6 @@ "WINDOW_COVERING_CLUSTER": ["window-covering-server"], "WATER_HEATER_MANAGEMENT_CLUSTER": ["water-heater-management-server"], "WATER_HEATER_MODE_CLUSTER": ["mode-base-server"] + "ENERGY_CALENDAR_CLUSTER": ["energy-calendar-server"], } } diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 1ba56719ab4549..6c216ad9427705 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -5437,6 +5437,98 @@ cluster EnergyEvse = 153 { timed command ClearTargets(): DefaultSuccess = 7; } +/** The Energy Calendar Cluster provides a mechanism for communicating schedules associated with various forms of energy consumption. */ +cluster EnergyCalendar = 154 { + revision 2; + + enum PeakPeriodSeverityEnum : enum8 { + kUnused = 0; + kLow = 1; + kMedium = 2; + kHigh = 3; + } + + bitmap AuxiliaryLoadBitmap : bitmap8 { + kAuxiliarySwitch1 = 0x1; + kAuxiliarySwitch2 = 0x2; + kAuxiliarySwitch3 = 0x4; + kAuxiliarySwitch4 = 0x8; + kAuxiliarySwitch5 = 0x10; + kAuxiliarySwitch6 = 0x20; + kAuxiliarySwitch7 = 0x40; + kAuxiliarySwitch8 = 0x80; + } + + bitmap Feature : bitmap32 { + kPricingTier = 0x1; + kFriendlyCredit = 0x2; + kAuxiliaryLoad = 0x4; + kPeakPeriod = 0x8; + } + + bitmap TransitionDayOfWeekBitmap : bitmap8 { + kSunday = 0x1; + kMonday = 0x2; + kTuesday = 0x4; + kWednesday = 0x8; + kThursday = 0x10; + kFriday = 0x20; + kSaturday = 0x40; + } + + struct TransitionStruct { + int16u transitionTime = 0; + optional int32u priceTier = 1; + optional boolean friendlyCredit = 2; + optional AuxiliaryLoadBitmap auxiliaryLoad = 3; + } + + struct Date { + optional int16u year = 0; + optional int8u month = 1; + optional int8u day = 2; + optional int8u dayOfWeek = 3; + } + + struct DayStruct { + optional Date date = 0; + optional TransitionDayOfWeekBitmap daysOfWeek = 1; + TransitionStruct transitions[] = 2; + optional int32u calendarID = 3; + } + + struct CalendarPeriod { + epoch_s startDate = 0; + DayStruct days[] = 1; + } + + struct PeakPeriodStruct { + PeakPeriodSeverityEnum severity = 0; + int16u peakPeriod = 1; + epoch_s startTime = 2; + epoch_s endTime = 3; + } + + readonly attribute nullable int32u calendarID = 0; + readonly attribute nullable char_string<12> name = 1; + readonly attribute nullable int32u providerID = 2; + readonly attribute nullable int32u eventID = 3; + readonly attribute nullable epoch_s startDate = 4; + readonly attribute CalendarPeriod calendarPeriods[] = 5; + readonly attribute DayStruct specialDays[] = 6; + readonly attribute nullable DayStruct currentDay = 7; + readonly attribute nullable DayStruct nextDay = 8; + readonly attribute nullable TransitionStruct currentTransition = 9; + readonly attribute nullable PeakPeriodStruct currentPeakPeriod = 10; + readonly attribute nullable PeakPeriodStruct nextPeakPeriod = 11; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + /** This cluster provides an interface to specify preferences for how devices should consume energy. */ provisional cluster EnergyPreference = 155 { revision 1; diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index af684af705969f..a4c3115b0f5a72 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -7173,6 +7173,122 @@ class ChipClusters: }, }, } + _ENERGY_CALENDAR_CLUSTER_INFO = { + "clusterName": "EnergyCalendar", + "clusterId": 0x0000009A, + "commands": { + }, + "attributes": { + 0x00000000: { + "attributeName": "CalendarID", + "attributeId": 0x00000000, + "type": "int", + "reportable": True, + }, + 0x00000001: { + "attributeName": "Name", + "attributeId": 0x00000001, + "type": "str", + "reportable": True, + }, + 0x00000002: { + "attributeName": "ProviderID", + "attributeId": 0x00000002, + "type": "int", + "reportable": True, + }, + 0x00000003: { + "attributeName": "EventID", + "attributeId": 0x00000003, + "type": "int", + "reportable": True, + }, + 0x00000004: { + "attributeName": "StartDate", + "attributeId": 0x00000004, + "type": "int", + "reportable": True, + }, + 0x00000005: { + "attributeName": "CalendarPeriods", + "attributeId": 0x00000005, + "type": "", + "reportable": True, + }, + 0x00000006: { + "attributeName": "SpecialDays", + "attributeId": 0x00000006, + "type": "", + "reportable": True, + }, + 0x00000007: { + "attributeName": "CurrentDay", + "attributeId": 0x00000007, + "type": "", + "reportable": True, + }, + 0x00000008: { + "attributeName": "NextDay", + "attributeId": 0x00000008, + "type": "", + "reportable": True, + }, + 0x00000009: { + "attributeName": "CurrentTransition", + "attributeId": 0x00000009, + "type": "", + "reportable": True, + }, + 0x0000000A: { + "attributeName": "CurrentPeakPeriod", + "attributeId": 0x0000000A, + "type": "", + "reportable": True, + }, + 0x0000000B: { + "attributeName": "NextPeakPeriod", + "attributeId": 0x0000000B, + "type": "", + "reportable": True, + }, + 0x0000FFF8: { + "attributeName": "GeneratedCommandList", + "attributeId": 0x0000FFF8, + "type": "int", + "reportable": True, + }, + 0x0000FFF9: { + "attributeName": "AcceptedCommandList", + "attributeId": 0x0000FFF9, + "type": "int", + "reportable": True, + }, + 0x0000FFFA: { + "attributeName": "EventList", + "attributeId": 0x0000FFFA, + "type": "int", + "reportable": True, + }, + 0x0000FFFB: { + "attributeName": "AttributeList", + "attributeId": 0x0000FFFB, + "type": "int", + "reportable": True, + }, + 0x0000FFFC: { + "attributeName": "FeatureMap", + "attributeId": 0x0000FFFC, + "type": "int", + "reportable": True, + }, + 0x0000FFFD: { + "attributeName": "ClusterRevision", + "attributeId": 0x0000FFFD, + "type": "int", + "reportable": True, + }, + }, + } _ENERGY_PREFERENCE_CLUSTER_INFO = { "clusterName": "EnergyPreference", "clusterId": 0x0000009B, @@ -14230,6 +14346,7 @@ class ChipClusters: 0x00000097: _MESSAGES_CLUSTER_INFO, 0x00000098: _DEVICE_ENERGY_MANAGEMENT_CLUSTER_INFO, 0x00000099: _ENERGY_EVSE_CLUSTER_INFO, + 0x0000009A: _ENERGY_CALENDAR_CLUSTER_INFO, 0x0000009B: _ENERGY_PREFERENCE_CLUSTER_INFO, 0x0000009C: _POWER_TOPOLOGY_CLUSTER_INFO, 0x0000009D: _ENERGY_EVSE_MODE_CLUSTER_INFO, @@ -14355,6 +14472,7 @@ class ChipClusters: "Messages": _MESSAGES_CLUSTER_INFO, "DeviceEnergyManagement": _DEVICE_ENERGY_MANAGEMENT_CLUSTER_INFO, "EnergyEvse": _ENERGY_EVSE_CLUSTER_INFO, + "EnergyCalendar": _ENERGY_CALENDAR_CLUSTER_INFO, "EnergyPreference": _ENERGY_PREFERENCE_CLUSTER_INFO, "PowerTopology": _POWER_TOPOLOGY_CLUSTER_INFO, "EnergyEvseMode": _ENERGY_EVSE_MODE_CLUSTER_INFO, diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index efefaf9059dd7f..3917b93ab80f91 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -26569,6 +26569,463 @@ def descriptor(cls) -> ClusterObjectDescriptor: uid: 'bytes' = b"" +@dataclass +class EnergyCalendar(Cluster): + id: typing.ClassVar[int] = 0x0000009A + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="calendarID", Tag=0x00000000, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="name", Tag=0x00000001, Type=typing.Union[Nullable, str]), + ClusterObjectFieldDescriptor(Label="providerID", Tag=0x00000002, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="eventID", Tag=0x00000003, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="startDate", Tag=0x00000004, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="calendarPeriods", Tag=0x00000005, Type=typing.List[EnergyCalendar.Structs.CalendarPeriod]), + ClusterObjectFieldDescriptor(Label="specialDays", Tag=0x00000006, Type=typing.List[EnergyCalendar.Structs.DayStruct]), + ClusterObjectFieldDescriptor(Label="currentDay", Tag=0x00000007, Type=typing.Union[Nullable, EnergyCalendar.Structs.DayStruct]), + ClusterObjectFieldDescriptor(Label="nextDay", Tag=0x00000008, Type=typing.Union[Nullable, EnergyCalendar.Structs.DayStruct]), + ClusterObjectFieldDescriptor(Label="currentTransition", Tag=0x00000009, Type=typing.Union[Nullable, EnergyCalendar.Structs.TransitionStruct]), + ClusterObjectFieldDescriptor(Label="currentPeakPeriod", Tag=0x0000000A, Type=typing.Union[Nullable, EnergyCalendar.Structs.PeakPeriodStruct]), + ClusterObjectFieldDescriptor(Label="nextPeakPeriod", Tag=0x0000000B, Type=typing.Union[Nullable, EnergyCalendar.Structs.PeakPeriodStruct]), + ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="eventList", Tag=0x0000FFFA, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="attributeList", Tag=0x0000FFFB, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="featureMap", Tag=0x0000FFFC, Type=uint), + ClusterObjectFieldDescriptor(Label="clusterRevision", Tag=0x0000FFFD, Type=uint), + ]) + + calendarID: 'typing.Union[Nullable, uint]' = None + name: 'typing.Union[Nullable, str]' = None + providerID: 'typing.Union[Nullable, uint]' = None + eventID: 'typing.Union[Nullable, uint]' = None + startDate: 'typing.Union[Nullable, uint]' = None + calendarPeriods: 'typing.List[EnergyCalendar.Structs.CalendarPeriod]' = None + specialDays: 'typing.List[EnergyCalendar.Structs.DayStruct]' = None + currentDay: 'typing.Union[Nullable, EnergyCalendar.Structs.DayStruct]' = None + nextDay: 'typing.Union[Nullable, EnergyCalendar.Structs.DayStruct]' = None + currentTransition: 'typing.Union[Nullable, EnergyCalendar.Structs.TransitionStruct]' = None + currentPeakPeriod: 'typing.Union[Nullable, EnergyCalendar.Structs.PeakPeriodStruct]' = None + nextPeakPeriod: 'typing.Union[Nullable, EnergyCalendar.Structs.PeakPeriodStruct]' = None + generatedCommandList: 'typing.List[uint]' = None + acceptedCommandList: 'typing.List[uint]' = None + eventList: 'typing.List[uint]' = None + attributeList: 'typing.List[uint]' = None + featureMap: 'uint' = None + clusterRevision: 'uint' = None + + class Enums: + class PeakPeriodSeverityEnum(MatterIntEnum): + kUnused = 0x00 + kLow = 0x01 + kMedium = 0x02 + kHigh = 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 Bitmaps: + class AuxiliaryLoadBitmap(IntFlag): + kAuxiliarySwitch1 = 0x1 + kAuxiliarySwitch2 = 0x2 + kAuxiliarySwitch3 = 0x4 + kAuxiliarySwitch4 = 0x8 + kAuxiliarySwitch5 = 0x10 + kAuxiliarySwitch6 = 0x20 + kAuxiliarySwitch7 = 0x40 + kAuxiliarySwitch8 = 0x80 + + class Feature(IntFlag): + kPricingTier = 0x1 + kFriendlyCredit = 0x2 + kAuxiliaryLoad = 0x4 + kPeakPeriod = 0x8 + + class TransitionDayOfWeekBitmap(IntFlag): + kSunday = 0x1 + kMonday = 0x2 + kTuesday = 0x4 + kWednesday = 0x8 + kThursday = 0x10 + kFriday = 0x20 + kSaturday = 0x40 + + class Structs: + @dataclass + class TransitionStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="transitionTime", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="priceTier", Tag=1, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="friendlyCredit", Tag=2, Type=typing.Optional[bool]), + ClusterObjectFieldDescriptor(Label="auxiliaryLoad", Tag=3, Type=typing.Optional[uint]), + ]) + + transitionTime: 'uint' = 0 + priceTier: 'typing.Optional[uint]' = None + friendlyCredit: 'typing.Optional[bool]' = None + auxiliaryLoad: 'typing.Optional[uint]' = None + + @dataclass + class Date(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="year", Tag=0, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="month", Tag=1, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="day", Tag=2, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="dayOfWeek", Tag=3, Type=typing.Optional[uint]), + ]) + + year: 'typing.Optional[uint]' = None + month: 'typing.Optional[uint]' = None + day: 'typing.Optional[uint]' = None + dayOfWeek: 'typing.Optional[uint]' = None + + @dataclass + class DayStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="date", Tag=0, Type=typing.Optional[EnergyCalendar.Structs.Date]), + ClusterObjectFieldDescriptor(Label="daysOfWeek", Tag=1, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="transitions", Tag=2, Type=typing.List[EnergyCalendar.Structs.TransitionStruct]), + ClusterObjectFieldDescriptor(Label="calendarID", Tag=3, Type=typing.Optional[uint]), + ]) + + date: 'typing.Optional[EnergyCalendar.Structs.Date]' = None + daysOfWeek: 'typing.Optional[uint]' = None + transitions: 'typing.List[EnergyCalendar.Structs.TransitionStruct]' = field(default_factory=lambda: []) + calendarID: 'typing.Optional[uint]' = None + + @dataclass + class CalendarPeriod(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="startDate", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="days", Tag=1, Type=typing.List[EnergyCalendar.Structs.DayStruct]), + ]) + + startDate: 'uint' = 0 + days: 'typing.List[EnergyCalendar.Structs.DayStruct]' = field(default_factory=lambda: []) + + @dataclass + class PeakPeriodStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="severity", Tag=0, Type=EnergyCalendar.Enums.PeakPeriodSeverityEnum), + ClusterObjectFieldDescriptor(Label="peakPeriod", Tag=1, Type=uint), + ClusterObjectFieldDescriptor(Label="startTime", Tag=2, Type=uint), + ClusterObjectFieldDescriptor(Label="endTime", Tag=3, Type=uint), + ]) + + severity: 'EnergyCalendar.Enums.PeakPeriodSeverityEnum' = 0 + peakPeriod: 'uint' = 0 + startTime: 'uint' = 0 + endTime: 'uint' = 0 + + class Attributes: + @dataclass + class CalendarID(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000009A + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000000 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, uint]) + + value: 'typing.Union[Nullable, uint]' = NullValue + + @dataclass + class Name(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000009A + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000001 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, str]) + + value: 'typing.Union[Nullable, str]' = NullValue + + @dataclass + class ProviderID(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000009A + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000002 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, uint]) + + value: 'typing.Union[Nullable, uint]' = NullValue + + @dataclass + class EventID(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000009A + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000003 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, uint]) + + value: 'typing.Union[Nullable, uint]' = NullValue + + @dataclass + class StartDate(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000009A + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000004 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, uint]) + + value: 'typing.Union[Nullable, uint]' = NullValue + + @dataclass + class CalendarPeriods(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000009A + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000005 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[EnergyCalendar.Structs.CalendarPeriod]) + + value: 'typing.List[EnergyCalendar.Structs.CalendarPeriod]' = field(default_factory=lambda: []) + + @dataclass + class SpecialDays(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000009A + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000006 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[EnergyCalendar.Structs.DayStruct]) + + value: 'typing.List[EnergyCalendar.Structs.DayStruct]' = field(default_factory=lambda: []) + + @dataclass + class CurrentDay(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000009A + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000007 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, EnergyCalendar.Structs.DayStruct]) + + value: 'typing.Union[Nullable, EnergyCalendar.Structs.DayStruct]' = NullValue + + @dataclass + class NextDay(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000009A + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000008 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, EnergyCalendar.Structs.DayStruct]) + + value: 'typing.Union[Nullable, EnergyCalendar.Structs.DayStruct]' = NullValue + + @dataclass + class CurrentTransition(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000009A + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000009 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, EnergyCalendar.Structs.TransitionStruct]) + + value: 'typing.Union[Nullable, EnergyCalendar.Structs.TransitionStruct]' = NullValue + + @dataclass + class CurrentPeakPeriod(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000009A + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000000A + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, EnergyCalendar.Structs.PeakPeriodStruct]) + + value: 'typing.Union[Nullable, EnergyCalendar.Structs.PeakPeriodStruct]' = NullValue + + @dataclass + class NextPeakPeriod(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000009A + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000000B + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, EnergyCalendar.Structs.PeakPeriodStruct]) + + value: 'typing.Union[Nullable, EnergyCalendar.Structs.PeakPeriodStruct]' = NullValue + + @dataclass + class GeneratedCommandList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000009A + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFF8 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class AcceptedCommandList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000009A + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFF9 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class EventList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000009A + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFA + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class AttributeList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000009A + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFB + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class FeatureMap(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000009A + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFC + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + @dataclass + class ClusterRevision(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000009A + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFD + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + @dataclass class EnergyPreference(Cluster): id: typing.ClassVar[int] = 0x0000009B diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp index 4d9c6b9f545dd1..6a27487152b2f8 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp @@ -15253,6 +15253,1026 @@ Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value) } // namespace Attributes } // namespace EnergyEvse +namespace EnergyCalendar { +namespace Attributes { + +namespace CalendarID { + +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (Traits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = Traits::StorageToWorking(temp); + } + return status; +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_INT32U_ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_INT32U_ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_INT32U_ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_INT32U_ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty) +{ + if (value.IsNull()) + { + return SetNull(endpoint, markDirty); + } + + return Set(endpoint, value.Value(), markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace CalendarID + +namespace Name { + +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value) +{ + if (value.IsNull()) + { + ChipLogError(Zcl, "Null Nullable passed to EnergyCalendar::Name::Get"); + return Protocols::InteractionModel::Status::Failure; + } + + uint8_t zclString[12 + 1]; + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, zclString, sizeof(zclString)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + value.SetNull(); + return Protocols::InteractionModel::Status::Success; + } + auto & span = value.Value(); + + VerifyOrReturnError(span.size() == 12, Protocols::InteractionModel::Status::InvalidDataType); + memcpy(span.data(), &zclString[1], 12); + span.reduce_size(length); + return status; +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::CharSpan value, MarkAttributeDirty markDirty) +{ + + static_assert(12 < NumericAttributeTraits::kNullValue, "value.size() might be too big"); + VerifyOrReturnError(value.size() <= 12, Protocols::InteractionModel::Status::ConstraintError); + uint8_t zclString[12 + 1]; + auto length = static_cast(value.size()); + Encoding::Put8(zclString, length); + memcpy(&zclString[1], value.data(), value.size()); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::CharSpan value) +{ + + static_assert(12 < NumericAttributeTraits::kNullValue, "value.size() might be too big"); + VerifyOrReturnError(value.size() <= 12, Protocols::InteractionModel::Status::ConstraintError); + uint8_t zclString[12 + 1]; + auto length = static_cast(value.size()); + Encoding::Put8(zclString, length); + memcpy(&zclString[1], value.data(), value.size()); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty) +{ + uint8_t zclString[1] = { 0xFF }; + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) +{ + uint8_t zclString[1] = { 0xFF }; + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty) +{ + if (value.IsNull()) + { + return SetNull(endpoint, markDirty); + } + + return Set(endpoint, value.Value(), markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace Name + +namespace ProviderID { + +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (Traits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = Traits::StorageToWorking(temp); + } + return status; +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_INT32U_ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_INT32U_ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_INT32U_ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_INT32U_ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty) +{ + if (value.IsNull()) + { + return SetNull(endpoint, markDirty); + } + + return Set(endpoint, value.Value(), markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace ProviderID + +namespace EventID { + +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (Traits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = Traits::StorageToWorking(temp); + } + return status; +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_INT32U_ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_INT32U_ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_INT32U_ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_INT32U_ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty) +{ + if (value.IsNull()) + { + return SetNull(endpoint, markDirty); + } + + return Set(endpoint, value.Value(), markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace EventID + +namespace StartDate { + +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (Traits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = Traits::StorageToWorking(temp); + } + return status; +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_EPOCH_S_ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_EPOCH_S_ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_EPOCH_S_ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_EPOCH_S_ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty) +{ + if (value.IsNull()) + { + return SetNull(endpoint, markDirty); + } + + return Set(endpoint, value.Value(), markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace StartDate + +#error Attribute "CurrentDay" in cluster "Energy Calendar" is struct-typed and must be added to the attributeAccessInterfaceAttributes object in src/app/zap-templates/zcl/zcl.json and src/app/zap-templates/zcl/zcl-with-test-extensions.json +namespace CurrentDay { + +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, + DataModel::Nullable & value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (Traits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = Traits::StorageToWorking(temp); + } + return status; +} + +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, chip::app::Clusters::EnergyCalendar::Structs::DayStruct::Type value, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + chip::app::Clusters::EnergyCalendar::Structs::DayStruct::Type value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, + const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty) +{ + if (value.IsNull()) + { + return SetNull(endpoint, markDirty); + } + + return Set(endpoint, value.Value(), markDirty); +} + +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, + const chip::app::DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace CurrentDay + +#error Attribute "NextDay" in cluster "Energy Calendar" is struct-typed and must be added to the attributeAccessInterfaceAttributes object in src/app/zap-templates/zcl/zcl.json and src/app/zap-templates/zcl/zcl-with-test-extensions.json +namespace NextDay { + +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, + DataModel::Nullable & value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (Traits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = Traits::StorageToWorking(temp); + } + return status; +} + +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, chip::app::Clusters::EnergyCalendar::Structs::DayStruct::Type value, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + chip::app::Clusters::EnergyCalendar::Structs::DayStruct::Type value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, + const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty) +{ + if (value.IsNull()) + { + return SetNull(endpoint, markDirty); + } + + return Set(endpoint, value.Value(), markDirty); +} + +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, + const chip::app::DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace NextDay + +#error Attribute "CurrentTransition" in cluster "Energy Calendar" is struct-typed and must be added to the attributeAccessInterfaceAttributes object in src/app/zap-templates/zcl/zcl.json and src/app/zap-templates/zcl/zcl-with-test-extensions.json +namespace CurrentTransition { + +Protocols::InteractionModel::Status +Get(chip::EndpointId endpoint, DataModel::Nullable & value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (Traits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = Traits::StorageToWorking(temp); + } + return status; +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + chip::app::Clusters::EnergyCalendar::Structs::TransitionStruct::Type value, + MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + chip::app::Clusters::EnergyCalendar::Structs::TransitionStruct::Type value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, + const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty) +{ + if (value.IsNull()) + { + return SetNull(endpoint, markDirty); + } + + return Set(endpoint, value.Value(), markDirty); +} + +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, + const chip::app::DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace CurrentTransition + +#error Attribute "CurrentPeakPeriod" in cluster "Energy Calendar" is struct-typed and must be added to the attributeAccessInterfaceAttributes object in src/app/zap-templates/zcl/zcl.json and src/app/zap-templates/zcl/zcl-with-test-extensions.json +namespace CurrentPeakPeriod { + +Protocols::InteractionModel::Status +Get(chip::EndpointId endpoint, DataModel::Nullable & value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (Traits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = Traits::StorageToWorking(temp); + } + return status; +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + chip::app::Clusters::EnergyCalendar::Structs::PeakPeriodStruct::Type value, + MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + chip::app::Clusters::EnergyCalendar::Structs::PeakPeriodStruct::Type value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, + const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty) +{ + if (value.IsNull()) + { + return SetNull(endpoint, markDirty); + } + + return Set(endpoint, value.Value(), markDirty); +} + +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, + const chip::app::DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace CurrentPeakPeriod + +#error Attribute "NextPeakPeriod" in cluster "Energy Calendar" is struct-typed and must be added to the attributeAccessInterfaceAttributes object in src/app/zap-templates/zcl/zcl.json and src/app/zap-templates/zcl/zcl-with-test-extensions.json +namespace NextPeakPeriod { + +Protocols::InteractionModel::Status +Get(chip::EndpointId endpoint, DataModel::Nullable & value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (Traits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = Traits::StorageToWorking(temp); + } + return status; +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + chip::app::Clusters::EnergyCalendar::Structs::PeakPeriodStruct::Type value, + MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + chip::app::Clusters::EnergyCalendar::Structs::PeakPeriodStruct::Type value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, + const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty) +{ + if (value.IsNull()) + { + return SetNull(endpoint, markDirty); + } + + return Set(endpoint, value.Value(), markDirty); +} + +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, + const chip::app::DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace NextPeakPeriod + +namespace FeatureMap { + +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint32_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + *value = Traits::StorageToWorking(temp); + return status; +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); +} + +} // namespace FeatureMap + +namespace ClusterRevision { + +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + *value = Traits::StorageToWorking(temp); + return status; +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); +} + +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace EnergyCalendar + namespace EnergyPreference { namespace Attributes { diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h index c4b83e7920c064..f9b2aef044b179 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h @@ -2463,6 +2463,178 @@ Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value, Mar } // namespace Attributes } // namespace EnergyEvse +namespace EnergyCalendar { +namespace Attributes { + +namespace CalendarID { +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value); // int32u +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint); +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty); +} // namespace CalendarID + +namespace Name { +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, + DataModel::Nullable & value); // char_string +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::CharSpan value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::CharSpan value, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint); +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty); +} // namespace Name + +namespace ProviderID { +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value); // int32u +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint); +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty); +} // namespace ProviderID + +namespace EventID { +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value); // int32u +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint); +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty); +} // namespace EventID + +namespace StartDate { +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value); // epoch_s +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint); +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty); +} // namespace StartDate + +namespace CurrentDay { +Protocols::InteractionModel::Status +Get(chip::EndpointId endpoint, + DataModel::Nullable & value); // DayStruct +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + chip::app::Clusters::EnergyCalendar::Structs::DayStruct::Type value); +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, chip::app::Clusters::EnergyCalendar::Structs::DayStruct::Type value, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint); +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, + const chip::app::DataModel::Nullable & value); +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, + const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty); +} // namespace CurrentDay + +namespace NextDay { +Protocols::InteractionModel::Status +Get(chip::EndpointId endpoint, + DataModel::Nullable & value); // DayStruct +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + chip::app::Clusters::EnergyCalendar::Structs::DayStruct::Type value); +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, chip::app::Clusters::EnergyCalendar::Structs::DayStruct::Type value, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint); +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, + const chip::app::DataModel::Nullable & value); +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, + const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty); +} // namespace NextDay + +namespace CurrentTransition { +Protocols::InteractionModel::Status +Get(chip::EndpointId endpoint, + DataModel::Nullable & value); // TransitionStruct +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + chip::app::Clusters::EnergyCalendar::Structs::TransitionStruct::Type value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + chip::app::Clusters::EnergyCalendar::Structs::TransitionStruct::Type value, + MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint); +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, + const chip::app::DataModel::Nullable & value); +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, + const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty); +} // namespace CurrentTransition + +namespace CurrentPeakPeriod { +Protocols::InteractionModel::Status +Get(chip::EndpointId endpoint, + DataModel::Nullable & value); // PeakPeriodStruct +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + chip::app::Clusters::EnergyCalendar::Structs::PeakPeriodStruct::Type value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + chip::app::Clusters::EnergyCalendar::Structs::PeakPeriodStruct::Type value, + MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint); +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, + const chip::app::DataModel::Nullable & value); +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, + const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty); +} // namespace CurrentPeakPeriod + +namespace NextPeakPeriod { +Protocols::InteractionModel::Status +Get(chip::EndpointId endpoint, + DataModel::Nullable & value); // PeakPeriodStruct +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + chip::app::Clusters::EnergyCalendar::Structs::PeakPeriodStruct::Type value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + chip::app::Clusters::EnergyCalendar::Structs::PeakPeriodStruct::Type value, + MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint); +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, + const chip::app::DataModel::Nullable & value); +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, + const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty); +} // namespace NextPeakPeriod + +namespace FeatureMap { +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty); +} // namespace FeatureMap + +namespace ClusterRevision { +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * value); // int16u +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty); +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace EnergyCalendar + namespace EnergyPreference { namespace Attributes { diff --git a/zzz_generated/app-common/app-common/zap-generated/callback.h b/zzz_generated/app-common/app-common/zap-generated/callback.h index 7e86e92268f703..834acb609020fc 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callback.h +++ b/zzz_generated/app-common/app-common/zap-generated/callback.h @@ -383,6 +383,11 @@ void emberAfDeviceEnergyManagementClusterInitCallback(chip::EndpointId endpoint) */ void emberAfEnergyEvseClusterInitCallback(chip::EndpointId endpoint); +/** + * @param endpoint Endpoint that is being initialized + */ +void emberAfEnergyCalendarClusterInitCallback(chip::EndpointId endpoint); + /** * @param endpoint Endpoint that is being initialized */ @@ -3345,6 +3350,45 @@ MatterEnergyEvseClusterServerPreAttributeChangedCallback(const chip::app::Concre */ void emberAfEnergyEvseClusterServerTickCallback(chip::EndpointId endpoint); +// +// Energy Calendar Cluster +// + +/** + * @param endpoint Endpoint that is being initialized + */ +void emberAfEnergyCalendarClusterServerInitCallback(chip::EndpointId endpoint); + +/** + * @param endpoint Endpoint that is being shutdown + */ +void MatterEnergyCalendarClusterServerShutdownCallback(chip::EndpointId endpoint); + +/** + * @param endpoint Endpoint that is being initialized + */ +void emberAfEnergyCalendarClusterClientInitCallback(chip::EndpointId endpoint); + +/** + * @param attributePath Concrete attribute path that changed + */ +void MatterEnergyCalendarClusterServerAttributeChangedCallback(const chip::app::ConcreteAttributePath & attributePath); + +/** + * @param attributePath Concrete attribute path to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +chip::Protocols::InteractionModel::Status +MatterEnergyCalendarClusterServerPreAttributeChangedCallback(const chip::app::ConcreteAttributePath & attributePath, + EmberAfAttributeType attributeType, uint16_t size, uint8_t * value); + +/** + * @param endpoint Endpoint that is being served + */ +void emberAfEnergyCalendarClusterServerTickCallback(chip::EndpointId endpoint); + // // Energy Preference Cluster // diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h index 2bde6623e6af84..1f4a12276d7262 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h @@ -2213,6 +2213,21 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(EnergyEvse::SupplyState } } +static auto __attribute__((unused)) EnsureKnownEnumValue(EnergyCalendar::PeakPeriodSeverityEnum val) +{ + using EnumType = EnergyCalendar::PeakPeriodSeverityEnum; + switch (val) + { + case EnumType::kUnused: + case EnumType::kLow: + case EnumType::kMedium: + case EnumType::kHigh: + return val; + default: + return EnumType::kUnknownEnumValue; + } +} + static auto __attribute__((unused)) EnsureKnownEnumValue(EnergyPreference::EnergyPriorityEnum val) { using EnumType = EnergyPreference::EnergyPriorityEnum; 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 c55fab3f9ae9fa..42e367ecc8269f 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 @@ -3145,6 +3145,57 @@ enum class TargetDayOfWeekBitmap : uint8_t }; } // namespace EnergyEvse +namespace EnergyCalendar { + +// Enum for PeakPeriodSeverityEnum +enum class PeakPeriodSeverityEnum : uint8_t +{ + kUnused = 0x00, + kLow = 0x01, + kMedium = 0x02, + kHigh = 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, +}; + +// Bitmap for AuxiliaryLoadBitmap +enum class AuxiliaryLoadBitmap : uint8_t +{ + kAuxiliarySwitch1 = 0x1, + kAuxiliarySwitch2 = 0x2, + kAuxiliarySwitch3 = 0x4, + kAuxiliarySwitch4 = 0x8, + kAuxiliarySwitch5 = 0x10, + kAuxiliarySwitch6 = 0x20, + kAuxiliarySwitch7 = 0x40, + kAuxiliarySwitch8 = 0x80, +}; + +// Bitmap for Feature +enum class Feature : uint32_t +{ + kPricingTier = 0x1, + kFriendlyCredit = 0x2, + kAuxiliaryLoad = 0x4, + kPeakPeriod = 0x8, +}; + +// Bitmap for TransitionDayOfWeekBitmap +enum class TransitionDayOfWeekBitmap : uint8_t +{ + kSunday = 0x1, + kMonday = 0x2, + kTuesday = 0x4, + kWednesday = 0x8, + kThursday = 0x10, + kFriday = 0x20, + kSaturday = 0x40, +}; +} // namespace EnergyCalendar + namespace EnergyPreference { // Enum for EnergyPriorityEnum diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp index 00e32012cb3be6..8fa7458e60df1a 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp @@ -17871,6 +17871,307 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } // namespace Events } // namespace EnergyEvse +namespace EnergyCalendar { +namespace Structs { + +namespace TransitionStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kTransitionTime), transitionTime); + encoder.Encode(to_underlying(Fields::kPriceTier), priceTier); + encoder.Encode(to_underlying(Fields::kFriendlyCredit), friendlyCredit); + encoder.Encode(to_underlying(Fields::kAuxiliaryLoad), auxiliaryLoad); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kTransitionTime)) + { + err = DataModel::Decode(reader, transitionTime); + } + else if (__context_tag == to_underlying(Fields::kPriceTier)) + { + err = DataModel::Decode(reader, priceTier); + } + else if (__context_tag == to_underlying(Fields::kFriendlyCredit)) + { + err = DataModel::Decode(reader, friendlyCredit); + } + else if (__context_tag == to_underlying(Fields::kAuxiliaryLoad)) + { + err = DataModel::Decode(reader, auxiliaryLoad); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace TransitionStruct + +namespace Date { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kYear), year); + encoder.Encode(to_underlying(Fields::kMonth), month); + encoder.Encode(to_underlying(Fields::kDay), day); + encoder.Encode(to_underlying(Fields::kDayOfWeek), dayOfWeek); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kYear)) + { + err = DataModel::Decode(reader, year); + } + else if (__context_tag == to_underlying(Fields::kMonth)) + { + err = DataModel::Decode(reader, month); + } + else if (__context_tag == to_underlying(Fields::kDay)) + { + err = DataModel::Decode(reader, day); + } + else if (__context_tag == to_underlying(Fields::kDayOfWeek)) + { + err = DataModel::Decode(reader, dayOfWeek); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace Date + +namespace DayStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kDate), date); + encoder.Encode(to_underlying(Fields::kDaysOfWeek), daysOfWeek); + encoder.Encode(to_underlying(Fields::kTransitions), transitions); + encoder.Encode(to_underlying(Fields::kCalendarID), calendarID); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kDate)) + { + err = DataModel::Decode(reader, date); + } + else if (__context_tag == to_underlying(Fields::kDaysOfWeek)) + { + err = DataModel::Decode(reader, daysOfWeek); + } + else if (__context_tag == to_underlying(Fields::kTransitions)) + { + err = DataModel::Decode(reader, transitions); + } + else if (__context_tag == to_underlying(Fields::kCalendarID)) + { + err = DataModel::Decode(reader, calendarID); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace DayStruct + +namespace CalendarPeriod { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kStartDate), startDate); + encoder.Encode(to_underlying(Fields::kDays), days); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStartDate)) + { + err = DataModel::Decode(reader, startDate); + } + else if (__context_tag == to_underlying(Fields::kDays)) + { + err = DataModel::Decode(reader, days); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace CalendarPeriod + +namespace PeakPeriodStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kSeverity), severity); + encoder.Encode(to_underlying(Fields::kPeakPeriod), peakPeriod); + encoder.Encode(to_underlying(Fields::kStartTime), startTime); + encoder.Encode(to_underlying(Fields::kEndTime), endTime); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kSeverity)) + { + err = DataModel::Decode(reader, severity); + } + else if (__context_tag == to_underlying(Fields::kPeakPeriod)) + { + err = DataModel::Decode(reader, peakPeriod); + } + else if (__context_tag == to_underlying(Fields::kStartTime)) + { + err = DataModel::Decode(reader, startTime); + } + else if (__context_tag == to_underlying(Fields::kEndTime)) + { + err = DataModel::Decode(reader, endTime); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace PeakPeriodStruct +} // namespace Structs + +namespace Commands {} // namespace Commands + +namespace Attributes { +CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path) +{ + switch (path.mAttributeId) + { + case Attributes::CalendarID::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, calendarID); + case Attributes::Name::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, name); + case Attributes::ProviderID::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, providerID); + case Attributes::EventID::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, eventID); + case Attributes::StartDate::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, startDate); + case Attributes::CalendarPeriods::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, calendarPeriods); + case Attributes::SpecialDays::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, specialDays); + case Attributes::CurrentDay::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, currentDay); + case Attributes::NextDay::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, nextDay); + case Attributes::CurrentTransition::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, currentTransition); + case Attributes::CurrentPeakPeriod::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, currentPeakPeriod); + case Attributes::NextPeakPeriod::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, nextPeakPeriod); + case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, generatedCommandList); + case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, acceptedCommandList); + case Attributes::EventList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, eventList); + case Attributes::AttributeList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, attributeList); + case Attributes::FeatureMap::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, featureMap); + case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, clusterRevision); + default: + return CHIP_NO_ERROR; + } +} +} // namespace Attributes + +namespace Events {} // namespace Events + +} // namespace EnergyCalendar namespace EnergyPreference { namespace Structs { 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 f8847a3f1a0b51..a5a3838f602bb6 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 @@ -24321,6 +24321,383 @@ struct DecodableType } // namespace Rfid } // namespace Events } // namespace EnergyEvse +namespace EnergyCalendar { +namespace Structs { +namespace TransitionStruct { +enum class Fields : uint8_t +{ + kTransitionTime = 0, + kPriceTier = 1, + kFriendlyCredit = 2, + kAuxiliaryLoad = 3, +}; + +struct Type +{ +public: + uint16_t transitionTime = static_cast(0); + Optional priceTier; + Optional friendlyCredit; + Optional> auxiliaryLoad; + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace TransitionStruct +namespace Date { +enum class Fields : uint8_t +{ + kYear = 0, + kMonth = 1, + kDay = 2, + kDayOfWeek = 3, +}; + +struct Type +{ +public: + Optional year; + Optional month; + Optional day; + Optional dayOfWeek; + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace Date +namespace DayStruct { +enum class Fields : uint8_t +{ + kDate = 0, + kDaysOfWeek = 1, + kTransitions = 2, + kCalendarID = 3, +}; + +struct Type +{ +public: + Optional date; + Optional> daysOfWeek; + DataModel::List transitions; + Optional calendarID; + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +struct DecodableType +{ +public: + Optional date; + Optional> daysOfWeek; + DataModel::DecodableList transitions; + Optional calendarID; + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; +}; + +} // namespace DayStruct +namespace CalendarPeriod { +enum class Fields : uint8_t +{ + kStartDate = 0, + kDays = 1, +}; + +struct Type +{ +public: + uint32_t startDate = static_cast(0); + DataModel::List days; + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +struct DecodableType +{ +public: + uint32_t startDate = static_cast(0); + DataModel::DecodableList days; + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; +}; + +} // namespace CalendarPeriod +namespace PeakPeriodStruct { +enum class Fields : uint8_t +{ + kSeverity = 0, + kPeakPeriod = 1, + kStartTime = 2, + kEndTime = 3, +}; + +struct Type +{ +public: + PeakPeriodSeverityEnum severity = static_cast(0); + uint16_t peakPeriod = static_cast(0); + uint32_t startTime = static_cast(0); + uint32_t endTime = static_cast(0); + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace PeakPeriodStruct +} // namespace Structs + +namespace Attributes { + +namespace CalendarID { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::EnergyCalendar::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::CalendarID::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace CalendarID +namespace Name { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::EnergyCalendar::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::Name::Id; } + static constexpr bool MustUseTimedWrite() { return false; } + static constexpr size_t MaxLength() { return 12; } +}; +} // namespace Name +namespace ProviderID { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::EnergyCalendar::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::ProviderID::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace ProviderID +namespace EventID { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::EnergyCalendar::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::EventID::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace EventID +namespace StartDate { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::EnergyCalendar::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::StartDate::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace StartDate +namespace CalendarPeriods { +struct TypeInfo +{ + using Type = chip::app::DataModel::List; + using DecodableType = + chip::app::DataModel::DecodableList; + using DecodableArgType = + const chip::app::DataModel::DecodableList &; + + static constexpr ClusterId GetClusterId() { return Clusters::EnergyCalendar::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::CalendarPeriods::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace CalendarPeriods +namespace SpecialDays { +struct TypeInfo +{ + using Type = chip::app::DataModel::List; + using DecodableType = + chip::app::DataModel::DecodableList; + using DecodableArgType = + const chip::app::DataModel::DecodableList &; + + static constexpr ClusterId GetClusterId() { return Clusters::EnergyCalendar::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::SpecialDays::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace SpecialDays +namespace CurrentDay { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = + const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::EnergyCalendar::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::CurrentDay::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace CurrentDay +namespace NextDay { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = + const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::EnergyCalendar::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::NextDay::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace NextDay +namespace CurrentTransition { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = + chip::app::DataModel::Nullable; + using DecodableArgType = + const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::EnergyCalendar::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::CurrentTransition::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace CurrentTransition +namespace CurrentPeakPeriod { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = + chip::app::DataModel::Nullable; + using DecodableArgType = + const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::EnergyCalendar::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::CurrentPeakPeriod::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace CurrentPeakPeriod +namespace NextPeakPeriod { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = + chip::app::DataModel::Nullable; + using DecodableArgType = + const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::EnergyCalendar::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::NextPeakPeriod::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace NextPeakPeriod +namespace GeneratedCommandList { +struct TypeInfo : public Clusters::Globals::Attributes::GeneratedCommandList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::EnergyCalendar::Id; } +}; +} // namespace GeneratedCommandList +namespace AcceptedCommandList { +struct TypeInfo : public Clusters::Globals::Attributes::AcceptedCommandList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::EnergyCalendar::Id; } +}; +} // namespace AcceptedCommandList +namespace EventList { +struct TypeInfo : public Clusters::Globals::Attributes::EventList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::EnergyCalendar::Id; } +}; +} // namespace EventList +namespace AttributeList { +struct TypeInfo : public Clusters::Globals::Attributes::AttributeList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::EnergyCalendar::Id; } +}; +} // namespace AttributeList +namespace FeatureMap { +struct TypeInfo : public Clusters::Globals::Attributes::FeatureMap::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::EnergyCalendar::Id; } +}; +} // namespace FeatureMap +namespace ClusterRevision { +struct TypeInfo : public Clusters::Globals::Attributes::ClusterRevision::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::EnergyCalendar::Id; } +}; +} // namespace ClusterRevision + +struct TypeInfo +{ + struct DecodableType + { + static constexpr ClusterId GetClusterId() { return Clusters::EnergyCalendar::Id; } + + CHIP_ERROR Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path); + + Attributes::CalendarID::TypeInfo::DecodableType calendarID; + Attributes::Name::TypeInfo::DecodableType name; + Attributes::ProviderID::TypeInfo::DecodableType providerID; + Attributes::EventID::TypeInfo::DecodableType eventID; + Attributes::StartDate::TypeInfo::DecodableType startDate; + Attributes::CalendarPeriods::TypeInfo::DecodableType calendarPeriods; + Attributes::SpecialDays::TypeInfo::DecodableType specialDays; + Attributes::CurrentDay::TypeInfo::DecodableType currentDay; + Attributes::NextDay::TypeInfo::DecodableType nextDay; + Attributes::CurrentTransition::TypeInfo::DecodableType currentTransition; + Attributes::CurrentPeakPeriod::TypeInfo::DecodableType currentPeakPeriod; + Attributes::NextPeakPeriod::TypeInfo::DecodableType nextPeakPeriod; + Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; + Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; + Attributes::EventList::TypeInfo::DecodableType eventList; + Attributes::AttributeList::TypeInfo::DecodableType attributeList; + Attributes::FeatureMap::TypeInfo::DecodableType featureMap = static_cast(0); + Attributes::ClusterRevision::TypeInfo::DecodableType clusterRevision = static_cast(0); + }; +}; +} // namespace Attributes +} // namespace EnergyCalendar namespace EnergyPreference { namespace Structs { namespace BalanceStruct { diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h index 20e4ea7c9fd82a..fd8399bb7eeea8 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h @@ -4067,6 +4067,84 @@ static constexpr AttributeId Id = Globals::Attributes::ClusterRevision::Id; } // namespace Attributes } // namespace EnergyEvse +namespace EnergyCalendar { +namespace Attributes { + +namespace CalendarID { +static constexpr AttributeId Id = 0x00000000; +} // namespace CalendarID + +namespace Name { +static constexpr AttributeId Id = 0x00000001; +} // namespace Name + +namespace ProviderID { +static constexpr AttributeId Id = 0x00000002; +} // namespace ProviderID + +namespace EventID { +static constexpr AttributeId Id = 0x00000003; +} // namespace EventID + +namespace StartDate { +static constexpr AttributeId Id = 0x00000004; +} // namespace StartDate + +namespace CalendarPeriods { +static constexpr AttributeId Id = 0x00000005; +} // namespace CalendarPeriods + +namespace SpecialDays { +static constexpr AttributeId Id = 0x00000006; +} // namespace SpecialDays + +namespace CurrentDay { +static constexpr AttributeId Id = 0x00000007; +} // namespace CurrentDay + +namespace NextDay { +static constexpr AttributeId Id = 0x00000008; +} // namespace NextDay + +namespace CurrentTransition { +static constexpr AttributeId Id = 0x00000009; +} // namespace CurrentTransition + +namespace CurrentPeakPeriod { +static constexpr AttributeId Id = 0x0000000A; +} // namespace CurrentPeakPeriod + +namespace NextPeakPeriod { +static constexpr AttributeId Id = 0x0000000B; +} // namespace NextPeakPeriod + +namespace GeneratedCommandList { +static constexpr AttributeId Id = Globals::Attributes::GeneratedCommandList::Id; +} // namespace GeneratedCommandList + +namespace AcceptedCommandList { +static constexpr AttributeId Id = Globals::Attributes::AcceptedCommandList::Id; +} // namespace AcceptedCommandList + +namespace EventList { +static constexpr AttributeId Id = Globals::Attributes::EventList::Id; +} // namespace EventList + +namespace AttributeList { +static constexpr AttributeId Id = Globals::Attributes::AttributeList::Id; +} // namespace AttributeList + +namespace FeatureMap { +static constexpr AttributeId Id = Globals::Attributes::FeatureMap::Id; +} // namespace FeatureMap + +namespace ClusterRevision { +static constexpr AttributeId Id = Globals::Attributes::ClusterRevision::Id; +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace EnergyCalendar + namespace EnergyPreference { namespace Attributes { diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h b/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h index 26dd82c18e704e..3e541eee8ad344 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h @@ -235,6 +235,9 @@ static constexpr ClusterId Id = 0x00000098; namespace EnergyEvse { static constexpr ClusterId Id = 0x00000099; } // namespace EnergyEvse +namespace EnergyCalendar { +static constexpr ClusterId Id = 0x0000009A; +} // namespace EnergyCalendar namespace EnergyPreference { static constexpr ClusterId Id = 0x0000009B; } // namespace EnergyPreference diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 2333130d16c13a..9048d2d7a66438 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -105,6 +105,7 @@ | Messages | 0x0097 | | DeviceEnergyManagement | 0x0098 | | EnergyEvse | 0x0099 | +| EnergyCalendar | 0x009A | | EnergyPreference | 0x009B | | PowerTopology | 0x009C | | EnergyEvseMode | 0x009D | @@ -7775,6 +7776,34 @@ class EnergyEvseClearTargets : public ClusterCommand chip::app::Clusters::EnergyEvse::Commands::ClearTargets::Type mRequest; }; +/*----------------------------------------------------------------------------*\ +| Cluster EnergyCalendar | 0x009A | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * CalendarID | 0x0000 | +| * Name | 0x0001 | +| * ProviderID | 0x0002 | +| * EventID | 0x0003 | +| * StartDate | 0x0004 | +| * CalendarPeriods | 0x0005 | +| * SpecialDays | 0x0006 | +| * CurrentDay | 0x0007 | +| * NextDay | 0x0008 | +| * CurrentTransition | 0x0009 | +| * CurrentPeakPeriod | 0x000A | +| * NextPeakPeriod | 0x000B | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * EventList | 0xFFFA | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ + /*----------------------------------------------------------------------------*\ | Cluster EnergyPreference | 0x009B | |------------------------------------------------------------------------------| @@ -21281,6 +21310,112 @@ void registerClusterEnergyEvse(Commands & commands, CredentialIssuerCommands * c commands.RegisterCluster(clusterName, clusterCommands); } +void registerClusterEnergyCalendar(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) +{ + using namespace chip::app::Clusters::EnergyCalendar; + + const char * clusterName = "EnergyCalendar"; + + commands_list clusterCommands = { + // + // Commands + // + make_unique(Id, credsIssuerConfig), // + // + // Attributes + // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "calendar-id", Attributes::CalendarID::Id, credsIssuerConfig), // + make_unique(Id, "name", Attributes::Name::Id, credsIssuerConfig), // + make_unique(Id, "provider-id", Attributes::ProviderID::Id, credsIssuerConfig), // + make_unique(Id, "event-id", Attributes::EventID::Id, credsIssuerConfig), // + make_unique(Id, "start-date", Attributes::StartDate::Id, credsIssuerConfig), // + make_unique(Id, "calendar-periods", Attributes::CalendarPeriods::Id, credsIssuerConfig), // + make_unique(Id, "special-days", Attributes::SpecialDays::Id, credsIssuerConfig), // + make_unique(Id, "current-day", Attributes::CurrentDay::Id, credsIssuerConfig), // + make_unique(Id, "next-day", Attributes::NextDay::Id, credsIssuerConfig), // + make_unique(Id, "current-transition", Attributes::CurrentTransition::Id, credsIssuerConfig), // + make_unique(Id, "current-peak-period", Attributes::CurrentPeakPeriod::Id, credsIssuerConfig), // + make_unique(Id, "next-peak-period", Attributes::NextPeakPeriod::Id, credsIssuerConfig), // + make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // + make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // + make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // + make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // + make_unique>(Id, credsIssuerConfig), // + make_unique>>( + Id, "calendar-id", 0, UINT32_MAX, Attributes::CalendarID::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "name", Attributes::Name::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "provider-id", 0, UINT32_MAX, Attributes::ProviderID::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "event-id", 0, UINT32_MAX, Attributes::EventID::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "start-date", 0, UINT32_MAX, Attributes::StartDate::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "calendar-periods", Attributes::CalendarPeriods::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "special-days", Attributes::SpecialDays::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique< + WriteAttributeAsComplex>>( + Id, "current-day", Attributes::CurrentDay::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique< + WriteAttributeAsComplex>>( + Id, "next-day", Attributes::NextDay::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "current-transition", Attributes::CurrentTransition::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "current-peak-period", Attributes::CurrentPeakPeriod::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "next-peak-period", Attributes::NextPeakPeriod::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "generated-command-list", Attributes::GeneratedCommandList::Id, WriteCommandType::kForceWrite, + credsIssuerConfig), // + make_unique>>( + Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "event-list", Attributes::EventList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "attribute-list", Attributes::AttributeList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "feature-map", 0, UINT32_MAX, Attributes::FeatureMap::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "cluster-revision", 0, UINT16_MAX, Attributes::ClusterRevision::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "calendar-id", Attributes::CalendarID::Id, credsIssuerConfig), // + make_unique(Id, "name", Attributes::Name::Id, credsIssuerConfig), // + make_unique(Id, "provider-id", Attributes::ProviderID::Id, credsIssuerConfig), // + make_unique(Id, "event-id", Attributes::EventID::Id, credsIssuerConfig), // + make_unique(Id, "start-date", Attributes::StartDate::Id, credsIssuerConfig), // + make_unique(Id, "calendar-periods", Attributes::CalendarPeriods::Id, credsIssuerConfig), // + make_unique(Id, "special-days", Attributes::SpecialDays::Id, credsIssuerConfig), // + make_unique(Id, "current-day", Attributes::CurrentDay::Id, credsIssuerConfig), // + make_unique(Id, "next-day", Attributes::NextDay::Id, credsIssuerConfig), // + make_unique(Id, "current-transition", Attributes::CurrentTransition::Id, credsIssuerConfig), // + make_unique(Id, "current-peak-period", Attributes::CurrentPeakPeriod::Id, credsIssuerConfig), // + make_unique(Id, "next-peak-period", Attributes::NextPeakPeriod::Id, credsIssuerConfig), // + make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // + make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // + make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // + make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // + // + // Events + // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + }; + + commands.RegisterCluster(clusterName, clusterCommands); +} void registerClusterEnergyPreference(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { using namespace chip::app::Clusters::EnergyPreference; @@ -26981,6 +27116,7 @@ void registerClusters(Commands & commands, CredentialIssuerCommands * credsIssue registerClusterMessages(commands, credsIssuerConfig); registerClusterDeviceEnergyManagement(commands, credsIssuerConfig); registerClusterEnergyEvse(commands, credsIssuerConfig); + registerClusterEnergyCalendar(commands, credsIssuerConfig); registerClusterEnergyPreference(commands, credsIssuerConfig); registerClusterPowerTopology(commands, credsIssuerConfig); registerClusterEnergyEvseMode(commands, credsIssuerConfig); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index 9a1062c23b40a0..3cd2a1edf70564 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -3977,6 +3977,228 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::EnergyEvse::Structs::C ComplexArgumentParser::Finalize(request.chargingTargets); } +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::EnergyCalendar::Structs::TransitionStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("TransitionStruct.transitionTime", "transitionTime", + value.isMember("transitionTime"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "transitionTime"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.transitionTime, value["transitionTime"])); + valueCopy.removeMember("transitionTime"); + + if (value.isMember("priceTier")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "priceTier"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.priceTier, value["priceTier"])); + } + valueCopy.removeMember("priceTier"); + + if (value.isMember("friendlyCredit")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "friendlyCredit"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.friendlyCredit, value["friendlyCredit"])); + } + valueCopy.removeMember("friendlyCredit"); + + if (value.isMember("auxiliaryLoad")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "auxiliaryLoad"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.auxiliaryLoad, value["auxiliaryLoad"])); + } + valueCopy.removeMember("auxiliaryLoad"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::EnergyCalendar::Structs::TransitionStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.transitionTime); + ComplexArgumentParser::Finalize(request.priceTier); + ComplexArgumentParser::Finalize(request.friendlyCredit); + ComplexArgumentParser::Finalize(request.auxiliaryLoad); +} + +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::EnergyCalendar::Structs::Date::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + char labelWithMember[kMaxLabelLength]; + if (value.isMember("year")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "year"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.year, value["year"])); + } + valueCopy.removeMember("year"); + + if (value.isMember("month")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "month"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.month, value["month"])); + } + valueCopy.removeMember("month"); + + if (value.isMember("day")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "day"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.day, value["day"])); + } + valueCopy.removeMember("day"); + + if (value.isMember("dayOfWeek")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "dayOfWeek"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.dayOfWeek, value["dayOfWeek"])); + } + valueCopy.removeMember("dayOfWeek"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::EnergyCalendar::Structs::Date::Type & request) +{ + ComplexArgumentParser::Finalize(request.year); + ComplexArgumentParser::Finalize(request.month); + ComplexArgumentParser::Finalize(request.day); + ComplexArgumentParser::Finalize(request.dayOfWeek); +} + +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::EnergyCalendar::Structs::DayStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("DayStruct.transitions", "transitions", value.isMember("transitions"))); + + char labelWithMember[kMaxLabelLength]; + if (value.isMember("date")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "date"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.date, value["date"])); + } + valueCopy.removeMember("date"); + + if (value.isMember("daysOfWeek")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "daysOfWeek"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.daysOfWeek, value["daysOfWeek"])); + } + valueCopy.removeMember("daysOfWeek"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "transitions"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.transitions, value["transitions"])); + valueCopy.removeMember("transitions"); + + if (value.isMember("calendarID")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "calendarID"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.calendarID, value["calendarID"])); + } + valueCopy.removeMember("calendarID"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::EnergyCalendar::Structs::DayStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.date); + ComplexArgumentParser::Finalize(request.daysOfWeek); + ComplexArgumentParser::Finalize(request.transitions); + ComplexArgumentParser::Finalize(request.calendarID); +} + +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::EnergyCalendar::Structs::CalendarPeriod::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("CalendarPeriod.startDate", "startDate", value.isMember("startDate"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("CalendarPeriod.days", "days", value.isMember("days"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "startDate"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.startDate, value["startDate"])); + valueCopy.removeMember("startDate"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "days"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.days, value["days"])); + valueCopy.removeMember("days"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::EnergyCalendar::Structs::CalendarPeriod::Type & request) +{ + ComplexArgumentParser::Finalize(request.startDate); + ComplexArgumentParser::Finalize(request.days); +} + +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::EnergyCalendar::Structs::PeakPeriodStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("PeakPeriodStruct.severity", "severity", value.isMember("severity"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("PeakPeriodStruct.peakPeriod", "peakPeriod", value.isMember("peakPeriod"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("PeakPeriodStruct.startTime", "startTime", value.isMember("startTime"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("PeakPeriodStruct.endTime", "endTime", value.isMember("endTime"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "severity"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.severity, value["severity"])); + valueCopy.removeMember("severity"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "peakPeriod"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.peakPeriod, value["peakPeriod"])); + valueCopy.removeMember("peakPeriod"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "startTime"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.startTime, value["startTime"])); + valueCopy.removeMember("startTime"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "endTime"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.endTime, value["endTime"])); + valueCopy.removeMember("endTime"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::EnergyCalendar::Structs::PeakPeriodStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.severity); + ComplexArgumentParser::Finalize(request.peakPeriod); + ComplexArgumentParser::Finalize(request.startTime); + ComplexArgumentParser::Finalize(request.endTime); +} + CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::EnergyPreference::Structs::BalanceStruct::Type & request, Json::Value & value) diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h index ccce33ece63cd8..eeffd3af0a8b41 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h @@ -454,6 +454,31 @@ static CHIP_ERROR Setup(const char * label, chip::app::Clusters::EnergyEvse::Str static void Finalize(chip::app::Clusters::EnergyEvse::Structs::ChargingTargetScheduleStruct::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::EnergyCalendar::Structs::TransitionStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::EnergyCalendar::Structs::TransitionStruct::Type & request); + +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::EnergyCalendar::Structs::Date::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::EnergyCalendar::Structs::Date::Type & request); + +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::EnergyCalendar::Structs::DayStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::EnergyCalendar::Structs::DayStruct::Type & request); + +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::EnergyCalendar::Structs::CalendarPeriod::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::EnergyCalendar::Structs::CalendarPeriod::Type & request); + +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::EnergyCalendar::Structs::PeakPeriodStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::EnergyCalendar::Structs::PeakPeriodStruct::Type & request); + static CHIP_ERROR Setup(const char * label, chip::app::Clusters::EnergyPreference::Structs::BalanceStruct::Type & request, Json::Value & value); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index e51e3eaa80e166..37009ec76324a7 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -3528,6 +3528,195 @@ DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::EnergyCalendar::Structs::TransitionStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("TransitionTime", indent + 1, value.transitionTime); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'TransitionTime'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("PriceTier", indent + 1, value.priceTier); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'PriceTier'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("FriendlyCredit", indent + 1, value.friendlyCredit); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'FriendlyCredit'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("AuxiliaryLoad", indent + 1, value.auxiliaryLoad); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'AuxiliaryLoad'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::EnergyCalendar::Structs::Date::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("Year", indent + 1, value.year); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Year'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Month", indent + 1, value.month); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Month'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Day", indent + 1, value.day); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Day'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("DayOfWeek", indent + 1, value.dayOfWeek); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'DayOfWeek'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::EnergyCalendar::Structs::DayStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("Date", indent + 1, value.date); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Date'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("DaysOfWeek", indent + 1, value.daysOfWeek); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'DaysOfWeek'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Transitions", indent + 1, value.transitions); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Transitions'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("CalendarID", indent + 1, value.calendarID); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'CalendarID'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::EnergyCalendar::Structs::CalendarPeriod::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("StartDate", indent + 1, value.startDate); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'StartDate'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Days", indent + 1, value.days); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Days'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::EnergyCalendar::Structs::PeakPeriodStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("Severity", indent + 1, value.severity); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Severity'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("PeakPeriod", indent + 1, value.peakPeriod); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'PeakPeriod'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("StartTime", indent + 1, value.startTime); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'StartTime'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("EndTime", indent + 1, value.endTime); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'EndTime'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::EnergyPreference::Structs::BalanceStruct::DecodableType & value) { @@ -13904,6 +14093,102 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP } break; } + case EnergyCalendar::Id: { + switch (path.mAttributeId) + { + case EnergyCalendar::Attributes::CalendarID::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("CalendarID", 1, value); + } + case EnergyCalendar::Attributes::Name::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("Name", 1, value); + } + case EnergyCalendar::Attributes::ProviderID::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ProviderID", 1, value); + } + case EnergyCalendar::Attributes::EventID::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("EventID", 1, value); + } + case EnergyCalendar::Attributes::StartDate::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("StartDate", 1, value); + } + case EnergyCalendar::Attributes::CalendarPeriods::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("CalendarPeriods", 1, value); + } + case EnergyCalendar::Attributes::SpecialDays::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("SpecialDays", 1, value); + } + case EnergyCalendar::Attributes::CurrentDay::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("CurrentDay", 1, value); + } + case EnergyCalendar::Attributes::NextDay::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("NextDay", 1, value); + } + case EnergyCalendar::Attributes::CurrentTransition::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("CurrentTransition", 1, value); + } + case EnergyCalendar::Attributes::CurrentPeakPeriod::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("CurrentPeakPeriod", 1, value); + } + case EnergyCalendar::Attributes::NextPeakPeriod::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("NextPeakPeriod", 1, value); + } + case EnergyCalendar::Attributes::GeneratedCommandList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + } + case EnergyCalendar::Attributes::AcceptedCommandList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + } + case EnergyCalendar::Attributes::EventList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("EventList", 1, value); + } + case EnergyCalendar::Attributes::AttributeList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("AttributeList", 1, value); + } + case EnergyCalendar::Attributes::FeatureMap::Id: { + uint32_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("FeatureMap", 1, value); + } + case EnergyCalendar::Attributes::ClusterRevision::Id: { + uint16_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ClusterRevision", 1, value); + } + } + break; + } case EnergyPreference::Id: { switch (path.mAttributeId) { diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h index 8ac710f0c27a0d..6de62acc04bbaf 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h @@ -284,6 +284,21 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::EnergyEvse::Structs::ChargingTargetScheduleStruct::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::EnergyCalendar::Structs::TransitionStruct::DecodableType & value); + +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::EnergyCalendar::Structs::Date::DecodableType & value); + +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::EnergyCalendar::Structs::DayStruct::DecodableType & value); + +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::EnergyCalendar::Structs::CalendarPeriod::DecodableType & value); + +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::EnergyCalendar::Structs::PeakPeriodStruct::DecodableType & value); + static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::EnergyPreference::Structs::BalanceStruct::DecodableType & value); diff --git a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h index 0f45b57afaf21c..4f77097a3f6a7b 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -107,6 +107,7 @@ | Messages | 0x0097 | | DeviceEnergyManagement | 0x0098 | | EnergyEvse | 0x0099 | +| EnergyCalendar | 0x009A | | EnergyPreference | 0x009B | | PowerTopology | 0x009C | | EnergyEvseMode | 0x009D | @@ -86202,6 +86203,1566 @@ class SubscribeAttributeEnergyEvseClusterRevision : public SubscribeAttribute { } }; +#endif // MTR_ENABLE_PROVISIONAL +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL +/*----------------------------------------------------------------------------*\ +| Cluster EnergyCalendar | 0x009A | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * CalendarID | 0x0000 | +| * Name | 0x0001 | +| * ProviderID | 0x0002 | +| * EventID | 0x0003 | +| * StartDate | 0x0004 | +| * CalendarPeriods | 0x0005 | +| * SpecialDays | 0x0006 | +| * CurrentDay | 0x0007 | +| * NextDay | 0x0008 | +| * CurrentTransition | 0x0009 | +| * CurrentPeakPeriod | 0x000A | +| * NextPeakPeriod | 0x000B | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * EventList | 0xFFFA | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ + +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute CalendarID + */ +class ReadEnergyCalendarCalendarID : public ReadAttribute { +public: + ReadEnergyCalendarCalendarID() + : ReadAttribute("calendar-id") + { + } + + ~ReadEnergyCalendarCalendarID() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::CalendarID::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeCalendarIDWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.CalendarID response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("EnergyCalendar CalendarID read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEnergyCalendarCalendarID : public SubscribeAttribute { +public: + SubscribeAttributeEnergyCalendarCalendarID() + : SubscribeAttribute("calendar-id") + { + } + + ~SubscribeAttributeEnergyCalendarCalendarID() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::CalendarID::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCalendarIDWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.CalendarID response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute Name + */ +class ReadEnergyCalendarName : public ReadAttribute { +public: + ReadEnergyCalendarName() + : ReadAttribute("name") + { + } + + ~ReadEnergyCalendarName() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::Name::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeNameWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.Name response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("EnergyCalendar Name read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEnergyCalendarName : public SubscribeAttribute { +public: + SubscribeAttributeEnergyCalendarName() + : SubscribeAttribute("name") + { + } + + ~SubscribeAttributeEnergyCalendarName() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::Name::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNameWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.Name response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute ProviderID + */ +class ReadEnergyCalendarProviderID : public ReadAttribute { +public: + ReadEnergyCalendarProviderID() + : ReadAttribute("provider-id") + { + } + + ~ReadEnergyCalendarProviderID() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::ProviderID::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeProviderIDWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.ProviderID response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("EnergyCalendar ProviderID read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEnergyCalendarProviderID : public SubscribeAttribute { +public: + SubscribeAttributeEnergyCalendarProviderID() + : SubscribeAttribute("provider-id") + { + } + + ~SubscribeAttributeEnergyCalendarProviderID() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::ProviderID::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeProviderIDWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.ProviderID response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute EventID + */ +class ReadEnergyCalendarEventID : public ReadAttribute { +public: + ReadEnergyCalendarEventID() + : ReadAttribute("event-id") + { + } + + ~ReadEnergyCalendarEventID() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::EventID::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeEventIDWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.EventID response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("EnergyCalendar EventID read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEnergyCalendarEventID : public SubscribeAttribute { +public: + SubscribeAttributeEnergyCalendarEventID() + : SubscribeAttribute("event-id") + { + } + + ~SubscribeAttributeEnergyCalendarEventID() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::EventID::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeEventIDWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.EventID response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute StartDate + */ +class ReadEnergyCalendarStartDate : public ReadAttribute { +public: + ReadEnergyCalendarStartDate() + : ReadAttribute("start-date") + { + } + + ~ReadEnergyCalendarStartDate() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::StartDate::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeStartDateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.StartDate response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("EnergyCalendar StartDate read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEnergyCalendarStartDate : public SubscribeAttribute { +public: + SubscribeAttributeEnergyCalendarStartDate() + : SubscribeAttribute("start-date") + { + } + + ~SubscribeAttributeEnergyCalendarStartDate() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::StartDate::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeStartDateWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.StartDate response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute CalendarPeriods + */ +class ReadEnergyCalendarCalendarPeriods : public ReadAttribute { +public: + ReadEnergyCalendarCalendarPeriods() + : ReadAttribute("calendar-periods") + { + } + + ~ReadEnergyCalendarCalendarPeriods() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::CalendarPeriods::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeCalendarPeriodsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.CalendarPeriods response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("EnergyCalendar CalendarPeriods read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEnergyCalendarCalendarPeriods : public SubscribeAttribute { +public: + SubscribeAttributeEnergyCalendarCalendarPeriods() + : SubscribeAttribute("calendar-periods") + { + } + + ~SubscribeAttributeEnergyCalendarCalendarPeriods() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::CalendarPeriods::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCalendarPeriodsWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.CalendarPeriods response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute SpecialDays + */ +class ReadEnergyCalendarSpecialDays : public ReadAttribute { +public: + ReadEnergyCalendarSpecialDays() + : ReadAttribute("special-days") + { + } + + ~ReadEnergyCalendarSpecialDays() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::SpecialDays::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeSpecialDaysWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.SpecialDays response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("EnergyCalendar SpecialDays read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEnergyCalendarSpecialDays : public SubscribeAttribute { +public: + SubscribeAttributeEnergyCalendarSpecialDays() + : SubscribeAttribute("special-days") + { + } + + ~SubscribeAttributeEnergyCalendarSpecialDays() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::SpecialDays::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeSpecialDaysWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.SpecialDays response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute CurrentDay + */ +class ReadEnergyCalendarCurrentDay : public ReadAttribute { +public: + ReadEnergyCalendarCurrentDay() + : ReadAttribute("current-day") + { + } + + ~ReadEnergyCalendarCurrentDay() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::CurrentDay::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeCurrentDayWithCompletion:^(MTREnergyCalendarClusterDayStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.CurrentDay response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("EnergyCalendar CurrentDay read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEnergyCalendarCurrentDay : public SubscribeAttribute { +public: + SubscribeAttributeEnergyCalendarCurrentDay() + : SubscribeAttribute("current-day") + { + } + + ~SubscribeAttributeEnergyCalendarCurrentDay() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::CurrentDay::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentDayWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(MTREnergyCalendarClusterDayStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.CurrentDay response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute NextDay + */ +class ReadEnergyCalendarNextDay : public ReadAttribute { +public: + ReadEnergyCalendarNextDay() + : ReadAttribute("next-day") + { + } + + ~ReadEnergyCalendarNextDay() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::NextDay::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeNextDayWithCompletion:^(MTREnergyCalendarClusterDayStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.NextDay response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("EnergyCalendar NextDay read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEnergyCalendarNextDay : public SubscribeAttribute { +public: + SubscribeAttributeEnergyCalendarNextDay() + : SubscribeAttribute("next-day") + { + } + + ~SubscribeAttributeEnergyCalendarNextDay() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::NextDay::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNextDayWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(MTREnergyCalendarClusterDayStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.NextDay response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute CurrentTransition + */ +class ReadEnergyCalendarCurrentTransition : public ReadAttribute { +public: + ReadEnergyCalendarCurrentTransition() + : ReadAttribute("current-transition") + { + } + + ~ReadEnergyCalendarCurrentTransition() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::CurrentTransition::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeCurrentTransitionWithCompletion:^(MTREnergyCalendarClusterTransitionStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.CurrentTransition response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("EnergyCalendar CurrentTransition read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEnergyCalendarCurrentTransition : public SubscribeAttribute { +public: + SubscribeAttributeEnergyCalendarCurrentTransition() + : SubscribeAttribute("current-transition") + { + } + + ~SubscribeAttributeEnergyCalendarCurrentTransition() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::CurrentTransition::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentTransitionWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(MTREnergyCalendarClusterTransitionStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.CurrentTransition response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute CurrentPeakPeriod + */ +class ReadEnergyCalendarCurrentPeakPeriod : public ReadAttribute { +public: + ReadEnergyCalendarCurrentPeakPeriod() + : ReadAttribute("current-peak-period") + { + } + + ~ReadEnergyCalendarCurrentPeakPeriod() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::CurrentPeakPeriod::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeCurrentPeakPeriodWithCompletion:^(MTREnergyCalendarClusterPeakPeriodStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.CurrentPeakPeriod response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("EnergyCalendar CurrentPeakPeriod read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEnergyCalendarCurrentPeakPeriod : public SubscribeAttribute { +public: + SubscribeAttributeEnergyCalendarCurrentPeakPeriod() + : SubscribeAttribute("current-peak-period") + { + } + + ~SubscribeAttributeEnergyCalendarCurrentPeakPeriod() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::CurrentPeakPeriod::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentPeakPeriodWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(MTREnergyCalendarClusterPeakPeriodStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.CurrentPeakPeriod response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute NextPeakPeriod + */ +class ReadEnergyCalendarNextPeakPeriod : public ReadAttribute { +public: + ReadEnergyCalendarNextPeakPeriod() + : ReadAttribute("next-peak-period") + { + } + + ~ReadEnergyCalendarNextPeakPeriod() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::NextPeakPeriod::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeNextPeakPeriodWithCompletion:^(MTREnergyCalendarClusterPeakPeriodStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.NextPeakPeriod response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("EnergyCalendar NextPeakPeriod read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEnergyCalendarNextPeakPeriod : public SubscribeAttribute { +public: + SubscribeAttributeEnergyCalendarNextPeakPeriod() + : SubscribeAttribute("next-peak-period") + { + } + + ~SubscribeAttributeEnergyCalendarNextPeakPeriod() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::NextPeakPeriod::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeNextPeakPeriodWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(MTREnergyCalendarClusterPeakPeriodStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.NextPeakPeriod response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute GeneratedCommandList + */ +class ReadEnergyCalendarGeneratedCommandList : public ReadAttribute { +public: + ReadEnergyCalendarGeneratedCommandList() + : ReadAttribute("generated-command-list") + { + } + + ~ReadEnergyCalendarGeneratedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::GeneratedCommandList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.GeneratedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("EnergyCalendar GeneratedCommandList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEnergyCalendarGeneratedCommandList : public SubscribeAttribute { +public: + SubscribeAttributeEnergyCalendarGeneratedCommandList() + : SubscribeAttribute("generated-command-list") + { + } + + ~SubscribeAttributeEnergyCalendarGeneratedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::GeneratedCommandList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.GeneratedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute AcceptedCommandList + */ +class ReadEnergyCalendarAcceptedCommandList : public ReadAttribute { +public: + ReadEnergyCalendarAcceptedCommandList() + : ReadAttribute("accepted-command-list") + { + } + + ~ReadEnergyCalendarAcceptedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::AcceptedCommandList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.AcceptedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("EnergyCalendar AcceptedCommandList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEnergyCalendarAcceptedCommandList : public SubscribeAttribute { +public: + SubscribeAttributeEnergyCalendarAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") + { + } + + ~SubscribeAttributeEnergyCalendarAcceptedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::AcceptedCommandList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.AcceptedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute EventList + */ +class ReadEnergyCalendarEventList : public ReadAttribute { +public: + ReadEnergyCalendarEventList() + : ReadAttribute("event-list") + { + } + + ~ReadEnergyCalendarEventList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::EventList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.EventList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("EnergyCalendar EventList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEnergyCalendarEventList : public SubscribeAttribute { +public: + SubscribeAttributeEnergyCalendarEventList() + : SubscribeAttribute("event-list") + { + } + + ~SubscribeAttributeEnergyCalendarEventList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::EventList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeEventListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.EventList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute AttributeList + */ +class ReadEnergyCalendarAttributeList : public ReadAttribute { +public: + ReadEnergyCalendarAttributeList() + : ReadAttribute("attribute-list") + { + } + + ~ReadEnergyCalendarAttributeList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::AttributeList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.AttributeList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("EnergyCalendar AttributeList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEnergyCalendarAttributeList : public SubscribeAttribute { +public: + SubscribeAttributeEnergyCalendarAttributeList() + : SubscribeAttribute("attribute-list") + { + } + + ~SubscribeAttributeEnergyCalendarAttributeList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::AttributeList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.AttributeList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute FeatureMap + */ +class ReadEnergyCalendarFeatureMap : public ReadAttribute { +public: + ReadEnergyCalendarFeatureMap() + : ReadAttribute("feature-map") + { + } + + ~ReadEnergyCalendarFeatureMap() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::FeatureMap::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.FeatureMap response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("EnergyCalendar FeatureMap read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEnergyCalendarFeatureMap : public SubscribeAttribute { +public: + SubscribeAttributeEnergyCalendarFeatureMap() + : SubscribeAttribute("feature-map") + { + } + + ~SubscribeAttributeEnergyCalendarFeatureMap() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::FeatureMap::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.FeatureMap response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute ClusterRevision + */ +class ReadEnergyCalendarClusterRevision : public ReadAttribute { +public: + ReadEnergyCalendarClusterRevision() + : ReadAttribute("cluster-revision") + { + } + + ~ReadEnergyCalendarClusterRevision() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::ClusterRevision::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.ClusterRevision response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("EnergyCalendar ClusterRevision read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEnergyCalendarClusterRevision : public SubscribeAttribute { +public: + SubscribeAttributeEnergyCalendarClusterRevision() + : SubscribeAttribute("cluster-revision") + { + } + + ~SubscribeAttributeEnergyCalendarClusterRevision() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyCalendar::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyCalendar::Attributes::ClusterRevision::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterEnergyCalendar alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"EnergyCalendar.ClusterRevision response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL @@ -180158,6 +181719,95 @@ void registerClusterEnergyEvse(Commands & commands) commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } +void registerClusterEnergyCalendar(Commands & commands) +{ +#if MTR_ENABLE_PROVISIONAL + using namespace chip::app::Clusters::EnergyCalendar; + + const char * clusterName = "EnergyCalendar"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique(Id), // + make_unique(Id), // +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL + }; + + commands.RegisterCluster(clusterName, clusterCommands); +#endif // MTR_ENABLE_PROVISIONAL +} void registerClusterEnergyPreference(Commands & commands) { #if MTR_ENABLE_PROVISIONAL @@ -183611,6 +185261,7 @@ void registerClusters(Commands & commands) registerClusterMessages(commands); registerClusterDeviceEnergyManagement(commands); registerClusterEnergyEvse(commands); + registerClusterEnergyCalendar(commands); registerClusterEnergyPreference(commands); registerClusterPowerTopology(commands); registerClusterEnergyEvseMode(commands); From 9f0de49719d2d956f98f631d17f917b961a125a8 Mon Sep 17 00:00:00 2001 From: Mikhail Antropov Date: Mon, 17 Jun 2024 21:48:51 +0300 Subject: [PATCH 02/16] Update generated files --- docs/zap_clusters.md | 1 + .../chip/devicecontroller/ChipClusters.java | 565 +++++ .../chip/devicecontroller/ChipStructs.java | 425 ++++ .../devicecontroller/ClusterIDMapping.java | 115 + .../devicecontroller/ClusterInfoMapping.java | 345 +++ .../devicecontroller/ClusterReadMapping.java | 148 ++ .../devicecontroller/ClusterWriteMapping.java | 2 + .../chip/devicecontroller/cluster/files.gni | 5 + .../EnergyCalendarClusterCalendarPeriod.kt | 71 + .../structs/EnergyCalendarClusterDate.kt | 102 + .../structs/EnergyCalendarClusterDayStruct.kt | 106 + .../EnergyCalendarClusterPeakPeriodStruct.kt | 69 + .../EnergyCalendarClusterTransitionStruct.kt | 99 + .../cluster/clusters/EnergyCalendarCluster.kt | 1888 +++++++++++++++++ .../java/matter/controller/cluster/files.gni | 6 + .../EnergyCalendarClusterCalendarPeriod.kt | 71 + .../structs/EnergyCalendarClusterDate.kt | 102 + .../structs/EnergyCalendarClusterDayStruct.kt | 106 + .../EnergyCalendarClusterPeakPeriodStruct.kt | 69 + .../EnergyCalendarClusterTransitionStruct.kt | 99 + .../CHIPAttributeTLVValueDecoder.cpp | 1656 +++++++++++++++ .../CHIPEventTLVValueDecoder.cpp | 10 + .../MTRAttributeSpecifiedCheck.mm | 66 + .../MTRAttributeTLVValueDecoder.mm | 531 +++++ .../CHIP/zap-generated/MTRBaseClusters.h | 168 ++ .../CHIP/zap-generated/MTRBaseClusters.mm | 652 ++++++ .../CHIP/zap-generated/MTRClusterConstants.h | 21 + .../CHIP/zap-generated/MTRClusterNames.mm | 85 + .../CHIP/zap-generated/MTRClusters.h | 60 + .../CHIP/zap-generated/MTRClusters.mm | 94 + .../zap-generated/MTRCommandTimedCheck.mm | 12 + .../zap-generated/MTREventTLVValueDecoder.mm | 15 + .../CHIP/zap-generated/MTRStructsObjc.h | 38 + .../CHIP/zap-generated/MTRStructsObjc.mm | 174 ++ 34 files changed, 7976 insertions(+) create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterCalendarPeriod.kt create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDate.kt create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterTransitionStruct.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyCalendarCluster.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterCalendarPeriod.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDate.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterTransitionStruct.kt diff --git a/docs/zap_clusters.md b/docs/zap_clusters.md index 41679143b5c428..523ef5735f36d2 100644 --- a/docs/zap_clusters.md +++ b/docs/zap_clusters.md @@ -82,6 +82,7 @@ Generally regenerate using one of: | 151 | 0x97 | Messages | | 152 | 0x98 | DeviceEnergyManagement | | 153 | 0x99 | EnergyEvse | +| 154 | 0x9A | EnergyCalendar | | 155 | 0x9B | EnergyPreference | | 156 | 0x9C | PowerTopology | | 157 | 0x9D | EnergyEvseMode | diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index 2ce04c328ded6f..d5feb9d01491d2 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -32659,6 +32659,571 @@ public void onSuccess(byte[] tlv) { } } + public static class EnergyCalendarCluster extends BaseChipCluster { + public static final long CLUSTER_ID = 154L; + + private static final long CALENDAR_I_D_ATTRIBUTE_ID = 0L; + private static final long NAME_ATTRIBUTE_ID = 1L; + private static final long PROVIDER_I_D_ATTRIBUTE_ID = 2L; + private static final long EVENT_I_D_ATTRIBUTE_ID = 3L; + private static final long START_DATE_ATTRIBUTE_ID = 4L; + private static final long CALENDAR_PERIODS_ATTRIBUTE_ID = 5L; + private static final long SPECIAL_DAYS_ATTRIBUTE_ID = 6L; + private static final long CURRENT_DAY_ATTRIBUTE_ID = 7L; + private static final long NEXT_DAY_ATTRIBUTE_ID = 8L; + private static final long CURRENT_TRANSITION_ATTRIBUTE_ID = 9L; + private static final long CURRENT_PEAK_PERIOD_ATTRIBUTE_ID = 10L; + private static final long NEXT_PEAK_PERIOD_ATTRIBUTE_ID = 11L; + private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L; + private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L; + private static final long EVENT_LIST_ATTRIBUTE_ID = 65530L; + private static final long ATTRIBUTE_LIST_ATTRIBUTE_ID = 65531L; + private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L; + private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L; + + public EnergyCalendarCluster(long devicePtr, int endpointId) { + super(devicePtr, endpointId, CLUSTER_ID); + } + + @Override + @Deprecated + public long initWithDevice(long devicePtr, int endpointId) { + return 0L; + } + + public interface CalendarIDAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable Long value); + } + + public interface NameAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable String value); + } + + public interface ProviderIDAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable Long value); + } + + public interface EventIDAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable Long value); + } + + public interface StartDateAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable Long value); + } + + public interface CalendarPeriodsAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface SpecialDaysAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface CurrentDayAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable ChipStructs.EnergyCalendarClusterDayStruct value); + } + + public interface NextDayAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable ChipStructs.EnergyCalendarClusterDayStruct value); + } + + public interface CurrentTransitionAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable ChipStructs.EnergyCalendarClusterTransitionStruct value); + } + + public interface CurrentPeakPeriodAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable ChipStructs.EnergyCalendarClusterPeakPeriodStruct value); + } + + public interface NextPeakPeriodAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable ChipStructs.EnergyCalendarClusterPeakPeriodStruct value); + } + + public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface AcceptedCommandListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface EventListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface AttributeListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public void readCalendarIDAttribute( + CalendarIDAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CALENDAR_I_D_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CALENDAR_I_D_ATTRIBUTE_ID, true); + } + + public void subscribeCalendarIDAttribute( + CalendarIDAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CALENDAR_I_D_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CALENDAR_I_D_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readNameAttribute( + NameAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NAME_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, NAME_ATTRIBUTE_ID, true); + } + + public void subscribeNameAttribute( + NameAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NAME_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, NAME_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readProviderIDAttribute( + ProviderIDAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PROVIDER_I_D_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, PROVIDER_I_D_ATTRIBUTE_ID, true); + } + + public void subscribeProviderIDAttribute( + ProviderIDAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PROVIDER_I_D_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, PROVIDER_I_D_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readEventIDAttribute( + EventIDAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_I_D_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, EVENT_I_D_ATTRIBUTE_ID, true); + } + + public void subscribeEventIDAttribute( + EventIDAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_I_D_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, EVENT_I_D_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readStartDateAttribute( + StartDateAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, START_DATE_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, START_DATE_ATTRIBUTE_ID, true); + } + + public void subscribeStartDateAttribute( + StartDateAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, START_DATE_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, START_DATE_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readCalendarPeriodsAttribute( + CalendarPeriodsAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CALENDAR_PERIODS_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CALENDAR_PERIODS_ATTRIBUTE_ID, true); + } + + public void subscribeCalendarPeriodsAttribute( + CalendarPeriodsAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CALENDAR_PERIODS_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CALENDAR_PERIODS_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readSpecialDaysAttribute( + SpecialDaysAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SPECIAL_DAYS_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, SPECIAL_DAYS_ATTRIBUTE_ID, true); + } + + public void subscribeSpecialDaysAttribute( + SpecialDaysAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SPECIAL_DAYS_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, SPECIAL_DAYS_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readCurrentDayAttribute( + CurrentDayAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_DAY_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable ChipStructs.EnergyCalendarClusterDayStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CURRENT_DAY_ATTRIBUTE_ID, true); + } + + public void subscribeCurrentDayAttribute( + CurrentDayAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_DAY_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable ChipStructs.EnergyCalendarClusterDayStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CURRENT_DAY_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readNextDayAttribute( + NextDayAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NEXT_DAY_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable ChipStructs.EnergyCalendarClusterDayStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, NEXT_DAY_ATTRIBUTE_ID, true); + } + + public void subscribeNextDayAttribute( + NextDayAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NEXT_DAY_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable ChipStructs.EnergyCalendarClusterDayStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, NEXT_DAY_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readCurrentTransitionAttribute( + CurrentTransitionAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_TRANSITION_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable ChipStructs.EnergyCalendarClusterTransitionStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CURRENT_TRANSITION_ATTRIBUTE_ID, true); + } + + public void subscribeCurrentTransitionAttribute( + CurrentTransitionAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_TRANSITION_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable ChipStructs.EnergyCalendarClusterTransitionStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CURRENT_TRANSITION_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readCurrentPeakPeriodAttribute( + CurrentPeakPeriodAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_PEAK_PERIOD_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable ChipStructs.EnergyCalendarClusterPeakPeriodStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CURRENT_PEAK_PERIOD_ATTRIBUTE_ID, true); + } + + public void subscribeCurrentPeakPeriodAttribute( + CurrentPeakPeriodAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_PEAK_PERIOD_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable ChipStructs.EnergyCalendarClusterPeakPeriodStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CURRENT_PEAK_PERIOD_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readNextPeakPeriodAttribute( + NextPeakPeriodAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NEXT_PEAK_PERIOD_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable ChipStructs.EnergyCalendarClusterPeakPeriodStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, NEXT_PEAK_PERIOD_ATTRIBUTE_ID, true); + } + + public void subscribeNextPeakPeriodAttribute( + NextPeakPeriodAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NEXT_PEAK_PERIOD_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable ChipStructs.EnergyCalendarClusterPeakPeriodStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, NEXT_PEAK_PERIOD_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readGeneratedCommandListAttribute( + GeneratedCommandListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeGeneratedCommandListAttribute( + GeneratedCommandListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readAcceptedCommandListAttribute( + AcceptedCommandListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeAcceptedCommandListAttribute( + AcceptedCommandListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readEventListAttribute( + EventListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, EVENT_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeEventListAttribute( + EventListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readAttributeListAttribute( + AttributeListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ATTRIBUTE_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ATTRIBUTE_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ATTRIBUTE_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readFeatureMapAttribute( + LongAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FEATURE_MAP_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, FEATURE_MAP_ATTRIBUTE_ID, true); + } + + public void subscribeFeatureMapAttribute( + LongAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FEATURE_MAP_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readClusterRevisionAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CLUSTER_REVISION_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CLUSTER_REVISION_ATTRIBUTE_ID, true); + } + + public void subscribeClusterRevisionAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CLUSTER_REVISION_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); + } + } + public static class EnergyPreferenceCluster extends BaseChipCluster { public static final long CLUSTER_ID = 155L; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index 7ee8a88f80f64b..458fb5c43a7a09 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -8759,6 +8759,431 @@ public String toString() { return output.toString(); } } +public static class EnergyCalendarClusterTransitionStruct { + public Integer transitionTime; + public Optional priceTier; + public Optional friendlyCredit; + public Optional auxiliaryLoad; + private static final long TRANSITION_TIME_ID = 0L; + private static final long PRICE_TIER_ID = 1L; + private static final long FRIENDLY_CREDIT_ID = 2L; + private static final long AUXILIARY_LOAD_ID = 3L; + + public EnergyCalendarClusterTransitionStruct( + Integer transitionTime, + Optional priceTier, + Optional friendlyCredit, + Optional auxiliaryLoad + ) { + this.transitionTime = transitionTime; + this.priceTier = priceTier; + this.friendlyCredit = friendlyCredit; + this.auxiliaryLoad = auxiliaryLoad; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(TRANSITION_TIME_ID, new UIntType(transitionTime))); + values.add(new StructElement(PRICE_TIER_ID, priceTier.map((nonOptionalpriceTier) -> new UIntType(nonOptionalpriceTier)).orElse(new EmptyType()))); + values.add(new StructElement(FRIENDLY_CREDIT_ID, friendlyCredit.map((nonOptionalfriendlyCredit) -> new BooleanType(nonOptionalfriendlyCredit)).orElse(new EmptyType()))); + values.add(new StructElement(AUXILIARY_LOAD_ID, auxiliaryLoad.map((nonOptionalauxiliaryLoad) -> new UIntType(nonOptionalauxiliaryLoad)).orElse(new EmptyType()))); + + return new StructType(values); + } + + public static EnergyCalendarClusterTransitionStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Integer transitionTime = null; + Optional priceTier = Optional.empty(); + Optional friendlyCredit = Optional.empty(); + Optional auxiliaryLoad = Optional.empty(); + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == TRANSITION_TIME_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + transitionTime = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == PRICE_TIER_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + priceTier = Optional.of(castingValue.value(Long.class)); + } + } else if (element.contextTagNum() == FRIENDLY_CREDIT_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Boolean) { + BooleanType castingValue = element.value(BooleanType.class); + friendlyCredit = Optional.of(castingValue.value(Boolean.class)); + } + } else if (element.contextTagNum() == AUXILIARY_LOAD_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + auxiliaryLoad = Optional.of(castingValue.value(Integer.class)); + } + } + } + return new EnergyCalendarClusterTransitionStruct( + transitionTime, + priceTier, + friendlyCredit, + auxiliaryLoad + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("EnergyCalendarClusterTransitionStruct {\n"); + output.append("\ttransitionTime: "); + output.append(transitionTime); + output.append("\n"); + output.append("\tpriceTier: "); + output.append(priceTier); + output.append("\n"); + output.append("\tfriendlyCredit: "); + output.append(friendlyCredit); + output.append("\n"); + output.append("\tauxiliaryLoad: "); + output.append(auxiliaryLoad); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class EnergyCalendarClusterDate { + public Optional year; + public Optional month; + public Optional day; + public Optional dayOfWeek; + private static final long YEAR_ID = 0L; + private static final long MONTH_ID = 1L; + private static final long DAY_ID = 2L; + private static final long DAY_OF_WEEK_ID = 3L; + + public EnergyCalendarClusterDate( + Optional year, + Optional month, + Optional day, + Optional dayOfWeek + ) { + this.year = year; + this.month = month; + this.day = day; + this.dayOfWeek = dayOfWeek; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(YEAR_ID, year.map((nonOptionalyear) -> new UIntType(nonOptionalyear)).orElse(new EmptyType()))); + values.add(new StructElement(MONTH_ID, month.map((nonOptionalmonth) -> new UIntType(nonOptionalmonth)).orElse(new EmptyType()))); + values.add(new StructElement(DAY_ID, day.map((nonOptionalday) -> new UIntType(nonOptionalday)).orElse(new EmptyType()))); + values.add(new StructElement(DAY_OF_WEEK_ID, dayOfWeek.map((nonOptionaldayOfWeek) -> new UIntType(nonOptionaldayOfWeek)).orElse(new EmptyType()))); + + return new StructType(values); + } + + public static EnergyCalendarClusterDate decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Optional year = Optional.empty(); + Optional month = Optional.empty(); + Optional day = Optional.empty(); + Optional dayOfWeek = Optional.empty(); + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == YEAR_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + year = Optional.of(castingValue.value(Integer.class)); + } + } else if (element.contextTagNum() == MONTH_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + month = Optional.of(castingValue.value(Integer.class)); + } + } else if (element.contextTagNum() == DAY_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + day = Optional.of(castingValue.value(Integer.class)); + } + } else if (element.contextTagNum() == DAY_OF_WEEK_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + dayOfWeek = Optional.of(castingValue.value(Integer.class)); + } + } + } + return new EnergyCalendarClusterDate( + year, + month, + day, + dayOfWeek + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("EnergyCalendarClusterDate {\n"); + output.append("\tyear: "); + output.append(year); + output.append("\n"); + output.append("\tmonth: "); + output.append(month); + output.append("\n"); + output.append("\tday: "); + output.append(day); + output.append("\n"); + output.append("\tdayOfWeek: "); + output.append(dayOfWeek); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class EnergyCalendarClusterDayStruct { + public Optional date; + public Optional daysOfWeek; + public ArrayList transitions; + public Optional calendarID; + private static final long DATE_ID = 0L; + private static final long DAYS_OF_WEEK_ID = 1L; + private static final long TRANSITIONS_ID = 2L; + private static final long CALENDAR_I_D_ID = 3L; + + public EnergyCalendarClusterDayStruct( + Optional date, + Optional daysOfWeek, + ArrayList transitions, + Optional calendarID + ) { + this.date = date; + this.daysOfWeek = daysOfWeek; + this.transitions = transitions; + this.calendarID = calendarID; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(DATE_ID, date.map((nonOptionaldate) -> nonOptionaldate.encodeTlv()).orElse(new EmptyType()))); + values.add(new StructElement(DAYS_OF_WEEK_ID, daysOfWeek.map((nonOptionaldaysOfWeek) -> new UIntType(nonOptionaldaysOfWeek)).orElse(new EmptyType()))); + values.add(new StructElement(TRANSITIONS_ID, ArrayType.generateArrayType(transitions, (elementtransitions) -> elementtransitions.encodeTlv()))); + values.add(new StructElement(CALENDAR_I_D_ID, calendarID.map((nonOptionalcalendarID) -> new UIntType(nonOptionalcalendarID)).orElse(new EmptyType()))); + + return new StructType(values); + } + + public static EnergyCalendarClusterDayStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Optional date = Optional.empty(); + Optional daysOfWeek = Optional.empty(); + ArrayList transitions = null; + Optional calendarID = Optional.empty(); + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == DATE_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Struct) { + StructType castingValue = element.value(StructType.class); + date = Optional.of(ChipStructs.EnergyCalendarClusterDate.decodeTlv(castingValue)); + } + } else if (element.contextTagNum() == DAYS_OF_WEEK_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + daysOfWeek = Optional.of(castingValue.value(Integer.class)); + } + } else if (element.contextTagNum() == TRANSITIONS_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Array) { + ArrayType castingValue = element.value(ArrayType.class); + transitions = castingValue.map((elementcastingValue) -> ChipStructs.EnergyCalendarClusterTransitionStruct.decodeTlv(elementcastingValue)); + } + } else if (element.contextTagNum() == CALENDAR_I_D_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + calendarID = Optional.of(castingValue.value(Long.class)); + } + } + } + return new EnergyCalendarClusterDayStruct( + date, + daysOfWeek, + transitions, + calendarID + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("EnergyCalendarClusterDayStruct {\n"); + output.append("\tdate: "); + output.append(date); + output.append("\n"); + output.append("\tdaysOfWeek: "); + output.append(daysOfWeek); + output.append("\n"); + output.append("\ttransitions: "); + output.append(transitions); + output.append("\n"); + output.append("\tcalendarID: "); + output.append(calendarID); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class EnergyCalendarClusterCalendarPeriod { + public Long startDate; + public ArrayList days; + private static final long START_DATE_ID = 0L; + private static final long DAYS_ID = 1L; + + public EnergyCalendarClusterCalendarPeriod( + Long startDate, + ArrayList days + ) { + this.startDate = startDate; + this.days = days; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(START_DATE_ID, new UIntType(startDate))); + values.add(new StructElement(DAYS_ID, ArrayType.generateArrayType(days, (elementdays) -> elementdays.encodeTlv()))); + + return new StructType(values); + } + + public static EnergyCalendarClusterCalendarPeriod decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Long startDate = null; + ArrayList days = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == START_DATE_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + startDate = castingValue.value(Long.class); + } + } else if (element.contextTagNum() == DAYS_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Array) { + ArrayType castingValue = element.value(ArrayType.class); + days = castingValue.map((elementcastingValue) -> ChipStructs.EnergyCalendarClusterDayStruct.decodeTlv(elementcastingValue)); + } + } + } + return new EnergyCalendarClusterCalendarPeriod( + startDate, + days + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("EnergyCalendarClusterCalendarPeriod {\n"); + output.append("\tstartDate: "); + output.append(startDate); + output.append("\n"); + output.append("\tdays: "); + output.append(days); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class EnergyCalendarClusterPeakPeriodStruct { + public Integer severity; + public Integer peakPeriod; + public Long startTime; + public Long endTime; + private static final long SEVERITY_ID = 0L; + private static final long PEAK_PERIOD_ID = 1L; + private static final long START_TIME_ID = 2L; + private static final long END_TIME_ID = 3L; + + public EnergyCalendarClusterPeakPeriodStruct( + Integer severity, + Integer peakPeriod, + Long startTime, + Long endTime + ) { + this.severity = severity; + this.peakPeriod = peakPeriod; + this.startTime = startTime; + this.endTime = endTime; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(SEVERITY_ID, new UIntType(severity))); + values.add(new StructElement(PEAK_PERIOD_ID, new UIntType(peakPeriod))); + values.add(new StructElement(START_TIME_ID, new UIntType(startTime))); + values.add(new StructElement(END_TIME_ID, new UIntType(endTime))); + + return new StructType(values); + } + + public static EnergyCalendarClusterPeakPeriodStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Integer severity = null; + Integer peakPeriod = null; + Long startTime = null; + Long endTime = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == SEVERITY_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + severity = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == PEAK_PERIOD_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + peakPeriod = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == START_TIME_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + startTime = castingValue.value(Long.class); + } + } else if (element.contextTagNum() == END_TIME_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + endTime = castingValue.value(Long.class); + } + } + } + return new EnergyCalendarClusterPeakPeriodStruct( + severity, + peakPeriod, + startTime, + endTime + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("EnergyCalendarClusterPeakPeriodStruct {\n"); + output.append("\tseverity: "); + output.append(severity); + output.append("\n"); + output.append("\tpeakPeriod: "); + output.append(peakPeriod); + output.append("\n"); + output.append("\tstartTime: "); + output.append(startTime); + output.append("\n"); + output.append("\tendTime: "); + output.append(endTime); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} public static class EnergyPreferenceClusterBalanceStruct { public Integer step; public Optional label; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java index 8bf4e6d615c358..e8d6fc3262642a 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java @@ -238,6 +238,9 @@ public static BaseCluster getCluster(long clusterId) { if (clusterId == EnergyEvse.ID) { return new EnergyEvse(); } + if (clusterId == EnergyCalendar.ID) { + return new EnergyCalendar(); + } if (clusterId == EnergyPreference.ID) { return new EnergyPreference(); } @@ -9995,6 +9998,118 @@ public long getCommandID(String name) throws IllegalArgumentException { return Command.valueOf(name).getID(); } } + public static class EnergyCalendar implements BaseCluster { + public static final long ID = 154L; + public long getID() { + return ID; + } + + public enum Attribute { + CalendarID(0L), + Name(1L), + ProviderID(2L), + EventID(3L), + StartDate(4L), + CalendarPeriods(5L), + SpecialDays(6L), + CurrentDay(7L), + NextDay(8L), + CurrentTransition(9L), + CurrentPeakPeriod(10L), + NextPeakPeriod(11L), + GeneratedCommandList(65528L), + AcceptedCommandList(65529L), + EventList(65530L), + AttributeList(65531L), + FeatureMap(65532L), + ClusterRevision(65533L),; + private final long id; + Attribute(long id) { + this.id = id; + } + + public long getID() { + return id; + } + + public static Attribute value(long id) throws NoSuchFieldError { + for (Attribute attribute : Attribute.values()) { + if (attribute.getID() == id) { + return attribute; + } + } + throw new NoSuchFieldError(); + } + } + + public enum Event {; + private final long id; + Event(long id) { + this.id = id; + } + + public long getID() { + return id; + } + + public static Event value(long id) throws NoSuchFieldError { + for (Event event : Event.values()) { + if (event.getID() == id) { + return event; + } + } + throw new NoSuchFieldError(); + } + } + + public enum Command {; + private final long id; + Command(long id) { + this.id = id; + } + + public long getID() { + return id; + } + + public static Command value(long id) throws NoSuchFieldError { + for (Command command : Command.values()) { + if (command.getID() == id) { + return command; + } + } + throw new NoSuchFieldError(); + } + }@Override + public String getAttributeName(long id) throws NoSuchFieldError { + return Attribute.value(id).toString(); + } + + @Override + public String getEventName(long id) throws NoSuchFieldError { + return Event.value(id).toString(); + } + + @Override + public String getCommandName(long id) throws NoSuchFieldError { + return Command.value(id).toString(); + } + + @Override + public long getAttributeID(String name) throws IllegalArgumentException { + return Attribute.valueOf(name).getID(); + } + + @Override + public long getEventID(String name) throws IllegalArgumentException { + return Event.valueOf(name).getID(); + } + + @Override + public long getCommandID(String name) throws IllegalArgumentException { + return Command.valueOf(name).getID(); + } + } public static class EnergyPreference implements BaseCluster { public static final long ID = 155L; public long getID() { diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java index 40427e62794337..2fa4a337767fe7 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java @@ -11424,6 +11424,342 @@ public void onError(Exception ex) { } } + public static class DelegatedEnergyCalendarClusterCalendarIDAttributeCallback implements ChipClusters.EnergyCalendarCluster.CalendarIDAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable Long value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedEnergyCalendarClusterNameAttributeCallback implements ChipClusters.EnergyCalendarCluster.NameAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable String value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "String"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedEnergyCalendarClusterProviderIDAttributeCallback implements ChipClusters.EnergyCalendarCluster.ProviderIDAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable Long value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedEnergyCalendarClusterEventIDAttributeCallback implements ChipClusters.EnergyCalendarCluster.EventIDAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable Long value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedEnergyCalendarClusterStartDateAttributeCallback implements ChipClusters.EnergyCalendarCluster.StartDateAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable Long value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedEnergyCalendarClusterCalendarPeriodsAttributeCallback implements ChipClusters.EnergyCalendarCluster.CalendarPeriodsAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedEnergyCalendarClusterSpecialDaysAttributeCallback implements ChipClusters.EnergyCalendarCluster.SpecialDaysAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedEnergyCalendarClusterCurrentDayAttributeCallback implements ChipClusters.EnergyCalendarCluster.CurrentDayAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable ChipStructs.EnergyCalendarClusterDayStruct value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "ChipStructs.EnergyCalendarClusterDayStruct"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedEnergyCalendarClusterNextDayAttributeCallback implements ChipClusters.EnergyCalendarCluster.NextDayAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable ChipStructs.EnergyCalendarClusterDayStruct value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "ChipStructs.EnergyCalendarClusterDayStruct"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedEnergyCalendarClusterCurrentTransitionAttributeCallback implements ChipClusters.EnergyCalendarCluster.CurrentTransitionAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable ChipStructs.EnergyCalendarClusterTransitionStruct value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "ChipStructs.EnergyCalendarClusterTransitionStruct"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedEnergyCalendarClusterCurrentPeakPeriodAttributeCallback implements ChipClusters.EnergyCalendarCluster.CurrentPeakPeriodAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable ChipStructs.EnergyCalendarClusterPeakPeriodStruct value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "ChipStructs.EnergyCalendarClusterPeakPeriodStruct"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedEnergyCalendarClusterNextPeakPeriodAttributeCallback implements ChipClusters.EnergyCalendarCluster.NextPeakPeriodAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable ChipStructs.EnergyCalendarClusterPeakPeriodStruct value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "ChipStructs.EnergyCalendarClusterPeakPeriodStruct"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedEnergyCalendarClusterGeneratedCommandListAttributeCallback implements ChipClusters.EnergyCalendarCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedEnergyCalendarClusterAcceptedCommandListAttributeCallback implements ChipClusters.EnergyCalendarCluster.AcceptedCommandListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedEnergyCalendarClusterEventListAttributeCallback implements ChipClusters.EnergyCalendarCluster.EventListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedEnergyCalendarClusterAttributeListAttributeCallback implements ChipClusters.EnergyCalendarCluster.AttributeListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + public static class DelegatedEnergyPreferenceClusterEnergyBalancesAttributeCallback implements ChipClusters.EnergyPreferenceCluster.EnergyBalancesAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override @@ -22140,6 +22476,10 @@ public Map initializeClusterMap() { (ptr, endpointId) -> new ChipClusters.EnergyEvseCluster(ptr, endpointId), new HashMap<>()); clusterMap.put("energyEvse", energyEvseClusterInfo); + ClusterInfo energyCalendarClusterInfo = new ClusterInfo( + (ptr, endpointId) -> new ChipClusters.EnergyCalendarCluster(ptr, endpointId), new HashMap<>()); + clusterMap.put("energyCalendar", energyCalendarClusterInfo); + ClusterInfo energyPreferenceClusterInfo = new ClusterInfo( (ptr, endpointId) -> new ChipClusters.EnergyPreferenceCluster(ptr, endpointId), new HashMap<>()); clusterMap.put("energyPreference", energyPreferenceClusterInfo); @@ -22422,6 +22762,7 @@ public void combineCommand(Map destination, Map> getCommandMap() { commandMap.put("energyEvse", energyEvseClusterInteractionInfoMap); + Map energyCalendarClusterInteractionInfoMap = new LinkedHashMap<>(); + + commandMap.put("energyCalendar", energyCalendarClusterInteractionInfoMap); + Map energyPreferenceClusterInteractionInfoMap = new LinkedHashMap<>(); commandMap.put("energyPreference", energyPreferenceClusterInteractionInfoMap); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java index 7de9e8cdc25d2f..1558ff6fb1de90 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java @@ -9985,6 +9985,153 @@ private static Map readEnergyEvseInteractionInfo() { return result; } + private static Map readEnergyCalendarInteractionInfo() { + Map result = new LinkedHashMap<>();Map readEnergyCalendarCalendarIDCommandParams = new LinkedHashMap(); + InteractionInfo readEnergyCalendarCalendarIDAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.EnergyCalendarCluster) cluster).readCalendarIDAttribute( + (ChipClusters.EnergyCalendarCluster.CalendarIDAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedEnergyCalendarClusterCalendarIDAttributeCallback(), + readEnergyCalendarCalendarIDCommandParams + ); + result.put("readCalendarIDAttribute", readEnergyCalendarCalendarIDAttributeInteractionInfo); + Map readEnergyCalendarNameCommandParams = new LinkedHashMap(); + InteractionInfo readEnergyCalendarNameAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.EnergyCalendarCluster) cluster).readNameAttribute( + (ChipClusters.EnergyCalendarCluster.NameAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedEnergyCalendarClusterNameAttributeCallback(), + readEnergyCalendarNameCommandParams + ); + result.put("readNameAttribute", readEnergyCalendarNameAttributeInteractionInfo); + Map readEnergyCalendarProviderIDCommandParams = new LinkedHashMap(); + InteractionInfo readEnergyCalendarProviderIDAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.EnergyCalendarCluster) cluster).readProviderIDAttribute( + (ChipClusters.EnergyCalendarCluster.ProviderIDAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedEnergyCalendarClusterProviderIDAttributeCallback(), + readEnergyCalendarProviderIDCommandParams + ); + result.put("readProviderIDAttribute", readEnergyCalendarProviderIDAttributeInteractionInfo); + Map readEnergyCalendarEventIDCommandParams = new LinkedHashMap(); + InteractionInfo readEnergyCalendarEventIDAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.EnergyCalendarCluster) cluster).readEventIDAttribute( + (ChipClusters.EnergyCalendarCluster.EventIDAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedEnergyCalendarClusterEventIDAttributeCallback(), + readEnergyCalendarEventIDCommandParams + ); + result.put("readEventIDAttribute", readEnergyCalendarEventIDAttributeInteractionInfo); + Map readEnergyCalendarStartDateCommandParams = new LinkedHashMap(); + InteractionInfo readEnergyCalendarStartDateAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.EnergyCalendarCluster) cluster).readStartDateAttribute( + (ChipClusters.EnergyCalendarCluster.StartDateAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedEnergyCalendarClusterStartDateAttributeCallback(), + readEnergyCalendarStartDateCommandParams + ); + result.put("readStartDateAttribute", readEnergyCalendarStartDateAttributeInteractionInfo); + Map readEnergyCalendarCalendarPeriodsCommandParams = new LinkedHashMap(); + InteractionInfo readEnergyCalendarCalendarPeriodsAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.EnergyCalendarCluster) cluster).readCalendarPeriodsAttribute( + (ChipClusters.EnergyCalendarCluster.CalendarPeriodsAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedEnergyCalendarClusterCalendarPeriodsAttributeCallback(), + readEnergyCalendarCalendarPeriodsCommandParams + ); + result.put("readCalendarPeriodsAttribute", readEnergyCalendarCalendarPeriodsAttributeInteractionInfo); + Map readEnergyCalendarSpecialDaysCommandParams = new LinkedHashMap(); + InteractionInfo readEnergyCalendarSpecialDaysAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.EnergyCalendarCluster) cluster).readSpecialDaysAttribute( + (ChipClusters.EnergyCalendarCluster.SpecialDaysAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedEnergyCalendarClusterSpecialDaysAttributeCallback(), + readEnergyCalendarSpecialDaysCommandParams + ); + result.put("readSpecialDaysAttribute", readEnergyCalendarSpecialDaysAttributeInteractionInfo); + Map readEnergyCalendarGeneratedCommandListCommandParams = new LinkedHashMap(); + InteractionInfo readEnergyCalendarGeneratedCommandListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.EnergyCalendarCluster) cluster).readGeneratedCommandListAttribute( + (ChipClusters.EnergyCalendarCluster.GeneratedCommandListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedEnergyCalendarClusterGeneratedCommandListAttributeCallback(), + readEnergyCalendarGeneratedCommandListCommandParams + ); + result.put("readGeneratedCommandListAttribute", readEnergyCalendarGeneratedCommandListAttributeInteractionInfo); + Map readEnergyCalendarAcceptedCommandListCommandParams = new LinkedHashMap(); + InteractionInfo readEnergyCalendarAcceptedCommandListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.EnergyCalendarCluster) cluster).readAcceptedCommandListAttribute( + (ChipClusters.EnergyCalendarCluster.AcceptedCommandListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedEnergyCalendarClusterAcceptedCommandListAttributeCallback(), + readEnergyCalendarAcceptedCommandListCommandParams + ); + result.put("readAcceptedCommandListAttribute", readEnergyCalendarAcceptedCommandListAttributeInteractionInfo); + Map readEnergyCalendarEventListCommandParams = new LinkedHashMap(); + InteractionInfo readEnergyCalendarEventListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.EnergyCalendarCluster) cluster).readEventListAttribute( + (ChipClusters.EnergyCalendarCluster.EventListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedEnergyCalendarClusterEventListAttributeCallback(), + readEnergyCalendarEventListCommandParams + ); + result.put("readEventListAttribute", readEnergyCalendarEventListAttributeInteractionInfo); + Map readEnergyCalendarAttributeListCommandParams = new LinkedHashMap(); + InteractionInfo readEnergyCalendarAttributeListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.EnergyCalendarCluster) cluster).readAttributeListAttribute( + (ChipClusters.EnergyCalendarCluster.AttributeListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedEnergyCalendarClusterAttributeListAttributeCallback(), + readEnergyCalendarAttributeListCommandParams + ); + result.put("readAttributeListAttribute", readEnergyCalendarAttributeListAttributeInteractionInfo); + Map readEnergyCalendarFeatureMapCommandParams = new LinkedHashMap(); + InteractionInfo readEnergyCalendarFeatureMapAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.EnergyCalendarCluster) cluster).readFeatureMapAttribute( + (ChipClusters.LongAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + readEnergyCalendarFeatureMapCommandParams + ); + result.put("readFeatureMapAttribute", readEnergyCalendarFeatureMapAttributeInteractionInfo); + Map readEnergyCalendarClusterRevisionCommandParams = new LinkedHashMap(); + InteractionInfo readEnergyCalendarClusterRevisionAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.EnergyCalendarCluster) cluster).readClusterRevisionAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readEnergyCalendarClusterRevisionCommandParams + ); + result.put("readClusterRevisionAttribute", readEnergyCalendarClusterRevisionAttributeInteractionInfo); + + return result; + } private static Map readEnergyPreferenceInteractionInfo() { Map result = new LinkedHashMap<>();Map readEnergyPreferenceEnergyBalancesCommandParams = new LinkedHashMap(); InteractionInfo readEnergyPreferenceEnergyBalancesAttributeInteractionInfo = new InteractionInfo( @@ -19639,6 +19786,7 @@ public Map> getReadAttributeMap() { put("messages", readMessagesInteractionInfo()); put("deviceEnergyManagement", readDeviceEnergyManagementInteractionInfo()); put("energyEvse", readEnergyEvseInteractionInfo()); + put("energyCalendar", readEnergyCalendarInteractionInfo()); put("energyPreference", readEnergyPreferenceInteractionInfo()); put("powerTopology", readPowerTopologyInteractionInfo()); put("energyEvseMode", readEnergyEvseModeInteractionInfo()); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java index b61658cc4ef211..c42edcf0a85537 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java @@ -1156,6 +1156,8 @@ public Map> getWriteAttributeMap() { ); writeEnergyEvseInteractionInfo.put("writeApproximateEVEfficiencyAttribute", writeEnergyEvseApproximateEVEfficiencyAttributeInteractionInfo); writeAttributeMap.put("energyEvse", writeEnergyEvseInteractionInfo); + Map writeEnergyCalendarInteractionInfo = new LinkedHashMap<>(); + writeAttributeMap.put("energyCalendar", writeEnergyCalendarInteractionInfo); Map writeEnergyPreferenceInteractionInfo = new LinkedHashMap<>(); Map writeEnergyPreferenceCurrentEnergyBalanceCommandParams = new LinkedHashMap(); CommandParameterInfo energyPreferencecurrentEnergyBalanceCommandParameterInfo = diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni index bbaa6112dd9dea..0a5b9bf25e1ed6 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni @@ -71,6 +71,11 @@ structs_sources = [ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementAccuracyStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementRangeStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterCalendarPeriod.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDate.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterTransitionStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseModeClusterModeOptionStruct.kt", diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterCalendarPeriod.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterCalendarPeriod.kt new file mode 100644 index 00000000000000..f2964f0d0089b7 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterCalendarPeriod.kt @@ -0,0 +1,71 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * 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. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class EnergyCalendarClusterCalendarPeriod( + val startDate: ULong, + val days: List +) { + override fun toString(): String = buildString { + append("EnergyCalendarClusterCalendarPeriod {\n") + append("\tstartDate : $startDate\n") + append("\tdays : $days\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_START_DATE), startDate) + startArray(ContextSpecificTag(TAG_DAYS)) + for (item in days.iterator()) { + item.toTlv(AnonymousTag, this) + } + endArray() + endStructure() + } + } + + companion object { + private const val TAG_START_DATE = 0 + private const val TAG_DAYS = 1 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyCalendarClusterCalendarPeriod { + tlvReader.enterStructure(tlvTag) + val startDate = tlvReader.getULong(ContextSpecificTag(TAG_START_DATE)) + val days = + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_DAYS)) + while (!tlvReader.isEndOfContainer()) { + add(EnergyCalendarClusterDayStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return EnergyCalendarClusterCalendarPeriod(startDate, days) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDate.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDate.kt new file mode 100644 index 00000000000000..82cada7f887767 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDate.kt @@ -0,0 +1,102 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * 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. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import java.util.Optional +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class EnergyCalendarClusterDate( + val year: Optional, + val month: Optional, + val day: Optional, + val dayOfWeek: Optional +) { + override fun toString(): String = buildString { + append("EnergyCalendarClusterDate {\n") + append("\tyear : $year\n") + append("\tmonth : $month\n") + append("\tday : $day\n") + append("\tdayOfWeek : $dayOfWeek\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (year.isPresent) { + val optyear = year.get() + put(ContextSpecificTag(TAG_YEAR), optyear) + } + if (month.isPresent) { + val optmonth = month.get() + put(ContextSpecificTag(TAG_MONTH), optmonth) + } + if (day.isPresent) { + val optday = day.get() + put(ContextSpecificTag(TAG_DAY), optday) + } + if (dayOfWeek.isPresent) { + val optdayOfWeek = dayOfWeek.get() + put(ContextSpecificTag(TAG_DAY_OF_WEEK), optdayOfWeek) + } + endStructure() + } + } + + companion object { + private const val TAG_YEAR = 0 + private const val TAG_MONTH = 1 + private const val TAG_DAY = 2 + private const val TAG_DAY_OF_WEEK = 3 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyCalendarClusterDate { + tlvReader.enterStructure(tlvTag) + val year = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_YEAR))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_YEAR))) + } else { + Optional.empty() + } + val month = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MONTH))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_MONTH))) + } else { + Optional.empty() + } + val day = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_DAY))) + } else { + Optional.empty() + } + val dayOfWeek = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY_OF_WEEK))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_DAY_OF_WEEK))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return EnergyCalendarClusterDate(year, month, day, dayOfWeek) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt new file mode 100644 index 00000000000000..da6e09f467c164 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt @@ -0,0 +1,106 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * 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. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import java.util.Optional +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class EnergyCalendarClusterDayStruct( + val date: Optional, + val daysOfWeek: Optional, + val transitions: List, + val calendarID: Optional +) { + override fun toString(): String = buildString { + append("EnergyCalendarClusterDayStruct {\n") + append("\tdate : $date\n") + append("\tdaysOfWeek : $daysOfWeek\n") + append("\ttransitions : $transitions\n") + append("\tcalendarID : $calendarID\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (date.isPresent) { + val optdate = date.get() + optdate.toTlv(ContextSpecificTag(TAG_DATE), this) + } + if (daysOfWeek.isPresent) { + val optdaysOfWeek = daysOfWeek.get() + put(ContextSpecificTag(TAG_DAYS_OF_WEEK), optdaysOfWeek) + } + startArray(ContextSpecificTag(TAG_TRANSITIONS)) + for (item in transitions.iterator()) { + item.toTlv(AnonymousTag, this) + } + endArray() + if (calendarID.isPresent) { + val optcalendarID = calendarID.get() + put(ContextSpecificTag(TAG_CALENDAR_I_D), optcalendarID) + } + endStructure() + } + } + + companion object { + private const val TAG_DATE = 0 + private const val TAG_DAYS_OF_WEEK = 1 + private const val TAG_TRANSITIONS = 2 + private const val TAG_CALENDAR_I_D = 3 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyCalendarClusterDayStruct { + tlvReader.enterStructure(tlvTag) + val date = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DATE))) { + Optional.of(EnergyCalendarClusterDate.fromTlv(ContextSpecificTag(TAG_DATE), tlvReader)) + } else { + Optional.empty() + } + val daysOfWeek = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAYS_OF_WEEK))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_DAYS_OF_WEEK))) + } else { + Optional.empty() + } + val transitions = + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_TRANSITIONS)) + while (!tlvReader.isEndOfContainer()) { + add(EnergyCalendarClusterTransitionStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + val calendarID = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_CALENDAR_I_D))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_CALENDAR_I_D))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return EnergyCalendarClusterDayStruct(date, daysOfWeek, transitions, calendarID) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt new file mode 100644 index 00000000000000..51125536bd8767 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt @@ -0,0 +1,69 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * 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. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class EnergyCalendarClusterPeakPeriodStruct( + val severity: UInt, + val peakPeriod: UInt, + val startTime: ULong, + val endTime: ULong +) { + override fun toString(): String = buildString { + append("EnergyCalendarClusterPeakPeriodStruct {\n") + append("\tseverity : $severity\n") + append("\tpeakPeriod : $peakPeriod\n") + append("\tstartTime : $startTime\n") + append("\tendTime : $endTime\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_SEVERITY), severity) + put(ContextSpecificTag(TAG_PEAK_PERIOD), peakPeriod) + put(ContextSpecificTag(TAG_START_TIME), startTime) + put(ContextSpecificTag(TAG_END_TIME), endTime) + endStructure() + } + } + + companion object { + private const val TAG_SEVERITY = 0 + private const val TAG_PEAK_PERIOD = 1 + private const val TAG_START_TIME = 2 + private const val TAG_END_TIME = 3 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyCalendarClusterPeakPeriodStruct { + tlvReader.enterStructure(tlvTag) + val severity = tlvReader.getUInt(ContextSpecificTag(TAG_SEVERITY)) + val peakPeriod = tlvReader.getUInt(ContextSpecificTag(TAG_PEAK_PERIOD)) + val startTime = tlvReader.getULong(ContextSpecificTag(TAG_START_TIME)) + val endTime = tlvReader.getULong(ContextSpecificTag(TAG_END_TIME)) + + tlvReader.exitContainer() + + return EnergyCalendarClusterPeakPeriodStruct(severity, peakPeriod, startTime, endTime) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterTransitionStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterTransitionStruct.kt new file mode 100644 index 00000000000000..638158cc7f2b01 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterTransitionStruct.kt @@ -0,0 +1,99 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * 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. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import java.util.Optional +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class EnergyCalendarClusterTransitionStruct( + val transitionTime: UInt, + val priceTier: Optional, + val friendlyCredit: Optional, + val auxiliaryLoad: Optional +) { + override fun toString(): String = buildString { + append("EnergyCalendarClusterTransitionStruct {\n") + append("\ttransitionTime : $transitionTime\n") + append("\tpriceTier : $priceTier\n") + append("\tfriendlyCredit : $friendlyCredit\n") + append("\tauxiliaryLoad : $auxiliaryLoad\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_TRANSITION_TIME), transitionTime) + if (priceTier.isPresent) { + val optpriceTier = priceTier.get() + put(ContextSpecificTag(TAG_PRICE_TIER), optpriceTier) + } + if (friendlyCredit.isPresent) { + val optfriendlyCredit = friendlyCredit.get() + put(ContextSpecificTag(TAG_FRIENDLY_CREDIT), optfriendlyCredit) + } + if (auxiliaryLoad.isPresent) { + val optauxiliaryLoad = auxiliaryLoad.get() + put(ContextSpecificTag(TAG_AUXILIARY_LOAD), optauxiliaryLoad) + } + endStructure() + } + } + + companion object { + private const val TAG_TRANSITION_TIME = 0 + private const val TAG_PRICE_TIER = 1 + private const val TAG_FRIENDLY_CREDIT = 2 + private const val TAG_AUXILIARY_LOAD = 3 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyCalendarClusterTransitionStruct { + tlvReader.enterStructure(tlvTag) + val transitionTime = tlvReader.getUInt(ContextSpecificTag(TAG_TRANSITION_TIME)) + val priceTier = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_PRICE_TIER))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_PRICE_TIER))) + } else { + Optional.empty() + } + val friendlyCredit = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_FRIENDLY_CREDIT))) { + Optional.of(tlvReader.getBoolean(ContextSpecificTag(TAG_FRIENDLY_CREDIT))) + } else { + Optional.empty() + } + val auxiliaryLoad = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_AUXILIARY_LOAD))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_AUXILIARY_LOAD))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return EnergyCalendarClusterTransitionStruct( + transitionTime, + priceTier, + friendlyCredit, + auxiliaryLoad + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyCalendarCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyCalendarCluster.kt new file mode 100644 index 00000000000000..42323e15182912 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyCalendarCluster.kt @@ -0,0 +1,1888 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * 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. + */ + +package matter.controller.cluster.clusters + +import java.time.Duration +import java.util.logging.Level +import java.util.logging.Logger +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.transform +import matter.controller.MatterController +import matter.controller.ReadData +import matter.controller.ReadRequest +import matter.controller.SubscribeRequest +import matter.controller.SubscriptionState +import matter.controller.UIntSubscriptionState +import matter.controller.UShortSubscriptionState +import matter.controller.cluster.structs.* +import matter.controller.model.AttributePath +import matter.tlv.AnonymousTag +import matter.tlv.TlvReader + +class EnergyCalendarCluster( + private val controller: MatterController, + private val endpointId: UShort +) { + class CalendarIDAttribute(val value: UInt?) + + sealed class CalendarIDAttributeSubscriptionState { + data class Success(val value: UInt?) : CalendarIDAttributeSubscriptionState() + + data class Error(val exception: Exception) : CalendarIDAttributeSubscriptionState() + + object SubscriptionEstablished : CalendarIDAttributeSubscriptionState() + } + + class NameAttribute(val value: String?) + + sealed class NameAttributeSubscriptionState { + data class Success(val value: String?) : NameAttributeSubscriptionState() + + data class Error(val exception: Exception) : NameAttributeSubscriptionState() + + object SubscriptionEstablished : NameAttributeSubscriptionState() + } + + class ProviderIDAttribute(val value: UInt?) + + sealed class ProviderIDAttributeSubscriptionState { + data class Success(val value: UInt?) : ProviderIDAttributeSubscriptionState() + + data class Error(val exception: Exception) : ProviderIDAttributeSubscriptionState() + + object SubscriptionEstablished : ProviderIDAttributeSubscriptionState() + } + + class EventIDAttribute(val value: UInt?) + + sealed class EventIDAttributeSubscriptionState { + data class Success(val value: UInt?) : EventIDAttributeSubscriptionState() + + data class Error(val exception: Exception) : EventIDAttributeSubscriptionState() + + object SubscriptionEstablished : EventIDAttributeSubscriptionState() + } + + class StartDateAttribute(val value: UInt?) + + sealed class StartDateAttributeSubscriptionState { + data class Success(val value: UInt?) : StartDateAttributeSubscriptionState() + + data class Error(val exception: Exception) : StartDateAttributeSubscriptionState() + + object SubscriptionEstablished : StartDateAttributeSubscriptionState() + } + + class CalendarPeriodsAttribute(val value: List) + + sealed class CalendarPeriodsAttributeSubscriptionState { + data class Success(val value: List) : + CalendarPeriodsAttributeSubscriptionState() + + data class Error(val exception: Exception) : CalendarPeriodsAttributeSubscriptionState() + + object SubscriptionEstablished : CalendarPeriodsAttributeSubscriptionState() + } + + class SpecialDaysAttribute(val value: List) + + sealed class SpecialDaysAttributeSubscriptionState { + data class Success(val value: List) : + SpecialDaysAttributeSubscriptionState() + + data class Error(val exception: Exception) : SpecialDaysAttributeSubscriptionState() + + object SubscriptionEstablished : SpecialDaysAttributeSubscriptionState() + } + + class CurrentDayAttribute(val value: EnergyCalendarClusterDayStruct?) + + sealed class CurrentDayAttributeSubscriptionState { + data class Success(val value: EnergyCalendarClusterDayStruct?) : + CurrentDayAttributeSubscriptionState() + + data class Error(val exception: Exception) : CurrentDayAttributeSubscriptionState() + + object SubscriptionEstablished : CurrentDayAttributeSubscriptionState() + } + + class NextDayAttribute(val value: EnergyCalendarClusterDayStruct?) + + sealed class NextDayAttributeSubscriptionState { + data class Success(val value: EnergyCalendarClusterDayStruct?) : + NextDayAttributeSubscriptionState() + + data class Error(val exception: Exception) : NextDayAttributeSubscriptionState() + + object SubscriptionEstablished : NextDayAttributeSubscriptionState() + } + + class CurrentTransitionAttribute(val value: EnergyCalendarClusterTransitionStruct?) + + sealed class CurrentTransitionAttributeSubscriptionState { + data class Success(val value: EnergyCalendarClusterTransitionStruct?) : + CurrentTransitionAttributeSubscriptionState() + + data class Error(val exception: Exception) : CurrentTransitionAttributeSubscriptionState() + + object SubscriptionEstablished : CurrentTransitionAttributeSubscriptionState() + } + + class CurrentPeakPeriodAttribute(val value: EnergyCalendarClusterPeakPeriodStruct?) + + sealed class CurrentPeakPeriodAttributeSubscriptionState { + data class Success(val value: EnergyCalendarClusterPeakPeriodStruct?) : + CurrentPeakPeriodAttributeSubscriptionState() + + data class Error(val exception: Exception) : CurrentPeakPeriodAttributeSubscriptionState() + + object SubscriptionEstablished : CurrentPeakPeriodAttributeSubscriptionState() + } + + class NextPeakPeriodAttribute(val value: EnergyCalendarClusterPeakPeriodStruct?) + + sealed class NextPeakPeriodAttributeSubscriptionState { + data class Success(val value: EnergyCalendarClusterPeakPeriodStruct?) : + NextPeakPeriodAttributeSubscriptionState() + + data class Error(val exception: Exception) : NextPeakPeriodAttributeSubscriptionState() + + object SubscriptionEstablished : NextPeakPeriodAttributeSubscriptionState() + } + + class GeneratedCommandListAttribute(val value: List) + + sealed class GeneratedCommandListAttributeSubscriptionState { + data class Success(val value: List) : GeneratedCommandListAttributeSubscriptionState() + + data class Error(val exception: Exception) : GeneratedCommandListAttributeSubscriptionState() + + object SubscriptionEstablished : GeneratedCommandListAttributeSubscriptionState() + } + + class AcceptedCommandListAttribute(val value: List) + + sealed class AcceptedCommandListAttributeSubscriptionState { + data class Success(val value: List) : AcceptedCommandListAttributeSubscriptionState() + + data class Error(val exception: Exception) : AcceptedCommandListAttributeSubscriptionState() + + object SubscriptionEstablished : AcceptedCommandListAttributeSubscriptionState() + } + + class EventListAttribute(val value: List) + + sealed class EventListAttributeSubscriptionState { + data class Success(val value: List) : EventListAttributeSubscriptionState() + + data class Error(val exception: Exception) : EventListAttributeSubscriptionState() + + object SubscriptionEstablished : EventListAttributeSubscriptionState() + } + + class AttributeListAttribute(val value: List) + + sealed class AttributeListAttributeSubscriptionState { + data class Success(val value: List) : AttributeListAttributeSubscriptionState() + + data class Error(val exception: Exception) : AttributeListAttributeSubscriptionState() + + object SubscriptionEstablished : AttributeListAttributeSubscriptionState() + } + + suspend fun readCalendarIDAttribute(): CalendarIDAttribute { + val ATTRIBUTE_ID: UInt = 0u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Calendarid attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt? = + if (!tlvReader.isNull()) { + tlvReader.getUInt(AnonymousTag) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return CalendarIDAttribute(decodedValue) + } + + suspend fun subscribeCalendarIDAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 0u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + CalendarIDAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Calendarid attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt? = + if (!tlvReader.isNull()) { + tlvReader.getUInt(AnonymousTag) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(CalendarIDAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(CalendarIDAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readNameAttribute(): NameAttribute { + val ATTRIBUTE_ID: UInt = 1u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Name attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: String? = + if (!tlvReader.isNull()) { + tlvReader.getString(AnonymousTag) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return NameAttribute(decodedValue) + } + + suspend fun subscribeNameAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 1u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + NameAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Name attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: String? = + if (!tlvReader.isNull()) { + tlvReader.getString(AnonymousTag) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(NameAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(NameAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readProviderIDAttribute(): ProviderIDAttribute { + val ATTRIBUTE_ID: UInt = 2u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Providerid attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt? = + if (!tlvReader.isNull()) { + tlvReader.getUInt(AnonymousTag) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return ProviderIDAttribute(decodedValue) + } + + suspend fun subscribeProviderIDAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 2u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + ProviderIDAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Providerid attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt? = + if (!tlvReader.isNull()) { + tlvReader.getUInt(AnonymousTag) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(ProviderIDAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(ProviderIDAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readEventIDAttribute(): EventIDAttribute { + val ATTRIBUTE_ID: UInt = 3u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Eventid attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt? = + if (!tlvReader.isNull()) { + tlvReader.getUInt(AnonymousTag) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return EventIDAttribute(decodedValue) + } + + suspend fun subscribeEventIDAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 3u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + EventIDAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Eventid attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt? = + if (!tlvReader.isNull()) { + tlvReader.getUInt(AnonymousTag) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(EventIDAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(EventIDAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readStartDateAttribute(): StartDateAttribute { + val ATTRIBUTE_ID: UInt = 4u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Startdate attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt? = + if (!tlvReader.isNull()) { + tlvReader.getUInt(AnonymousTag) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return StartDateAttribute(decodedValue) + } + + suspend fun subscribeStartDateAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 4u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + StartDateAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Startdate attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt? = + if (!tlvReader.isNull()) { + tlvReader.getUInt(AnonymousTag) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(StartDateAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(StartDateAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readCalendarPeriodsAttribute(): CalendarPeriodsAttribute { + val ATTRIBUTE_ID: UInt = 5u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Calendarperiods attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(EnergyCalendarClusterCalendarPeriod.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + + return CalendarPeriodsAttribute(decodedValue) + } + + suspend fun subscribeCalendarPeriodsAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 5u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + CalendarPeriodsAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Calendarperiods attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(EnergyCalendarClusterCalendarPeriod.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + + emit(CalendarPeriodsAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(CalendarPeriodsAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readSpecialDaysAttribute(): SpecialDaysAttribute { + val ATTRIBUTE_ID: UInt = 6u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Specialdays attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(EnergyCalendarClusterDayStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + + return SpecialDaysAttribute(decodedValue) + } + + suspend fun subscribeSpecialDaysAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 6u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + SpecialDaysAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Specialdays attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(EnergyCalendarClusterDayStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + + emit(SpecialDaysAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(SpecialDaysAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readCurrentDayAttribute(): CurrentDayAttribute { + val ATTRIBUTE_ID: UInt = 7u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Currentday attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: EnergyCalendarClusterDayStruct? = + if (!tlvReader.isNull()) { + EnergyCalendarClusterDayStruct.fromTlv(AnonymousTag, tlvReader) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return CurrentDayAttribute(decodedValue) + } + + suspend fun subscribeCurrentDayAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 7u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + CurrentDayAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Currentday attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: EnergyCalendarClusterDayStruct? = + if (!tlvReader.isNull()) { + EnergyCalendarClusterDayStruct.fromTlv(AnonymousTag, tlvReader) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(CurrentDayAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(CurrentDayAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readNextDayAttribute(): NextDayAttribute { + val ATTRIBUTE_ID: UInt = 8u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Nextday attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: EnergyCalendarClusterDayStruct? = + if (!tlvReader.isNull()) { + EnergyCalendarClusterDayStruct.fromTlv(AnonymousTag, tlvReader) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return NextDayAttribute(decodedValue) + } + + suspend fun subscribeNextDayAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 8u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + NextDayAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Nextday attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: EnergyCalendarClusterDayStruct? = + if (!tlvReader.isNull()) { + EnergyCalendarClusterDayStruct.fromTlv(AnonymousTag, tlvReader) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(NextDayAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(NextDayAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readCurrentTransitionAttribute(): CurrentTransitionAttribute { + val ATTRIBUTE_ID: UInt = 9u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Currenttransition attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: EnergyCalendarClusterTransitionStruct? = + if (!tlvReader.isNull()) { + EnergyCalendarClusterTransitionStruct.fromTlv(AnonymousTag, tlvReader) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return CurrentTransitionAttribute(decodedValue) + } + + suspend fun subscribeCurrentTransitionAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 9u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + CurrentTransitionAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Currenttransition attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: EnergyCalendarClusterTransitionStruct? = + if (!tlvReader.isNull()) { + EnergyCalendarClusterTransitionStruct.fromTlv(AnonymousTag, tlvReader) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(CurrentTransitionAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(CurrentTransitionAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readCurrentPeakPeriodAttribute(): CurrentPeakPeriodAttribute { + val ATTRIBUTE_ID: UInt = 10u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Currentpeakperiod attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: EnergyCalendarClusterPeakPeriodStruct? = + if (!tlvReader.isNull()) { + EnergyCalendarClusterPeakPeriodStruct.fromTlv(AnonymousTag, tlvReader) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return CurrentPeakPeriodAttribute(decodedValue) + } + + suspend fun subscribeCurrentPeakPeriodAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 10u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + CurrentPeakPeriodAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Currentpeakperiod attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: EnergyCalendarClusterPeakPeriodStruct? = + if (!tlvReader.isNull()) { + EnergyCalendarClusterPeakPeriodStruct.fromTlv(AnonymousTag, tlvReader) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(CurrentPeakPeriodAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(CurrentPeakPeriodAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readNextPeakPeriodAttribute(): NextPeakPeriodAttribute { + val ATTRIBUTE_ID: UInt = 11u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Nextpeakperiod attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: EnergyCalendarClusterPeakPeriodStruct? = + if (!tlvReader.isNull()) { + EnergyCalendarClusterPeakPeriodStruct.fromTlv(AnonymousTag, tlvReader) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return NextPeakPeriodAttribute(decodedValue) + } + + suspend fun subscribeNextPeakPeriodAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 11u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + NextPeakPeriodAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Nextpeakperiod attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: EnergyCalendarClusterPeakPeriodStruct? = + if (!tlvReader.isNull()) { + EnergyCalendarClusterPeakPeriodStruct.fromTlv(AnonymousTag, tlvReader) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(NextPeakPeriodAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(NextPeakPeriodAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readGeneratedCommandListAttribute(): GeneratedCommandListAttribute { + val ATTRIBUTE_ID: UInt = 65528u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Generatedcommandlist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return GeneratedCommandListAttribute(decodedValue) + } + + suspend fun subscribeGeneratedCommandListAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 65528u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + GeneratedCommandListAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Generatedcommandlist attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(GeneratedCommandListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(GeneratedCommandListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readAcceptedCommandListAttribute(): AcceptedCommandListAttribute { + val ATTRIBUTE_ID: UInt = 65529u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Acceptedcommandlist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return AcceptedCommandListAttribute(decodedValue) + } + + suspend fun subscribeAcceptedCommandListAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 65529u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + AcceptedCommandListAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Acceptedcommandlist attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(AcceptedCommandListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(AcceptedCommandListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readEventListAttribute(): EventListAttribute { + val ATTRIBUTE_ID: UInt = 65530u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Eventlist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return EventListAttribute(decodedValue) + } + + suspend fun subscribeEventListAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 65530u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + EventListAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Eventlist attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(EventListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(EventListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readAttributeListAttribute(): AttributeListAttribute { + val ATTRIBUTE_ID: UInt = 65531u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Attributelist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return AttributeListAttribute(decodedValue) + } + + suspend fun subscribeAttributeListAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 65531u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + AttributeListAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Attributelist attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(AttributeListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(AttributeListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readFeatureMapAttribute(): UInt { + val ATTRIBUTE_ID: UInt = 65532u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Featuremap attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt = tlvReader.getUInt(AnonymousTag) + + return decodedValue + } + + suspend fun subscribeFeatureMapAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 65532u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + UIntSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Featuremap attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt = tlvReader.getUInt(AnonymousTag) + + emit(UIntSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(UIntSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readClusterRevisionAttribute(): UShort { + val ATTRIBUTE_ID: UInt = 65533u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Clusterrevision attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UShort = tlvReader.getUShort(AnonymousTag) + + return decodedValue + } + + suspend fun subscribeClusterRevisionAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 65533u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + UShortSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Clusterrevision attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UShort = tlvReader.getUShort(AnonymousTag) + + emit(UShortSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(UShortSubscriptionState.SubscriptionEstablished) + } + } + } + } + + companion object { + private val logger = Logger.getLogger(EnergyCalendarCluster::class.java.name) + const val CLUSTER_ID: UInt = 154u + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/files.gni b/src/controller/java/generated/java/matter/controller/cluster/files.gni index d1a3d9681b21bf..5017b360c1b24b 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/files.gni +++ b/src/controller/java/generated/java/matter/controller/cluster/files.gni @@ -71,6 +71,11 @@ matter_structs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementAccuracyStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementRangeStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterCalendarPeriod.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDate.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterTransitionStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseModeClusterModeOptionStruct.kt", @@ -283,6 +288,7 @@ matter_clusters_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/EcosystemInformationCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/ElectricalEnergyMeasurementCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/ElectricalPowerMeasurementCluster.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyCalendarCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyEvseCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyEvseModeCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyPreferenceCluster.kt", diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterCalendarPeriod.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterCalendarPeriod.kt new file mode 100644 index 00000000000000..1e4627775af23e --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterCalendarPeriod.kt @@ -0,0 +1,71 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * 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. + */ +package matter.controller.cluster.structs + +import matter.controller.cluster.* +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class EnergyCalendarClusterCalendarPeriod( + val startDate: UInt, + val days: List +) { + override fun toString(): String = buildString { + append("EnergyCalendarClusterCalendarPeriod {\n") + append("\tstartDate : $startDate\n") + append("\tdays : $days\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_START_DATE), startDate) + startArray(ContextSpecificTag(TAG_DAYS)) + for (item in days.iterator()) { + item.toTlv(AnonymousTag, this) + } + endArray() + endStructure() + } + } + + companion object { + private const val TAG_START_DATE = 0 + private const val TAG_DAYS = 1 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyCalendarClusterCalendarPeriod { + tlvReader.enterStructure(tlvTag) + val startDate = tlvReader.getUInt(ContextSpecificTag(TAG_START_DATE)) + val days = + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_DAYS)) + while (!tlvReader.isEndOfContainer()) { + add(EnergyCalendarClusterDayStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return EnergyCalendarClusterCalendarPeriod(startDate, days) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDate.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDate.kt new file mode 100644 index 00000000000000..7080f30a0b1b8c --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDate.kt @@ -0,0 +1,102 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * 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. + */ +package matter.controller.cluster.structs + +import java.util.Optional +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class EnergyCalendarClusterDate( + val year: Optional, + val month: Optional, + val day: Optional, + val dayOfWeek: Optional +) { + override fun toString(): String = buildString { + append("EnergyCalendarClusterDate {\n") + append("\tyear : $year\n") + append("\tmonth : $month\n") + append("\tday : $day\n") + append("\tdayOfWeek : $dayOfWeek\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (year.isPresent) { + val optyear = year.get() + put(ContextSpecificTag(TAG_YEAR), optyear) + } + if (month.isPresent) { + val optmonth = month.get() + put(ContextSpecificTag(TAG_MONTH), optmonth) + } + if (day.isPresent) { + val optday = day.get() + put(ContextSpecificTag(TAG_DAY), optday) + } + if (dayOfWeek.isPresent) { + val optdayOfWeek = dayOfWeek.get() + put(ContextSpecificTag(TAG_DAY_OF_WEEK), optdayOfWeek) + } + endStructure() + } + } + + companion object { + private const val TAG_YEAR = 0 + private const val TAG_MONTH = 1 + private const val TAG_DAY = 2 + private const val TAG_DAY_OF_WEEK = 3 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyCalendarClusterDate { + tlvReader.enterStructure(tlvTag) + val year = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_YEAR))) { + Optional.of(tlvReader.getUShort(ContextSpecificTag(TAG_YEAR))) + } else { + Optional.empty() + } + val month = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MONTH))) { + Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_MONTH))) + } else { + Optional.empty() + } + val day = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY))) { + Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_DAY))) + } else { + Optional.empty() + } + val dayOfWeek = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY_OF_WEEK))) { + Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_DAY_OF_WEEK))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return EnergyCalendarClusterDate(year, month, day, dayOfWeek) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt new file mode 100644 index 00000000000000..c27a9bff26e20b --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt @@ -0,0 +1,106 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * 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. + */ +package matter.controller.cluster.structs + +import java.util.Optional +import matter.controller.cluster.* +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class EnergyCalendarClusterDayStruct( + val date: Optional, + val daysOfWeek: Optional, + val transitions: List, + val calendarID: Optional +) { + override fun toString(): String = buildString { + append("EnergyCalendarClusterDayStruct {\n") + append("\tdate : $date\n") + append("\tdaysOfWeek : $daysOfWeek\n") + append("\ttransitions : $transitions\n") + append("\tcalendarID : $calendarID\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (date.isPresent) { + val optdate = date.get() + optdate.toTlv(ContextSpecificTag(TAG_DATE), this) + } + if (daysOfWeek.isPresent) { + val optdaysOfWeek = daysOfWeek.get() + put(ContextSpecificTag(TAG_DAYS_OF_WEEK), optdaysOfWeek) + } + startArray(ContextSpecificTag(TAG_TRANSITIONS)) + for (item in transitions.iterator()) { + item.toTlv(AnonymousTag, this) + } + endArray() + if (calendarID.isPresent) { + val optcalendarID = calendarID.get() + put(ContextSpecificTag(TAG_CALENDAR_I_D), optcalendarID) + } + endStructure() + } + } + + companion object { + private const val TAG_DATE = 0 + private const val TAG_DAYS_OF_WEEK = 1 + private const val TAG_TRANSITIONS = 2 + private const val TAG_CALENDAR_I_D = 3 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyCalendarClusterDayStruct { + tlvReader.enterStructure(tlvTag) + val date = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DATE))) { + Optional.of(EnergyCalendarClusterDate.fromTlv(ContextSpecificTag(TAG_DATE), tlvReader)) + } else { + Optional.empty() + } + val daysOfWeek = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAYS_OF_WEEK))) { + Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_DAYS_OF_WEEK))) + } else { + Optional.empty() + } + val transitions = + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_TRANSITIONS)) + while (!tlvReader.isEndOfContainer()) { + add(EnergyCalendarClusterTransitionStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + val calendarID = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_CALENDAR_I_D))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_CALENDAR_I_D))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return EnergyCalendarClusterDayStruct(date, daysOfWeek, transitions, calendarID) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt new file mode 100644 index 00000000000000..be9f72ed83e2bf --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt @@ -0,0 +1,69 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * 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. + */ +package matter.controller.cluster.structs + +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class EnergyCalendarClusterPeakPeriodStruct( + val severity: UByte, + val peakPeriod: UShort, + val startTime: UInt, + val endTime: UInt +) { + override fun toString(): String = buildString { + append("EnergyCalendarClusterPeakPeriodStruct {\n") + append("\tseverity : $severity\n") + append("\tpeakPeriod : $peakPeriod\n") + append("\tstartTime : $startTime\n") + append("\tendTime : $endTime\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_SEVERITY), severity) + put(ContextSpecificTag(TAG_PEAK_PERIOD), peakPeriod) + put(ContextSpecificTag(TAG_START_TIME), startTime) + put(ContextSpecificTag(TAG_END_TIME), endTime) + endStructure() + } + } + + companion object { + private const val TAG_SEVERITY = 0 + private const val TAG_PEAK_PERIOD = 1 + private const val TAG_START_TIME = 2 + private const val TAG_END_TIME = 3 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyCalendarClusterPeakPeriodStruct { + tlvReader.enterStructure(tlvTag) + val severity = tlvReader.getUByte(ContextSpecificTag(TAG_SEVERITY)) + val peakPeriod = tlvReader.getUShort(ContextSpecificTag(TAG_PEAK_PERIOD)) + val startTime = tlvReader.getUInt(ContextSpecificTag(TAG_START_TIME)) + val endTime = tlvReader.getUInt(ContextSpecificTag(TAG_END_TIME)) + + tlvReader.exitContainer() + + return EnergyCalendarClusterPeakPeriodStruct(severity, peakPeriod, startTime, endTime) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterTransitionStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterTransitionStruct.kt new file mode 100644 index 00000000000000..48dc3ed1946e1e --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterTransitionStruct.kt @@ -0,0 +1,99 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * 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. + */ +package matter.controller.cluster.structs + +import java.util.Optional +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class EnergyCalendarClusterTransitionStruct( + val transitionTime: UShort, + val priceTier: Optional, + val friendlyCredit: Optional, + val auxiliaryLoad: Optional +) { + override fun toString(): String = buildString { + append("EnergyCalendarClusterTransitionStruct {\n") + append("\ttransitionTime : $transitionTime\n") + append("\tpriceTier : $priceTier\n") + append("\tfriendlyCredit : $friendlyCredit\n") + append("\tauxiliaryLoad : $auxiliaryLoad\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_TRANSITION_TIME), transitionTime) + if (priceTier.isPresent) { + val optpriceTier = priceTier.get() + put(ContextSpecificTag(TAG_PRICE_TIER), optpriceTier) + } + if (friendlyCredit.isPresent) { + val optfriendlyCredit = friendlyCredit.get() + put(ContextSpecificTag(TAG_FRIENDLY_CREDIT), optfriendlyCredit) + } + if (auxiliaryLoad.isPresent) { + val optauxiliaryLoad = auxiliaryLoad.get() + put(ContextSpecificTag(TAG_AUXILIARY_LOAD), optauxiliaryLoad) + } + endStructure() + } + } + + companion object { + private const val TAG_TRANSITION_TIME = 0 + private const val TAG_PRICE_TIER = 1 + private const val TAG_FRIENDLY_CREDIT = 2 + private const val TAG_AUXILIARY_LOAD = 3 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyCalendarClusterTransitionStruct { + tlvReader.enterStructure(tlvTag) + val transitionTime = tlvReader.getUShort(ContextSpecificTag(TAG_TRANSITION_TIME)) + val priceTier = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_PRICE_TIER))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_PRICE_TIER))) + } else { + Optional.empty() + } + val friendlyCredit = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_FRIENDLY_CREDIT))) { + Optional.of(tlvReader.getBoolean(ContextSpecificTag(TAG_FRIENDLY_CREDIT))) + } else { + Optional.empty() + } + val auxiliaryLoad = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_AUXILIARY_LOAD))) { + Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_AUXILIARY_LOAD))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return EnergyCalendarClusterTransitionStruct( + transitionTime, + priceTier, + friendlyCredit, + auxiliaryLoad + ) + } + } +} diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index fbbb5be261737f..3dea3108169254 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -24953,6 +24953,1662 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } break; } + case app::Clusters::EnergyCalendar::Id: { + using namespace app::Clusters::EnergyCalendar; + switch (aPath.mAttributeId) + { + case Attributes::CalendarID::Id: { + using TypeInfo = Attributes::CalendarID::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + } + return value; + } + case Attributes::Name::Id: { + using TypeInfo = Attributes::Name::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + LogErrorOnFailure(chip::JniReferences::GetInstance().CharToStringUTF(cppValue.Value(), value)); + } + return value; + } + case Attributes::ProviderID::Id: { + using TypeInfo = Attributes::ProviderID::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + } + return value; + } + case Attributes::EventID::Id: { + using TypeInfo = Attributes::EventID::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + } + return value; + } + case Attributes::StartDate::Id: { + using TypeInfo = Attributes::StartDate::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + } + return value; + } + case Attributes::CalendarPeriods::Id: { + using TypeInfo = Attributes::CalendarPeriods::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + jobject newElement_0_startDate; + std::string newElement_0_startDateClassName = "java/lang/Long"; + std::string newElement_0_startDateCtorSignature = "(J)V"; + jlong jninewElement_0_startDate = static_cast(entry_0.startDate); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_startDateClassName.c_str(), + newElement_0_startDateCtorSignature.c_str(), + jninewElement_0_startDate, newElement_0_startDate); + jobject newElement_0_days; + chip::JniReferences::GetInstance().CreateArrayList(newElement_0_days); + + auto iter_newElement_0_days_2 = entry_0.days.begin(); + while (iter_newElement_0_days_2.Next()) + { + auto & entry_2 = iter_newElement_0_days_2.GetValue(); + jobject newElement_2; + jobject newElement_2_date; + if (!entry_2.date.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_date); + } + else + { + jobject newElement_2_dateInsideOptional; + jobject newElement_2_dateInsideOptional_year; + if (!entry_2.date.Value().year.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_dateInsideOptional_year); + } + else + { + jobject newElement_2_dateInsideOptional_yearInsideOptional; + std::string newElement_2_dateInsideOptional_yearInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_2_dateInsideOptional_yearInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_2_dateInsideOptional_yearInsideOptional = + static_cast(entry_2.date.Value().year.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_dateInsideOptional_yearInsideOptionalClassName.c_str(), + newElement_2_dateInsideOptional_yearInsideOptionalCtorSignature.c_str(), + jninewElement_2_dateInsideOptional_yearInsideOptional, + newElement_2_dateInsideOptional_yearInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_dateInsideOptional_yearInsideOptional, + newElement_2_dateInsideOptional_year); + } + jobject newElement_2_dateInsideOptional_month; + if (!entry_2.date.Value().month.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_dateInsideOptional_month); + } + else + { + jobject newElement_2_dateInsideOptional_monthInsideOptional; + std::string newElement_2_dateInsideOptional_monthInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_2_dateInsideOptional_monthInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_2_dateInsideOptional_monthInsideOptional = + static_cast(entry_2.date.Value().month.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_dateInsideOptional_monthInsideOptionalClassName.c_str(), + newElement_2_dateInsideOptional_monthInsideOptionalCtorSignature.c_str(), + jninewElement_2_dateInsideOptional_monthInsideOptional, + newElement_2_dateInsideOptional_monthInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_dateInsideOptional_monthInsideOptional, + newElement_2_dateInsideOptional_month); + } + jobject newElement_2_dateInsideOptional_day; + if (!entry_2.date.Value().day.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_dateInsideOptional_day); + } + else + { + jobject newElement_2_dateInsideOptional_dayInsideOptional; + std::string newElement_2_dateInsideOptional_dayInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_2_dateInsideOptional_dayInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_2_dateInsideOptional_dayInsideOptional = + static_cast(entry_2.date.Value().day.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_dateInsideOptional_dayInsideOptionalClassName.c_str(), + newElement_2_dateInsideOptional_dayInsideOptionalCtorSignature.c_str(), + jninewElement_2_dateInsideOptional_dayInsideOptional, + newElement_2_dateInsideOptional_dayInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_dateInsideOptional_dayInsideOptional, + newElement_2_dateInsideOptional_day); + } + jobject newElement_2_dateInsideOptional_dayOfWeek; + if (!entry_2.date.Value().dayOfWeek.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_dateInsideOptional_dayOfWeek); + } + else + { + jobject newElement_2_dateInsideOptional_dayOfWeekInsideOptional; + std::string newElement_2_dateInsideOptional_dayOfWeekInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_2_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_2_dateInsideOptional_dayOfWeekInsideOptional = + static_cast(entry_2.date.Value().dayOfWeek.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_dateInsideOptional_dayOfWeekInsideOptionalClassName.c_str(), + newElement_2_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature.c_str(), + jninewElement_2_dateInsideOptional_dayOfWeekInsideOptional, + newElement_2_dateInsideOptional_dayOfWeekInsideOptional); + chip::JniReferences::GetInstance().CreateOptional( + newElement_2_dateInsideOptional_dayOfWeekInsideOptional, newElement_2_dateInsideOptional_dayOfWeek); + } + + jclass dateStructClass_5; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterDate", dateStructClass_5); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterDate"); + return nullptr; + } + + jmethodID dateStructCtor_5; + err = chip::JniReferences::GetInstance().FindMethod( + env, dateStructClass_5, "", + "(Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V", + &dateStructCtor_5); + if (err != CHIP_NO_ERROR || dateStructCtor_5 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterDate constructor"); + return nullptr; + } + + newElement_2_dateInsideOptional = + env->NewObject(dateStructClass_5, dateStructCtor_5, newElement_2_dateInsideOptional_year, + newElement_2_dateInsideOptional_month, newElement_2_dateInsideOptional_day, + newElement_2_dateInsideOptional_dayOfWeek); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_dateInsideOptional, newElement_2_date); + } + jobject newElement_2_daysOfWeek; + if (!entry_2.daysOfWeek.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_daysOfWeek); + } + else + { + jobject newElement_2_daysOfWeekInsideOptional; + std::string newElement_2_daysOfWeekInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_2_daysOfWeekInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_2_daysOfWeekInsideOptional = static_cast(entry_2.daysOfWeek.Value().Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_daysOfWeekInsideOptionalClassName.c_str(), + newElement_2_daysOfWeekInsideOptionalCtorSignature.c_str(), jninewElement_2_daysOfWeekInsideOptional, + newElement_2_daysOfWeekInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_daysOfWeekInsideOptional, + newElement_2_daysOfWeek); + } + jobject newElement_2_transitions; + chip::JniReferences::GetInstance().CreateArrayList(newElement_2_transitions); + + auto iter_newElement_2_transitions_4 = entry_2.transitions.begin(); + while (iter_newElement_2_transitions_4.Next()) + { + auto & entry_4 = iter_newElement_2_transitions_4.GetValue(); + jobject newElement_4; + jobject newElement_4_transitionTime; + std::string newElement_4_transitionTimeClassName = "java/lang/Integer"; + std::string newElement_4_transitionTimeCtorSignature = "(I)V"; + jint jninewElement_4_transitionTime = static_cast(entry_4.transitionTime); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_4_transitionTimeClassName.c_str(), newElement_4_transitionTimeCtorSignature.c_str(), + jninewElement_4_transitionTime, newElement_4_transitionTime); + jobject newElement_4_priceTier; + if (!entry_4.priceTier.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_4_priceTier); + } + else + { + jobject newElement_4_priceTierInsideOptional; + std::string newElement_4_priceTierInsideOptionalClassName = "java/lang/Long"; + std::string newElement_4_priceTierInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_4_priceTierInsideOptional = static_cast(entry_4.priceTier.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_4_priceTierInsideOptionalClassName.c_str(), + newElement_4_priceTierInsideOptionalCtorSignature.c_str(), jninewElement_4_priceTierInsideOptional, + newElement_4_priceTierInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_4_priceTierInsideOptional, + newElement_4_priceTier); + } + jobject newElement_4_friendlyCredit; + if (!entry_4.friendlyCredit.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_4_friendlyCredit); + } + else + { + jobject newElement_4_friendlyCreditInsideOptional; + std::string newElement_4_friendlyCreditInsideOptionalClassName = "java/lang/Boolean"; + std::string newElement_4_friendlyCreditInsideOptionalCtorSignature = "(Z)V"; + jboolean jninewElement_4_friendlyCreditInsideOptional = + static_cast(entry_4.friendlyCredit.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_4_friendlyCreditInsideOptionalClassName.c_str(), + newElement_4_friendlyCreditInsideOptionalCtorSignature.c_str(), + jninewElement_4_friendlyCreditInsideOptional, newElement_4_friendlyCreditInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_4_friendlyCreditInsideOptional, + newElement_4_friendlyCredit); + } + jobject newElement_4_auxiliaryLoad; + if (!entry_4.auxiliaryLoad.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_4_auxiliaryLoad); + } + else + { + jobject newElement_4_auxiliaryLoadInsideOptional; + std::string newElement_4_auxiliaryLoadInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_4_auxiliaryLoadInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_4_auxiliaryLoadInsideOptional = + static_cast(entry_4.auxiliaryLoad.Value().Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_4_auxiliaryLoadInsideOptionalClassName.c_str(), + newElement_4_auxiliaryLoadInsideOptionalCtorSignature.c_str(), + jninewElement_4_auxiliaryLoadInsideOptional, newElement_4_auxiliaryLoadInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_4_auxiliaryLoadInsideOptional, + newElement_4_auxiliaryLoad); + } + + jclass transitionStructStructClass_5; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterTransitionStruct", + transitionStructStructClass_5); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterTransitionStruct"); + return nullptr; + } + + jmethodID transitionStructStructCtor_5; + err = chip::JniReferences::GetInstance().FindMethod( + env, transitionStructStructClass_5, "", + "(Ljava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V", + &transitionStructStructCtor_5); + if (err != CHIP_NO_ERROR || transitionStructStructCtor_5 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterTransitionStruct constructor"); + return nullptr; + } + + newElement_4 = + env->NewObject(transitionStructStructClass_5, transitionStructStructCtor_5, newElement_4_transitionTime, + newElement_4_priceTier, newElement_4_friendlyCredit, newElement_4_auxiliaryLoad); + chip::JniReferences::GetInstance().AddToList(newElement_2_transitions, newElement_4); + } + jobject newElement_2_calendarID; + if (!entry_2.calendarID.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_calendarID); + } + else + { + jobject newElement_2_calendarIDInsideOptional; + std::string newElement_2_calendarIDInsideOptionalClassName = "java/lang/Long"; + std::string newElement_2_calendarIDInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_2_calendarIDInsideOptional = static_cast(entry_2.calendarID.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_calendarIDInsideOptionalClassName.c_str(), + newElement_2_calendarIDInsideOptionalCtorSignature.c_str(), jninewElement_2_calendarIDInsideOptional, + newElement_2_calendarIDInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_calendarIDInsideOptional, + newElement_2_calendarID); + } + + jclass dayStructStructClass_3; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterDayStruct", dayStructStructClass_3); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterDayStruct"); + return nullptr; + } + + jmethodID dayStructStructCtor_3; + err = chip::JniReferences::GetInstance().FindMethod( + env, dayStructStructClass_3, "", + "(Ljava/util/Optional;Ljava/util/Optional;Ljava/util/ArrayList;Ljava/util/Optional;)V", + &dayStructStructCtor_3); + if (err != CHIP_NO_ERROR || dayStructStructCtor_3 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterDayStruct constructor"); + return nullptr; + } + + newElement_2 = env->NewObject(dayStructStructClass_3, dayStructStructCtor_3, newElement_2_date, + newElement_2_daysOfWeek, newElement_2_transitions, newElement_2_calendarID); + chip::JniReferences::GetInstance().AddToList(newElement_0_days, newElement_2); + } + + jclass calendarPeriodStructClass_1; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterCalendarPeriod", calendarPeriodStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterCalendarPeriod"); + return nullptr; + } + + jmethodID calendarPeriodStructCtor_1; + err = chip::JniReferences::GetInstance().FindMethod(env, calendarPeriodStructClass_1, "", + "(Ljava/lang/Long;Ljava/util/ArrayList;)V", + &calendarPeriodStructCtor_1); + if (err != CHIP_NO_ERROR || calendarPeriodStructCtor_1 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterCalendarPeriod constructor"); + return nullptr; + } + + newElement_0 = env->NewObject(calendarPeriodStructClass_1, calendarPeriodStructCtor_1, newElement_0_startDate, + newElement_0_days); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::SpecialDays::Id: { + using TypeInfo = Attributes::SpecialDays::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + jobject newElement_0_date; + if (!entry_0.date.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_date); + } + else + { + jobject newElement_0_dateInsideOptional; + jobject newElement_0_dateInsideOptional_year; + if (!entry_0.date.Value().year.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_dateInsideOptional_year); + } + else + { + jobject newElement_0_dateInsideOptional_yearInsideOptional; + std::string newElement_0_dateInsideOptional_yearInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_0_dateInsideOptional_yearInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_0_dateInsideOptional_yearInsideOptional = + static_cast(entry_0.date.Value().year.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_dateInsideOptional_yearInsideOptionalClassName.c_str(), + newElement_0_dateInsideOptional_yearInsideOptionalCtorSignature.c_str(), + jninewElement_0_dateInsideOptional_yearInsideOptional, + newElement_0_dateInsideOptional_yearInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_dateInsideOptional_yearInsideOptional, + newElement_0_dateInsideOptional_year); + } + jobject newElement_0_dateInsideOptional_month; + if (!entry_0.date.Value().month.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_dateInsideOptional_month); + } + else + { + jobject newElement_0_dateInsideOptional_monthInsideOptional; + std::string newElement_0_dateInsideOptional_monthInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_0_dateInsideOptional_monthInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_0_dateInsideOptional_monthInsideOptional = + static_cast(entry_0.date.Value().month.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_dateInsideOptional_monthInsideOptionalClassName.c_str(), + newElement_0_dateInsideOptional_monthInsideOptionalCtorSignature.c_str(), + jninewElement_0_dateInsideOptional_monthInsideOptional, + newElement_0_dateInsideOptional_monthInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_dateInsideOptional_monthInsideOptional, + newElement_0_dateInsideOptional_month); + } + jobject newElement_0_dateInsideOptional_day; + if (!entry_0.date.Value().day.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_dateInsideOptional_day); + } + else + { + jobject newElement_0_dateInsideOptional_dayInsideOptional; + std::string newElement_0_dateInsideOptional_dayInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_0_dateInsideOptional_dayInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_0_dateInsideOptional_dayInsideOptional = + static_cast(entry_0.date.Value().day.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_dateInsideOptional_dayInsideOptionalClassName.c_str(), + newElement_0_dateInsideOptional_dayInsideOptionalCtorSignature.c_str(), + jninewElement_0_dateInsideOptional_dayInsideOptional, + newElement_0_dateInsideOptional_dayInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_dateInsideOptional_dayInsideOptional, + newElement_0_dateInsideOptional_day); + } + jobject newElement_0_dateInsideOptional_dayOfWeek; + if (!entry_0.date.Value().dayOfWeek.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_dateInsideOptional_dayOfWeek); + } + else + { + jobject newElement_0_dateInsideOptional_dayOfWeekInsideOptional; + std::string newElement_0_dateInsideOptional_dayOfWeekInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_0_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_0_dateInsideOptional_dayOfWeekInsideOptional = + static_cast(entry_0.date.Value().dayOfWeek.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_dateInsideOptional_dayOfWeekInsideOptionalClassName.c_str(), + newElement_0_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature.c_str(), + jninewElement_0_dateInsideOptional_dayOfWeekInsideOptional, + newElement_0_dateInsideOptional_dayOfWeekInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_dateInsideOptional_dayOfWeekInsideOptional, + newElement_0_dateInsideOptional_dayOfWeek); + } + + jclass dateStructClass_3; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterDate", dateStructClass_3); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterDate"); + return nullptr; + } + + jmethodID dateStructCtor_3; + err = chip::JniReferences::GetInstance().FindMethod( + env, dateStructClass_3, "", + "(Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V", &dateStructCtor_3); + if (err != CHIP_NO_ERROR || dateStructCtor_3 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterDate constructor"); + return nullptr; + } + + newElement_0_dateInsideOptional = + env->NewObject(dateStructClass_3, dateStructCtor_3, newElement_0_dateInsideOptional_year, + newElement_0_dateInsideOptional_month, newElement_0_dateInsideOptional_day, + newElement_0_dateInsideOptional_dayOfWeek); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_dateInsideOptional, newElement_0_date); + } + jobject newElement_0_daysOfWeek; + if (!entry_0.daysOfWeek.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_daysOfWeek); + } + else + { + jobject newElement_0_daysOfWeekInsideOptional; + std::string newElement_0_daysOfWeekInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_0_daysOfWeekInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_0_daysOfWeekInsideOptional = static_cast(entry_0.daysOfWeek.Value().Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_daysOfWeekInsideOptionalClassName.c_str(), + newElement_0_daysOfWeekInsideOptionalCtorSignature.c_str(), jninewElement_0_daysOfWeekInsideOptional, + newElement_0_daysOfWeekInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_daysOfWeekInsideOptional, + newElement_0_daysOfWeek); + } + jobject newElement_0_transitions; + chip::JniReferences::GetInstance().CreateArrayList(newElement_0_transitions); + + auto iter_newElement_0_transitions_2 = entry_0.transitions.begin(); + while (iter_newElement_0_transitions_2.Next()) + { + auto & entry_2 = iter_newElement_0_transitions_2.GetValue(); + jobject newElement_2; + jobject newElement_2_transitionTime; + std::string newElement_2_transitionTimeClassName = "java/lang/Integer"; + std::string newElement_2_transitionTimeCtorSignature = "(I)V"; + jint jninewElement_2_transitionTime = static_cast(entry_2.transitionTime); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_transitionTimeClassName.c_str(), newElement_2_transitionTimeCtorSignature.c_str(), + jninewElement_2_transitionTime, newElement_2_transitionTime); + jobject newElement_2_priceTier; + if (!entry_2.priceTier.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_priceTier); + } + else + { + jobject newElement_2_priceTierInsideOptional; + std::string newElement_2_priceTierInsideOptionalClassName = "java/lang/Long"; + std::string newElement_2_priceTierInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_2_priceTierInsideOptional = static_cast(entry_2.priceTier.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_priceTierInsideOptionalClassName.c_str(), + newElement_2_priceTierInsideOptionalCtorSignature.c_str(), jninewElement_2_priceTierInsideOptional, + newElement_2_priceTierInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_priceTierInsideOptional, + newElement_2_priceTier); + } + jobject newElement_2_friendlyCredit; + if (!entry_2.friendlyCredit.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_friendlyCredit); + } + else + { + jobject newElement_2_friendlyCreditInsideOptional; + std::string newElement_2_friendlyCreditInsideOptionalClassName = "java/lang/Boolean"; + std::string newElement_2_friendlyCreditInsideOptionalCtorSignature = "(Z)V"; + jboolean jninewElement_2_friendlyCreditInsideOptional = + static_cast(entry_2.friendlyCredit.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_friendlyCreditInsideOptionalClassName.c_str(), + newElement_2_friendlyCreditInsideOptionalCtorSignature.c_str(), + jninewElement_2_friendlyCreditInsideOptional, newElement_2_friendlyCreditInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_friendlyCreditInsideOptional, + newElement_2_friendlyCredit); + } + jobject newElement_2_auxiliaryLoad; + if (!entry_2.auxiliaryLoad.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_auxiliaryLoad); + } + else + { + jobject newElement_2_auxiliaryLoadInsideOptional; + std::string newElement_2_auxiliaryLoadInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_2_auxiliaryLoadInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_2_auxiliaryLoadInsideOptional = static_cast(entry_2.auxiliaryLoad.Value().Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_auxiliaryLoadInsideOptionalClassName.c_str(), + newElement_2_auxiliaryLoadInsideOptionalCtorSignature.c_str(), + jninewElement_2_auxiliaryLoadInsideOptional, newElement_2_auxiliaryLoadInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_auxiliaryLoadInsideOptional, + newElement_2_auxiliaryLoad); + } + + jclass transitionStructStructClass_3; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterTransitionStruct", + transitionStructStructClass_3); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterTransitionStruct"); + return nullptr; + } + + jmethodID transitionStructStructCtor_3; + err = chip::JniReferences::GetInstance().FindMethod( + env, transitionStructStructClass_3, "", + "(Ljava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V", + &transitionStructStructCtor_3); + if (err != CHIP_NO_ERROR || transitionStructStructCtor_3 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterTransitionStruct constructor"); + return nullptr; + } + + newElement_2 = + env->NewObject(transitionStructStructClass_3, transitionStructStructCtor_3, newElement_2_transitionTime, + newElement_2_priceTier, newElement_2_friendlyCredit, newElement_2_auxiliaryLoad); + chip::JniReferences::GetInstance().AddToList(newElement_0_transitions, newElement_2); + } + jobject newElement_0_calendarID; + if (!entry_0.calendarID.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_calendarID); + } + else + { + jobject newElement_0_calendarIDInsideOptional; + std::string newElement_0_calendarIDInsideOptionalClassName = "java/lang/Long"; + std::string newElement_0_calendarIDInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_0_calendarIDInsideOptional = static_cast(entry_0.calendarID.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_calendarIDInsideOptionalClassName.c_str(), + newElement_0_calendarIDInsideOptionalCtorSignature.c_str(), jninewElement_0_calendarIDInsideOptional, + newElement_0_calendarIDInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_calendarIDInsideOptional, + newElement_0_calendarID); + } + + jclass dayStructStructClass_1; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterDayStruct", dayStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterDayStruct"); + return nullptr; + } + + jmethodID dayStructStructCtor_1; + err = chip::JniReferences::GetInstance().FindMethod( + env, dayStructStructClass_1, "", + "(Ljava/util/Optional;Ljava/util/Optional;Ljava/util/ArrayList;Ljava/util/Optional;)V", &dayStructStructCtor_1); + if (err != CHIP_NO_ERROR || dayStructStructCtor_1 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterDayStruct constructor"); + return nullptr; + } + + newElement_0 = env->NewObject(dayStructStructClass_1, dayStructStructCtor_1, newElement_0_date, + newElement_0_daysOfWeek, newElement_0_transitions, newElement_0_calendarID); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::CurrentDay::Id: { + using TypeInfo = Attributes::CurrentDay::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + jobject value_date; + if (!cppValue.Value().date.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_date); + } + else + { + jobject value_dateInsideOptional; + jobject value_dateInsideOptional_year; + if (!cppValue.Value().date.Value().year.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_dateInsideOptional_year); + } + else + { + jobject value_dateInsideOptional_yearInsideOptional; + std::string value_dateInsideOptional_yearInsideOptionalClassName = "java/lang/Integer"; + std::string value_dateInsideOptional_yearInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_dateInsideOptional_yearInsideOptional = + static_cast(cppValue.Value().date.Value().year.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dateInsideOptional_yearInsideOptionalClassName.c_str(), + value_dateInsideOptional_yearInsideOptionalCtorSignature.c_str(), + jnivalue_dateInsideOptional_yearInsideOptional, value_dateInsideOptional_yearInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional_yearInsideOptional, + value_dateInsideOptional_year); + } + jobject value_dateInsideOptional_month; + if (!cppValue.Value().date.Value().month.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_dateInsideOptional_month); + } + else + { + jobject value_dateInsideOptional_monthInsideOptional; + std::string value_dateInsideOptional_monthInsideOptionalClassName = "java/lang/Integer"; + std::string value_dateInsideOptional_monthInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_dateInsideOptional_monthInsideOptional = + static_cast(cppValue.Value().date.Value().month.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dateInsideOptional_monthInsideOptionalClassName.c_str(), + value_dateInsideOptional_monthInsideOptionalCtorSignature.c_str(), + jnivalue_dateInsideOptional_monthInsideOptional, value_dateInsideOptional_monthInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional_monthInsideOptional, + value_dateInsideOptional_month); + } + jobject value_dateInsideOptional_day; + if (!cppValue.Value().date.Value().day.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_dateInsideOptional_day); + } + else + { + jobject value_dateInsideOptional_dayInsideOptional; + std::string value_dateInsideOptional_dayInsideOptionalClassName = "java/lang/Integer"; + std::string value_dateInsideOptional_dayInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_dateInsideOptional_dayInsideOptional = + static_cast(cppValue.Value().date.Value().day.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dateInsideOptional_dayInsideOptionalClassName.c_str(), + value_dateInsideOptional_dayInsideOptionalCtorSignature.c_str(), + jnivalue_dateInsideOptional_dayInsideOptional, value_dateInsideOptional_dayInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional_dayInsideOptional, + value_dateInsideOptional_day); + } + jobject value_dateInsideOptional_dayOfWeek; + if (!cppValue.Value().date.Value().dayOfWeek.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_dateInsideOptional_dayOfWeek); + } + else + { + jobject value_dateInsideOptional_dayOfWeekInsideOptional; + std::string value_dateInsideOptional_dayOfWeekInsideOptionalClassName = "java/lang/Integer"; + std::string value_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_dateInsideOptional_dayOfWeekInsideOptional = + static_cast(cppValue.Value().date.Value().dayOfWeek.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dateInsideOptional_dayOfWeekInsideOptionalClassName.c_str(), + value_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature.c_str(), + jnivalue_dateInsideOptional_dayOfWeekInsideOptional, value_dateInsideOptional_dayOfWeekInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional_dayOfWeekInsideOptional, + value_dateInsideOptional_dayOfWeek); + } + + jclass dateStructClass_3; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterDate", dateStructClass_3); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterDate"); + return nullptr; + } + + jmethodID dateStructCtor_3; + err = chip::JniReferences::GetInstance().FindMethod( + env, dateStructClass_3, "", + "(Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V", &dateStructCtor_3); + if (err != CHIP_NO_ERROR || dateStructCtor_3 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterDate constructor"); + return nullptr; + } + + value_dateInsideOptional = env->NewObject(dateStructClass_3, dateStructCtor_3, value_dateInsideOptional_year, + value_dateInsideOptional_month, value_dateInsideOptional_day, + value_dateInsideOptional_dayOfWeek); + chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional, value_date); + } + jobject value_daysOfWeek; + if (!cppValue.Value().daysOfWeek.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_daysOfWeek); + } + else + { + jobject value_daysOfWeekInsideOptional; + std::string value_daysOfWeekInsideOptionalClassName = "java/lang/Integer"; + std::string value_daysOfWeekInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_daysOfWeekInsideOptional = static_cast(cppValue.Value().daysOfWeek.Value().Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_daysOfWeekInsideOptionalClassName.c_str(), value_daysOfWeekInsideOptionalCtorSignature.c_str(), + jnivalue_daysOfWeekInsideOptional, value_daysOfWeekInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_daysOfWeekInsideOptional, value_daysOfWeek); + } + jobject value_transitions; + chip::JniReferences::GetInstance().CreateArrayList(value_transitions); + + auto iter_value_transitions_2 = cppValue.Value().transitions.begin(); + while (iter_value_transitions_2.Next()) + { + auto & entry_2 = iter_value_transitions_2.GetValue(); + jobject newElement_2; + jobject newElement_2_transitionTime; + std::string newElement_2_transitionTimeClassName = "java/lang/Integer"; + std::string newElement_2_transitionTimeCtorSignature = "(I)V"; + jint jninewElement_2_transitionTime = static_cast(entry_2.transitionTime); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_transitionTimeClassName.c_str(), newElement_2_transitionTimeCtorSignature.c_str(), + jninewElement_2_transitionTime, newElement_2_transitionTime); + jobject newElement_2_priceTier; + if (!entry_2.priceTier.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_priceTier); + } + else + { + jobject newElement_2_priceTierInsideOptional; + std::string newElement_2_priceTierInsideOptionalClassName = "java/lang/Long"; + std::string newElement_2_priceTierInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_2_priceTierInsideOptional = static_cast(entry_2.priceTier.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_priceTierInsideOptionalClassName.c_str(), + newElement_2_priceTierInsideOptionalCtorSignature.c_str(), jninewElement_2_priceTierInsideOptional, + newElement_2_priceTierInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_priceTierInsideOptional, + newElement_2_priceTier); + } + jobject newElement_2_friendlyCredit; + if (!entry_2.friendlyCredit.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_friendlyCredit); + } + else + { + jobject newElement_2_friendlyCreditInsideOptional; + std::string newElement_2_friendlyCreditInsideOptionalClassName = "java/lang/Boolean"; + std::string newElement_2_friendlyCreditInsideOptionalCtorSignature = "(Z)V"; + jboolean jninewElement_2_friendlyCreditInsideOptional = + static_cast(entry_2.friendlyCredit.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_friendlyCreditInsideOptionalClassName.c_str(), + newElement_2_friendlyCreditInsideOptionalCtorSignature.c_str(), + jninewElement_2_friendlyCreditInsideOptional, newElement_2_friendlyCreditInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_friendlyCreditInsideOptional, + newElement_2_friendlyCredit); + } + jobject newElement_2_auxiliaryLoad; + if (!entry_2.auxiliaryLoad.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_auxiliaryLoad); + } + else + { + jobject newElement_2_auxiliaryLoadInsideOptional; + std::string newElement_2_auxiliaryLoadInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_2_auxiliaryLoadInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_2_auxiliaryLoadInsideOptional = static_cast(entry_2.auxiliaryLoad.Value().Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_auxiliaryLoadInsideOptionalClassName.c_str(), + newElement_2_auxiliaryLoadInsideOptionalCtorSignature.c_str(), + jninewElement_2_auxiliaryLoadInsideOptional, newElement_2_auxiliaryLoadInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_auxiliaryLoadInsideOptional, + newElement_2_auxiliaryLoad); + } + + jclass transitionStructStructClass_3; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterTransitionStruct", + transitionStructStructClass_3); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterTransitionStruct"); + return nullptr; + } + + jmethodID transitionStructStructCtor_3; + err = chip::JniReferences::GetInstance().FindMethod( + env, transitionStructStructClass_3, "", + "(Ljava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V", + &transitionStructStructCtor_3); + if (err != CHIP_NO_ERROR || transitionStructStructCtor_3 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterTransitionStruct constructor"); + return nullptr; + } + + newElement_2 = + env->NewObject(transitionStructStructClass_3, transitionStructStructCtor_3, newElement_2_transitionTime, + newElement_2_priceTier, newElement_2_friendlyCredit, newElement_2_auxiliaryLoad); + chip::JniReferences::GetInstance().AddToList(value_transitions, newElement_2); + } + jobject value_calendarID; + if (!cppValue.Value().calendarID.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_calendarID); + } + else + { + jobject value_calendarIDInsideOptional; + std::string value_calendarIDInsideOptionalClassName = "java/lang/Long"; + std::string value_calendarIDInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_calendarIDInsideOptional = static_cast(cppValue.Value().calendarID.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_calendarIDInsideOptionalClassName.c_str(), value_calendarIDInsideOptionalCtorSignature.c_str(), + jnivalue_calendarIDInsideOptional, value_calendarIDInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_calendarIDInsideOptional, value_calendarID); + } + + jclass dayStructStructClass_1; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterDayStruct", dayStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterDayStruct"); + return nullptr; + } + + jmethodID dayStructStructCtor_1; + err = chip::JniReferences::GetInstance().FindMethod( + env, dayStructStructClass_1, "", + "(Ljava/util/Optional;Ljava/util/Optional;Ljava/util/ArrayList;Ljava/util/Optional;)V", &dayStructStructCtor_1); + if (err != CHIP_NO_ERROR || dayStructStructCtor_1 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterDayStruct constructor"); + return nullptr; + } + + value = env->NewObject(dayStructStructClass_1, dayStructStructCtor_1, value_date, value_daysOfWeek, + value_transitions, value_calendarID); + } + return value; + } + case Attributes::NextDay::Id: { + using TypeInfo = Attributes::NextDay::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + jobject value_date; + if (!cppValue.Value().date.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_date); + } + else + { + jobject value_dateInsideOptional; + jobject value_dateInsideOptional_year; + if (!cppValue.Value().date.Value().year.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_dateInsideOptional_year); + } + else + { + jobject value_dateInsideOptional_yearInsideOptional; + std::string value_dateInsideOptional_yearInsideOptionalClassName = "java/lang/Integer"; + std::string value_dateInsideOptional_yearInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_dateInsideOptional_yearInsideOptional = + static_cast(cppValue.Value().date.Value().year.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dateInsideOptional_yearInsideOptionalClassName.c_str(), + value_dateInsideOptional_yearInsideOptionalCtorSignature.c_str(), + jnivalue_dateInsideOptional_yearInsideOptional, value_dateInsideOptional_yearInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional_yearInsideOptional, + value_dateInsideOptional_year); + } + jobject value_dateInsideOptional_month; + if (!cppValue.Value().date.Value().month.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_dateInsideOptional_month); + } + else + { + jobject value_dateInsideOptional_monthInsideOptional; + std::string value_dateInsideOptional_monthInsideOptionalClassName = "java/lang/Integer"; + std::string value_dateInsideOptional_monthInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_dateInsideOptional_monthInsideOptional = + static_cast(cppValue.Value().date.Value().month.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dateInsideOptional_monthInsideOptionalClassName.c_str(), + value_dateInsideOptional_monthInsideOptionalCtorSignature.c_str(), + jnivalue_dateInsideOptional_monthInsideOptional, value_dateInsideOptional_monthInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional_monthInsideOptional, + value_dateInsideOptional_month); + } + jobject value_dateInsideOptional_day; + if (!cppValue.Value().date.Value().day.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_dateInsideOptional_day); + } + else + { + jobject value_dateInsideOptional_dayInsideOptional; + std::string value_dateInsideOptional_dayInsideOptionalClassName = "java/lang/Integer"; + std::string value_dateInsideOptional_dayInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_dateInsideOptional_dayInsideOptional = + static_cast(cppValue.Value().date.Value().day.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dateInsideOptional_dayInsideOptionalClassName.c_str(), + value_dateInsideOptional_dayInsideOptionalCtorSignature.c_str(), + jnivalue_dateInsideOptional_dayInsideOptional, value_dateInsideOptional_dayInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional_dayInsideOptional, + value_dateInsideOptional_day); + } + jobject value_dateInsideOptional_dayOfWeek; + if (!cppValue.Value().date.Value().dayOfWeek.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_dateInsideOptional_dayOfWeek); + } + else + { + jobject value_dateInsideOptional_dayOfWeekInsideOptional; + std::string value_dateInsideOptional_dayOfWeekInsideOptionalClassName = "java/lang/Integer"; + std::string value_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_dateInsideOptional_dayOfWeekInsideOptional = + static_cast(cppValue.Value().date.Value().dayOfWeek.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dateInsideOptional_dayOfWeekInsideOptionalClassName.c_str(), + value_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature.c_str(), + jnivalue_dateInsideOptional_dayOfWeekInsideOptional, value_dateInsideOptional_dayOfWeekInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional_dayOfWeekInsideOptional, + value_dateInsideOptional_dayOfWeek); + } + + jclass dateStructClass_3; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterDate", dateStructClass_3); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterDate"); + return nullptr; + } + + jmethodID dateStructCtor_3; + err = chip::JniReferences::GetInstance().FindMethod( + env, dateStructClass_3, "", + "(Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V", &dateStructCtor_3); + if (err != CHIP_NO_ERROR || dateStructCtor_3 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterDate constructor"); + return nullptr; + } + + value_dateInsideOptional = env->NewObject(dateStructClass_3, dateStructCtor_3, value_dateInsideOptional_year, + value_dateInsideOptional_month, value_dateInsideOptional_day, + value_dateInsideOptional_dayOfWeek); + chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional, value_date); + } + jobject value_daysOfWeek; + if (!cppValue.Value().daysOfWeek.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_daysOfWeek); + } + else + { + jobject value_daysOfWeekInsideOptional; + std::string value_daysOfWeekInsideOptionalClassName = "java/lang/Integer"; + std::string value_daysOfWeekInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_daysOfWeekInsideOptional = static_cast(cppValue.Value().daysOfWeek.Value().Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_daysOfWeekInsideOptionalClassName.c_str(), value_daysOfWeekInsideOptionalCtorSignature.c_str(), + jnivalue_daysOfWeekInsideOptional, value_daysOfWeekInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_daysOfWeekInsideOptional, value_daysOfWeek); + } + jobject value_transitions; + chip::JniReferences::GetInstance().CreateArrayList(value_transitions); + + auto iter_value_transitions_2 = cppValue.Value().transitions.begin(); + while (iter_value_transitions_2.Next()) + { + auto & entry_2 = iter_value_transitions_2.GetValue(); + jobject newElement_2; + jobject newElement_2_transitionTime; + std::string newElement_2_transitionTimeClassName = "java/lang/Integer"; + std::string newElement_2_transitionTimeCtorSignature = "(I)V"; + jint jninewElement_2_transitionTime = static_cast(entry_2.transitionTime); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_transitionTimeClassName.c_str(), newElement_2_transitionTimeCtorSignature.c_str(), + jninewElement_2_transitionTime, newElement_2_transitionTime); + jobject newElement_2_priceTier; + if (!entry_2.priceTier.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_priceTier); + } + else + { + jobject newElement_2_priceTierInsideOptional; + std::string newElement_2_priceTierInsideOptionalClassName = "java/lang/Long"; + std::string newElement_2_priceTierInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_2_priceTierInsideOptional = static_cast(entry_2.priceTier.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_priceTierInsideOptionalClassName.c_str(), + newElement_2_priceTierInsideOptionalCtorSignature.c_str(), jninewElement_2_priceTierInsideOptional, + newElement_2_priceTierInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_priceTierInsideOptional, + newElement_2_priceTier); + } + jobject newElement_2_friendlyCredit; + if (!entry_2.friendlyCredit.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_friendlyCredit); + } + else + { + jobject newElement_2_friendlyCreditInsideOptional; + std::string newElement_2_friendlyCreditInsideOptionalClassName = "java/lang/Boolean"; + std::string newElement_2_friendlyCreditInsideOptionalCtorSignature = "(Z)V"; + jboolean jninewElement_2_friendlyCreditInsideOptional = + static_cast(entry_2.friendlyCredit.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_friendlyCreditInsideOptionalClassName.c_str(), + newElement_2_friendlyCreditInsideOptionalCtorSignature.c_str(), + jninewElement_2_friendlyCreditInsideOptional, newElement_2_friendlyCreditInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_friendlyCreditInsideOptional, + newElement_2_friendlyCredit); + } + jobject newElement_2_auxiliaryLoad; + if (!entry_2.auxiliaryLoad.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_auxiliaryLoad); + } + else + { + jobject newElement_2_auxiliaryLoadInsideOptional; + std::string newElement_2_auxiliaryLoadInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_2_auxiliaryLoadInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_2_auxiliaryLoadInsideOptional = static_cast(entry_2.auxiliaryLoad.Value().Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_auxiliaryLoadInsideOptionalClassName.c_str(), + newElement_2_auxiliaryLoadInsideOptionalCtorSignature.c_str(), + jninewElement_2_auxiliaryLoadInsideOptional, newElement_2_auxiliaryLoadInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_auxiliaryLoadInsideOptional, + newElement_2_auxiliaryLoad); + } + + jclass transitionStructStructClass_3; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterTransitionStruct", + transitionStructStructClass_3); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterTransitionStruct"); + return nullptr; + } + + jmethodID transitionStructStructCtor_3; + err = chip::JniReferences::GetInstance().FindMethod( + env, transitionStructStructClass_3, "", + "(Ljava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V", + &transitionStructStructCtor_3); + if (err != CHIP_NO_ERROR || transitionStructStructCtor_3 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterTransitionStruct constructor"); + return nullptr; + } + + newElement_2 = + env->NewObject(transitionStructStructClass_3, transitionStructStructCtor_3, newElement_2_transitionTime, + newElement_2_priceTier, newElement_2_friendlyCredit, newElement_2_auxiliaryLoad); + chip::JniReferences::GetInstance().AddToList(value_transitions, newElement_2); + } + jobject value_calendarID; + if (!cppValue.Value().calendarID.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_calendarID); + } + else + { + jobject value_calendarIDInsideOptional; + std::string value_calendarIDInsideOptionalClassName = "java/lang/Long"; + std::string value_calendarIDInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_calendarIDInsideOptional = static_cast(cppValue.Value().calendarID.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_calendarIDInsideOptionalClassName.c_str(), value_calendarIDInsideOptionalCtorSignature.c_str(), + jnivalue_calendarIDInsideOptional, value_calendarIDInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_calendarIDInsideOptional, value_calendarID); + } + + jclass dayStructStructClass_1; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterDayStruct", dayStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterDayStruct"); + return nullptr; + } + + jmethodID dayStructStructCtor_1; + err = chip::JniReferences::GetInstance().FindMethod( + env, dayStructStructClass_1, "", + "(Ljava/util/Optional;Ljava/util/Optional;Ljava/util/ArrayList;Ljava/util/Optional;)V", &dayStructStructCtor_1); + if (err != CHIP_NO_ERROR || dayStructStructCtor_1 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterDayStruct constructor"); + return nullptr; + } + + value = env->NewObject(dayStructStructClass_1, dayStructStructCtor_1, value_date, value_daysOfWeek, + value_transitions, value_calendarID); + } + return value; + } + case Attributes::CurrentTransition::Id: { + using TypeInfo = Attributes::CurrentTransition::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + jobject value_transitionTime; + std::string value_transitionTimeClassName = "java/lang/Integer"; + std::string value_transitionTimeCtorSignature = "(I)V"; + jint jnivalue_transitionTime = static_cast(cppValue.Value().transitionTime); + chip::JniReferences::GetInstance().CreateBoxedObject(value_transitionTimeClassName.c_str(), + value_transitionTimeCtorSignature.c_str(), + jnivalue_transitionTime, value_transitionTime); + jobject value_priceTier; + if (!cppValue.Value().priceTier.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_priceTier); + } + else + { + jobject value_priceTierInsideOptional; + std::string value_priceTierInsideOptionalClassName = "java/lang/Long"; + std::string value_priceTierInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_priceTierInsideOptional = static_cast(cppValue.Value().priceTier.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_priceTierInsideOptionalClassName.c_str(), value_priceTierInsideOptionalCtorSignature.c_str(), + jnivalue_priceTierInsideOptional, value_priceTierInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_priceTierInsideOptional, value_priceTier); + } + jobject value_friendlyCredit; + if (!cppValue.Value().friendlyCredit.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_friendlyCredit); + } + else + { + jobject value_friendlyCreditInsideOptional; + std::string value_friendlyCreditInsideOptionalClassName = "java/lang/Boolean"; + std::string value_friendlyCreditInsideOptionalCtorSignature = "(Z)V"; + jboolean jnivalue_friendlyCreditInsideOptional = static_cast(cppValue.Value().friendlyCredit.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_friendlyCreditInsideOptionalClassName.c_str(), + value_friendlyCreditInsideOptionalCtorSignature.c_str(), jnivalue_friendlyCreditInsideOptional, + value_friendlyCreditInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_friendlyCreditInsideOptional, value_friendlyCredit); + } + jobject value_auxiliaryLoad; + if (!cppValue.Value().auxiliaryLoad.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_auxiliaryLoad); + } + else + { + jobject value_auxiliaryLoadInsideOptional; + std::string value_auxiliaryLoadInsideOptionalClassName = "java/lang/Integer"; + std::string value_auxiliaryLoadInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_auxiliaryLoadInsideOptional = static_cast(cppValue.Value().auxiliaryLoad.Value().Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_auxiliaryLoadInsideOptionalClassName.c_str(), value_auxiliaryLoadInsideOptionalCtorSignature.c_str(), + jnivalue_auxiliaryLoadInsideOptional, value_auxiliaryLoadInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_auxiliaryLoadInsideOptional, value_auxiliaryLoad); + } + + jclass transitionStructStructClass_1; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterTransitionStruct", transitionStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterTransitionStruct"); + return nullptr; + } + + jmethodID transitionStructStructCtor_1; + err = chip::JniReferences::GetInstance().FindMethod( + env, transitionStructStructClass_1, "", + "(Ljava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V", + &transitionStructStructCtor_1); + if (err != CHIP_NO_ERROR || transitionStructStructCtor_1 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterTransitionStruct constructor"); + return nullptr; + } + + value = env->NewObject(transitionStructStructClass_1, transitionStructStructCtor_1, value_transitionTime, + value_priceTier, value_friendlyCredit, value_auxiliaryLoad); + } + return value; + } + case Attributes::CurrentPeakPeriod::Id: { + using TypeInfo = Attributes::CurrentPeakPeriod::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + jobject value_severity; + std::string value_severityClassName = "java/lang/Integer"; + std::string value_severityCtorSignature = "(I)V"; + jint jnivalue_severity = static_cast(cppValue.Value().severity); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_severityClassName.c_str(), value_severityCtorSignature.c_str(), jnivalue_severity, value_severity); + jobject value_peakPeriod; + std::string value_peakPeriodClassName = "java/lang/Integer"; + std::string value_peakPeriodCtorSignature = "(I)V"; + jint jnivalue_peakPeriod = static_cast(cppValue.Value().peakPeriod); + chip::JniReferences::GetInstance().CreateBoxedObject(value_peakPeriodClassName.c_str(), + value_peakPeriodCtorSignature.c_str(), + jnivalue_peakPeriod, value_peakPeriod); + jobject value_startTime; + std::string value_startTimeClassName = "java/lang/Long"; + std::string value_startTimeCtorSignature = "(J)V"; + jlong jnivalue_startTime = static_cast(cppValue.Value().startTime); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_startTimeClassName.c_str(), value_startTimeCtorSignature.c_str(), jnivalue_startTime, value_startTime); + jobject value_endTime; + std::string value_endTimeClassName = "java/lang/Long"; + std::string value_endTimeCtorSignature = "(J)V"; + jlong jnivalue_endTime = static_cast(cppValue.Value().endTime); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_endTimeClassName.c_str(), value_endTimeCtorSignature.c_str(), jnivalue_endTime, value_endTime); + + jclass peakPeriodStructStructClass_1; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterPeakPeriodStruct", peakPeriodStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterPeakPeriodStruct"); + return nullptr; + } + + jmethodID peakPeriodStructStructCtor_1; + err = chip::JniReferences::GetInstance().FindMethod( + env, peakPeriodStructStructClass_1, "", + "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Long;Ljava/lang/Long;)V", &peakPeriodStructStructCtor_1); + if (err != CHIP_NO_ERROR || peakPeriodStructStructCtor_1 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterPeakPeriodStruct constructor"); + return nullptr; + } + + value = env->NewObject(peakPeriodStructStructClass_1, peakPeriodStructStructCtor_1, value_severity, + value_peakPeriod, value_startTime, value_endTime); + } + return value; + } + case Attributes::NextPeakPeriod::Id: { + using TypeInfo = Attributes::NextPeakPeriod::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + jobject value_severity; + std::string value_severityClassName = "java/lang/Integer"; + std::string value_severityCtorSignature = "(I)V"; + jint jnivalue_severity = static_cast(cppValue.Value().severity); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_severityClassName.c_str(), value_severityCtorSignature.c_str(), jnivalue_severity, value_severity); + jobject value_peakPeriod; + std::string value_peakPeriodClassName = "java/lang/Integer"; + std::string value_peakPeriodCtorSignature = "(I)V"; + jint jnivalue_peakPeriod = static_cast(cppValue.Value().peakPeriod); + chip::JniReferences::GetInstance().CreateBoxedObject(value_peakPeriodClassName.c_str(), + value_peakPeriodCtorSignature.c_str(), + jnivalue_peakPeriod, value_peakPeriod); + jobject value_startTime; + std::string value_startTimeClassName = "java/lang/Long"; + std::string value_startTimeCtorSignature = "(J)V"; + jlong jnivalue_startTime = static_cast(cppValue.Value().startTime); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_startTimeClassName.c_str(), value_startTimeCtorSignature.c_str(), jnivalue_startTime, value_startTime); + jobject value_endTime; + std::string value_endTimeClassName = "java/lang/Long"; + std::string value_endTimeCtorSignature = "(J)V"; + jlong jnivalue_endTime = static_cast(cppValue.Value().endTime); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_endTimeClassName.c_str(), value_endTimeCtorSignature.c_str(), jnivalue_endTime, value_endTime); + + jclass peakPeriodStructStructClass_1; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterPeakPeriodStruct", peakPeriodStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterPeakPeriodStruct"); + return nullptr; + } + + jmethodID peakPeriodStructStructCtor_1; + err = chip::JniReferences::GetInstance().FindMethod( + env, peakPeriodStructStructClass_1, "", + "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Long;Ljava/lang/Long;)V", &peakPeriodStructStructCtor_1); + if (err != CHIP_NO_ERROR || peakPeriodStructStructCtor_1 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterPeakPeriodStruct constructor"); + return nullptr; + } + + value = env->NewObject(peakPeriodStructStructClass_1, peakPeriodStructStructCtor_1, value_severity, + value_peakPeriod, value_startTime, value_endTime); + } + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::EventList::Id: { + using TypeInfo = Attributes::EventList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Integer"; + std::string valueCtorSignature = "(I)V"; + jint jnivalue = static_cast(cppValue); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), jnivalue, + value); + return value; + } + default: + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + break; + } + break; + } case app::Clusters::EnergyPreference::Id: { using namespace app::Clusters::EnergyPreference; switch (aPath.mAttributeId) diff --git a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp index dd385a777c9276..56cd51f4f8b7b8 100644 --- a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp @@ -6385,6 +6385,16 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & } break; } + case app::Clusters::EnergyCalendar::Id: { + using namespace app::Clusters::EnergyCalendar; + switch (aPath.mEventId) + { + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + break; + } + break; + } case app::Clusters::EnergyPreference::Id: { using namespace app::Clusters::EnergyPreference; switch (aPath.mEventId) diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm index 6c1548f5159b70..8c5ef8f2aadbb1 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm @@ -3266,6 +3266,69 @@ static BOOL AttributeIsSpecifiedInEnergyEVSECluster(AttributeId aAttributeId) } } } +static BOOL AttributeIsSpecifiedInEnergyCalendarCluster(AttributeId aAttributeId) +{ + using namespace Clusters::EnergyCalendar; + switch (aAttributeId) { + case Attributes::CalendarID::Id: { + return YES; + } + case Attributes::Name::Id: { + return YES; + } + case Attributes::ProviderID::Id: { + return YES; + } + case Attributes::EventID::Id: { + return YES; + } + case Attributes::StartDate::Id: { + return YES; + } + case Attributes::CalendarPeriods::Id: { + return YES; + } + case Attributes::SpecialDays::Id: { + return YES; + } + case Attributes::CurrentDay::Id: { + return YES; + } + case Attributes::NextDay::Id: { + return YES; + } + case Attributes::CurrentTransition::Id: { + return YES; + } + case Attributes::CurrentPeakPeriod::Id: { + return YES; + } + case Attributes::NextPeakPeriod::Id: { + return YES; + } + case Attributes::GeneratedCommandList::Id: { + return YES; + } + case Attributes::AcceptedCommandList::Id: { + return YES; + } + case Attributes::EventList::Id: { + return YES; + } + case Attributes::AttributeList::Id: { + return YES; + } + case Attributes::FeatureMap::Id: { + return YES; + } + case Attributes::ClusterRevision::Id: { + return YES; + } + default: { + return NO; + } + } +} static BOOL AttributeIsSpecifiedInEnergyPreferenceCluster(AttributeId aAttributeId) { using namespace Clusters::EnergyPreference; @@ -6504,6 +6567,9 @@ BOOL MTRAttributeIsSpecified(ClusterId aClusterId, AttributeId aAttributeId) case Clusters::EnergyEvse::Id: { return AttributeIsSpecifiedInEnergyEVSECluster(aAttributeId); } + case Clusters::EnergyCalendar::Id: { + return AttributeIsSpecifiedInEnergyCalendarCluster(aAttributeId); + } case Clusters::EnergyPreference::Id: { return AttributeIsSpecifiedInEnergyPreferenceCluster(aAttributeId); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index 4affde0367f59a..93815e4e9d862f 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -9520,6 +9520,534 @@ static id _Nullable DecodeAttributeValueForEnergyEVSECluster(AttributeId aAttrib *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; return nil; } +static id _Nullable DecodeAttributeValueForEnergyCalendarCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::EnergyCalendar; + switch (aAttributeId) { + case Attributes::CalendarID::Id: { + using TypeInfo = Attributes::CalendarID::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; + } + return value; + } + case Attributes::Name::Id: { + using TypeInfo = Attributes::Name::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = AsString(cppValue.Value()); + if (value == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } + } + return value; + } + case Attributes::ProviderID::Id: { + using TypeInfo = Attributes::ProviderID::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; + } + return value; + } + case Attributes::EventID::Id: { + using TypeInfo = Attributes::EventID::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; + } + return value; + } + case Attributes::StartDate::Id: { + using TypeInfo = Attributes::StartDate::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; + } + return value; + } + case Attributes::CalendarPeriods::Id: { + using TypeInfo = Attributes::CalendarPeriods::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTREnergyCalendarClusterCalendarPeriod * newElement_0; + newElement_0 = [MTREnergyCalendarClusterCalendarPeriod new]; + newElement_0.startDate = [NSNumber numberWithUnsignedInt:entry_0.startDate]; + { // Scope for our temporary variables + auto * array_2 = [NSMutableArray new]; + auto iter_2 = entry_0.days.begin(); + while (iter_2.Next()) { + auto & entry_2 = iter_2.GetValue(); + MTREnergyCalendarClusterDayStruct * newElement_2; + newElement_2 = [MTREnergyCalendarClusterDayStruct new]; + if (entry_2.date.HasValue()) { + newElement_2.date = [MTREnergyCalendarClusterDate new]; + if (entry_2.date.Value().year.HasValue()) { + newElement_2.date.year = [NSNumber numberWithUnsignedShort:entry_2.date.Value().year.Value()]; + } else { + newElement_2.date.year = nil; + } + if (entry_2.date.Value().month.HasValue()) { + newElement_2.date.month = [NSNumber numberWithUnsignedChar:entry_2.date.Value().month.Value()]; + } else { + newElement_2.date.month = nil; + } + if (entry_2.date.Value().day.HasValue()) { + newElement_2.date.day = [NSNumber numberWithUnsignedChar:entry_2.date.Value().day.Value()]; + } else { + newElement_2.date.day = nil; + } + if (entry_2.date.Value().dayOfWeek.HasValue()) { + newElement_2.date.dayOfWeek = [NSNumber numberWithUnsignedChar:entry_2.date.Value().dayOfWeek.Value()]; + } else { + newElement_2.date.dayOfWeek = nil; + } + } else { + newElement_2.date = nil; + } + if (entry_2.daysOfWeek.HasValue()) { + newElement_2.daysOfWeek = [NSNumber numberWithUnsignedChar:entry_2.daysOfWeek.Value().Raw()]; + } else { + newElement_2.daysOfWeek = nil; + } + { // Scope for our temporary variables + auto * array_4 = [NSMutableArray new]; + auto iter_4 = entry_2.transitions.begin(); + while (iter_4.Next()) { + auto & entry_4 = iter_4.GetValue(); + MTREnergyCalendarClusterTransitionStruct * newElement_4; + newElement_4 = [MTREnergyCalendarClusterTransitionStruct new]; + newElement_4.transitionTime = [NSNumber numberWithUnsignedShort:entry_4.transitionTime]; + if (entry_4.priceTier.HasValue()) { + newElement_4.priceTier = [NSNumber numberWithUnsignedInt:entry_4.priceTier.Value()]; + } else { + newElement_4.priceTier = nil; + } + if (entry_4.friendlyCredit.HasValue()) { + newElement_4.friendlyCredit = [NSNumber numberWithBool:entry_4.friendlyCredit.Value()]; + } else { + newElement_4.friendlyCredit = nil; + } + if (entry_4.auxiliaryLoad.HasValue()) { + newElement_4.auxiliaryLoad = [NSNumber numberWithUnsignedChar:entry_4.auxiliaryLoad.Value().Raw()]; + } else { + newElement_4.auxiliaryLoad = nil; + } + [array_4 addObject:newElement_4]; + } + CHIP_ERROR err = iter_4.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + newElement_2.transitions = array_4; + } + if (entry_2.calendarID.HasValue()) { + newElement_2.calendarID = [NSNumber numberWithUnsignedInt:entry_2.calendarID.Value()]; + } else { + newElement_2.calendarID = nil; + } + [array_2 addObject:newElement_2]; + } + CHIP_ERROR err = iter_2.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + newElement_0.days = array_2; + } + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::SpecialDays::Id: { + using TypeInfo = Attributes::SpecialDays::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTREnergyCalendarClusterDayStruct * newElement_0; + newElement_0 = [MTREnergyCalendarClusterDayStruct new]; + if (entry_0.date.HasValue()) { + newElement_0.date = [MTREnergyCalendarClusterDate new]; + if (entry_0.date.Value().year.HasValue()) { + newElement_0.date.year = [NSNumber numberWithUnsignedShort:entry_0.date.Value().year.Value()]; + } else { + newElement_0.date.year = nil; + } + if (entry_0.date.Value().month.HasValue()) { + newElement_0.date.month = [NSNumber numberWithUnsignedChar:entry_0.date.Value().month.Value()]; + } else { + newElement_0.date.month = nil; + } + if (entry_0.date.Value().day.HasValue()) { + newElement_0.date.day = [NSNumber numberWithUnsignedChar:entry_0.date.Value().day.Value()]; + } else { + newElement_0.date.day = nil; + } + if (entry_0.date.Value().dayOfWeek.HasValue()) { + newElement_0.date.dayOfWeek = [NSNumber numberWithUnsignedChar:entry_0.date.Value().dayOfWeek.Value()]; + } else { + newElement_0.date.dayOfWeek = nil; + } + } else { + newElement_0.date = nil; + } + if (entry_0.daysOfWeek.HasValue()) { + newElement_0.daysOfWeek = [NSNumber numberWithUnsignedChar:entry_0.daysOfWeek.Value().Raw()]; + } else { + newElement_0.daysOfWeek = nil; + } + { // Scope for our temporary variables + auto * array_2 = [NSMutableArray new]; + auto iter_2 = entry_0.transitions.begin(); + while (iter_2.Next()) { + auto & entry_2 = iter_2.GetValue(); + MTREnergyCalendarClusterTransitionStruct * newElement_2; + newElement_2 = [MTREnergyCalendarClusterTransitionStruct new]; + newElement_2.transitionTime = [NSNumber numberWithUnsignedShort:entry_2.transitionTime]; + if (entry_2.priceTier.HasValue()) { + newElement_2.priceTier = [NSNumber numberWithUnsignedInt:entry_2.priceTier.Value()]; + } else { + newElement_2.priceTier = nil; + } + if (entry_2.friendlyCredit.HasValue()) { + newElement_2.friendlyCredit = [NSNumber numberWithBool:entry_2.friendlyCredit.Value()]; + } else { + newElement_2.friendlyCredit = nil; + } + if (entry_2.auxiliaryLoad.HasValue()) { + newElement_2.auxiliaryLoad = [NSNumber numberWithUnsignedChar:entry_2.auxiliaryLoad.Value().Raw()]; + } else { + newElement_2.auxiliaryLoad = nil; + } + [array_2 addObject:newElement_2]; + } + CHIP_ERROR err = iter_2.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + newElement_0.transitions = array_2; + } + if (entry_0.calendarID.HasValue()) { + newElement_0.calendarID = [NSNumber numberWithUnsignedInt:entry_0.calendarID.Value()]; + } else { + newElement_0.calendarID = nil; + } + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::CurrentDay::Id: { + using TypeInfo = Attributes::CurrentDay::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + MTREnergyCalendarClusterDayStruct * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [MTREnergyCalendarClusterDayStruct new]; + if (cppValue.Value().date.HasValue()) { + value.date = [MTREnergyCalendarClusterDate new]; + if (cppValue.Value().date.Value().year.HasValue()) { + value.date.year = [NSNumber numberWithUnsignedShort:cppValue.Value().date.Value().year.Value()]; + } else { + value.date.year = nil; + } + if (cppValue.Value().date.Value().month.HasValue()) { + value.date.month = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().month.Value()]; + } else { + value.date.month = nil; + } + if (cppValue.Value().date.Value().day.HasValue()) { + value.date.day = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().day.Value()]; + } else { + value.date.day = nil; + } + if (cppValue.Value().date.Value().dayOfWeek.HasValue()) { + value.date.dayOfWeek = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().dayOfWeek.Value()]; + } else { + value.date.dayOfWeek = nil; + } + } else { + value.date = nil; + } + if (cppValue.Value().daysOfWeek.HasValue()) { + value.daysOfWeek = [NSNumber numberWithUnsignedChar:cppValue.Value().daysOfWeek.Value().Raw()]; + } else { + value.daysOfWeek = nil; + } + { // Scope for our temporary variables + auto * array_2 = [NSMutableArray new]; + auto iter_2 = cppValue.Value().transitions.begin(); + while (iter_2.Next()) { + auto & entry_2 = iter_2.GetValue(); + MTREnergyCalendarClusterTransitionStruct * newElement_2; + newElement_2 = [MTREnergyCalendarClusterTransitionStruct new]; + newElement_2.transitionTime = [NSNumber numberWithUnsignedShort:entry_2.transitionTime]; + if (entry_2.priceTier.HasValue()) { + newElement_2.priceTier = [NSNumber numberWithUnsignedInt:entry_2.priceTier.Value()]; + } else { + newElement_2.priceTier = nil; + } + if (entry_2.friendlyCredit.HasValue()) { + newElement_2.friendlyCredit = [NSNumber numberWithBool:entry_2.friendlyCredit.Value()]; + } else { + newElement_2.friendlyCredit = nil; + } + if (entry_2.auxiliaryLoad.HasValue()) { + newElement_2.auxiliaryLoad = [NSNumber numberWithUnsignedChar:entry_2.auxiliaryLoad.Value().Raw()]; + } else { + newElement_2.auxiliaryLoad = nil; + } + [array_2 addObject:newElement_2]; + } + CHIP_ERROR err = iter_2.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value.transitions = array_2; + } + if (cppValue.Value().calendarID.HasValue()) { + value.calendarID = [NSNumber numberWithUnsignedInt:cppValue.Value().calendarID.Value()]; + } else { + value.calendarID = nil; + } + } + return value; + } + case Attributes::NextDay::Id: { + using TypeInfo = Attributes::NextDay::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + MTREnergyCalendarClusterDayStruct * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [MTREnergyCalendarClusterDayStruct new]; + if (cppValue.Value().date.HasValue()) { + value.date = [MTREnergyCalendarClusterDate new]; + if (cppValue.Value().date.Value().year.HasValue()) { + value.date.year = [NSNumber numberWithUnsignedShort:cppValue.Value().date.Value().year.Value()]; + } else { + value.date.year = nil; + } + if (cppValue.Value().date.Value().month.HasValue()) { + value.date.month = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().month.Value()]; + } else { + value.date.month = nil; + } + if (cppValue.Value().date.Value().day.HasValue()) { + value.date.day = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().day.Value()]; + } else { + value.date.day = nil; + } + if (cppValue.Value().date.Value().dayOfWeek.HasValue()) { + value.date.dayOfWeek = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().dayOfWeek.Value()]; + } else { + value.date.dayOfWeek = nil; + } + } else { + value.date = nil; + } + if (cppValue.Value().daysOfWeek.HasValue()) { + value.daysOfWeek = [NSNumber numberWithUnsignedChar:cppValue.Value().daysOfWeek.Value().Raw()]; + } else { + value.daysOfWeek = nil; + } + { // Scope for our temporary variables + auto * array_2 = [NSMutableArray new]; + auto iter_2 = cppValue.Value().transitions.begin(); + while (iter_2.Next()) { + auto & entry_2 = iter_2.GetValue(); + MTREnergyCalendarClusterTransitionStruct * newElement_2; + newElement_2 = [MTREnergyCalendarClusterTransitionStruct new]; + newElement_2.transitionTime = [NSNumber numberWithUnsignedShort:entry_2.transitionTime]; + if (entry_2.priceTier.HasValue()) { + newElement_2.priceTier = [NSNumber numberWithUnsignedInt:entry_2.priceTier.Value()]; + } else { + newElement_2.priceTier = nil; + } + if (entry_2.friendlyCredit.HasValue()) { + newElement_2.friendlyCredit = [NSNumber numberWithBool:entry_2.friendlyCredit.Value()]; + } else { + newElement_2.friendlyCredit = nil; + } + if (entry_2.auxiliaryLoad.HasValue()) { + newElement_2.auxiliaryLoad = [NSNumber numberWithUnsignedChar:entry_2.auxiliaryLoad.Value().Raw()]; + } else { + newElement_2.auxiliaryLoad = nil; + } + [array_2 addObject:newElement_2]; + } + CHIP_ERROR err = iter_2.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value.transitions = array_2; + } + if (cppValue.Value().calendarID.HasValue()) { + value.calendarID = [NSNumber numberWithUnsignedInt:cppValue.Value().calendarID.Value()]; + } else { + value.calendarID = nil; + } + } + return value; + } + case Attributes::CurrentTransition::Id: { + using TypeInfo = Attributes::CurrentTransition::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + MTREnergyCalendarClusterTransitionStruct * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [MTREnergyCalendarClusterTransitionStruct new]; + value.transitionTime = [NSNumber numberWithUnsignedShort:cppValue.Value().transitionTime]; + if (cppValue.Value().priceTier.HasValue()) { + value.priceTier = [NSNumber numberWithUnsignedInt:cppValue.Value().priceTier.Value()]; + } else { + value.priceTier = nil; + } + if (cppValue.Value().friendlyCredit.HasValue()) { + value.friendlyCredit = [NSNumber numberWithBool:cppValue.Value().friendlyCredit.Value()]; + } else { + value.friendlyCredit = nil; + } + if (cppValue.Value().auxiliaryLoad.HasValue()) { + value.auxiliaryLoad = [NSNumber numberWithUnsignedChar:cppValue.Value().auxiliaryLoad.Value().Raw()]; + } else { + value.auxiliaryLoad = nil; + } + } + return value; + } + case Attributes::CurrentPeakPeriod::Id: { + using TypeInfo = Attributes::CurrentPeakPeriod::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + MTREnergyCalendarClusterPeakPeriodStruct * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [MTREnergyCalendarClusterPeakPeriodStruct new]; + value.severity = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value().severity)]; + value.peakPeriod = [NSNumber numberWithUnsignedShort:cppValue.Value().peakPeriod]; + value.startTime = [NSNumber numberWithUnsignedInt:cppValue.Value().startTime]; + value.endTime = [NSNumber numberWithUnsignedInt:cppValue.Value().endTime]; + } + return value; + } + case Attributes::NextPeakPeriod::Id: { + using TypeInfo = Attributes::NextPeakPeriod::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + MTREnergyCalendarClusterPeakPeriodStruct * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [MTREnergyCalendarClusterPeakPeriodStruct new]; + value.severity = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value().severity)]; + value.peakPeriod = [NSNumber numberWithUnsignedShort:cppValue.Value().peakPeriod]; + value.startTime = [NSNumber numberWithUnsignedInt:cppValue.Value().startTime]; + value.endTime = [NSNumber numberWithUnsignedInt:cppValue.Value().endTime]; + } + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} static id _Nullable DecodeAttributeValueForEnergyPreferenceCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) { using namespace Clusters::EnergyPreference; @@ -18867,6 +19395,9 @@ id _Nullable MTRDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::T case Clusters::EnergyEvse::Id: { return DecodeAttributeValueForEnergyEVSECluster(aPath.mAttributeId, aReader, aError); } + case Clusters::EnergyCalendar::Id: { + return DecodeAttributeValueForEnergyCalendarCluster(aPath.mAttributeId, aReader, aError); + } case Clusters::EnergyPreference::Id: { return DecodeAttributeValueForEnergyPreferenceCluster(aPath.mAttributeId, aReader, aError); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index bcf76c978cb480..eb4763a36244e5 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -8132,6 +8132,139 @@ MTR_PROVISIONALLY_AVAILABLE @end +/** + * Cluster Energy Calendar + * + * The Energy Calendar Cluster provides a mechanism for communicating schedules associated with various forms of energy consumption. + */ +MTR_PROVISIONALLY_AVAILABLE +@interface MTRBaseClusterEnergyCalendar : MTRGenericBaseCluster + +- (void)readAttributeCalendarIDWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeCalendarIDWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeCalendarIDWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeNameWithCompletion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeNameWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeNameWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeProviderIDWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeProviderIDWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeProviderIDWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeEventIDWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeEventIDWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeEventIDWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeStartDateWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeStartDateWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeStartDateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeCalendarPeriodsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeCalendarPeriodsWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeCalendarPeriodsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeSpecialDaysWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeSpecialDaysWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeSpecialDaysWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeCurrentDayWithCompletion:(void (^)(MTREnergyCalendarClusterDayStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeCurrentDayWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTREnergyCalendarClusterDayStruct * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeCurrentDayWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTREnergyCalendarClusterDayStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeNextDayWithCompletion:(void (^)(MTREnergyCalendarClusterDayStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeNextDayWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTREnergyCalendarClusterDayStruct * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeNextDayWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTREnergyCalendarClusterDayStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeCurrentTransitionWithCompletion:(void (^)(MTREnergyCalendarClusterTransitionStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeCurrentTransitionWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTREnergyCalendarClusterTransitionStruct * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeCurrentTransitionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTREnergyCalendarClusterTransitionStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeCurrentPeakPeriodWithCompletion:(void (^)(MTREnergyCalendarClusterPeakPeriodStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeCurrentPeakPeriodWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTREnergyCalendarClusterPeakPeriodStruct * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeCurrentPeakPeriodWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTREnergyCalendarClusterPeakPeriodStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeNextPeakPeriodWithCompletion:(void (^)(MTREnergyCalendarClusterPeakPeriodStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeNextPeakPeriodWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTREnergyCalendarClusterPeakPeriodStruct * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeNextPeakPeriodWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTREnergyCalendarClusterPeakPeriodStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; + +@end + +@interface MTRBaseClusterEnergyCalendar (Availability) + +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ +- (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device + endpointID:(NSNumber *)endpointID + queue:(dispatch_queue_t)queue MTR_PROVISIONALLY_AVAILABLE; + +@end + /** * Cluster Energy Preference * @@ -18050,6 +18183,41 @@ typedef NS_OPTIONS(uint8_t, MTREnergyEVSETargetDayOfWeekBitmap) { MTREnergyEVSETargetDayOfWeekBitmapSaturday MTR_PROVISIONALLY_AVAILABLE = 0x40, } MTR_PROVISIONALLY_AVAILABLE; +typedef NS_ENUM(uint8_t, MTREnergyCalendarPeakPeriodSeverity) { + MTREnergyCalendarPeakPeriodSeverityUnused MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTREnergyCalendarPeakPeriodSeverityLow MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTREnergyCalendarPeakPeriodSeverityMedium MTR_PROVISIONALLY_AVAILABLE = 0x02, + MTREnergyCalendarPeakPeriodSeverityHigh MTR_PROVISIONALLY_AVAILABLE = 0x03, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_OPTIONS(uint8_t, MTREnergyCalendarAuxiliaryLoadBitmap) { + MTREnergyCalendarAuxiliaryLoadBitmapAuxiliarySwitch1 MTR_PROVISIONALLY_AVAILABLE = 0x1, + MTREnergyCalendarAuxiliaryLoadBitmapAuxiliarySwitch2 MTR_PROVISIONALLY_AVAILABLE = 0x2, + MTREnergyCalendarAuxiliaryLoadBitmapAuxiliarySwitch3 MTR_PROVISIONALLY_AVAILABLE = 0x4, + MTREnergyCalendarAuxiliaryLoadBitmapAuxiliarySwitch4 MTR_PROVISIONALLY_AVAILABLE = 0x8, + MTREnergyCalendarAuxiliaryLoadBitmapAuxiliarySwitch5 MTR_PROVISIONALLY_AVAILABLE = 0x10, + MTREnergyCalendarAuxiliaryLoadBitmapAuxiliarySwitch6 MTR_PROVISIONALLY_AVAILABLE = 0x20, + MTREnergyCalendarAuxiliaryLoadBitmapAuxiliarySwitch7 MTR_PROVISIONALLY_AVAILABLE = 0x40, + MTREnergyCalendarAuxiliaryLoadBitmapAuxiliarySwitch8 MTR_PROVISIONALLY_AVAILABLE = 0x80, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_OPTIONS(uint32_t, MTREnergyCalendarFeature) { + MTREnergyCalendarFeaturePricingTier MTR_PROVISIONALLY_AVAILABLE = 0x1, + MTREnergyCalendarFeatureFriendlyCredit MTR_PROVISIONALLY_AVAILABLE = 0x2, + MTREnergyCalendarFeatureAuxiliaryLoad MTR_PROVISIONALLY_AVAILABLE = 0x4, + MTREnergyCalendarFeaturePeakPeriod MTR_PROVISIONALLY_AVAILABLE = 0x8, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_OPTIONS(uint8_t, MTREnergyCalendarTransitionDayOfWeekBitmap) { + MTREnergyCalendarTransitionDayOfWeekBitmapSunday MTR_PROVISIONALLY_AVAILABLE = 0x1, + MTREnergyCalendarTransitionDayOfWeekBitmapMonday MTR_PROVISIONALLY_AVAILABLE = 0x2, + MTREnergyCalendarTransitionDayOfWeekBitmapTuesday MTR_PROVISIONALLY_AVAILABLE = 0x4, + MTREnergyCalendarTransitionDayOfWeekBitmapWednesday MTR_PROVISIONALLY_AVAILABLE = 0x8, + MTREnergyCalendarTransitionDayOfWeekBitmapThursday MTR_PROVISIONALLY_AVAILABLE = 0x10, + MTREnergyCalendarTransitionDayOfWeekBitmapFriday MTR_PROVISIONALLY_AVAILABLE = 0x20, + MTREnergyCalendarTransitionDayOfWeekBitmapSaturday MTR_PROVISIONALLY_AVAILABLE = 0x40, +} MTR_PROVISIONALLY_AVAILABLE; + typedef NS_ENUM(uint8_t, MTREnergyPreferenceEnergyPriority) { MTREnergyPreferenceEnergyPriorityComfort MTR_PROVISIONALLY_AVAILABLE = 0x00, MTREnergyPreferenceEnergyPrioritySpeed MTR_PROVISIONALLY_AVAILABLE = 0x01, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index 6f586f7fcba17d..bf7cf4da94a2f3 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -53177,6 +53177,658 @@ + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheC @end +@implementation MTRBaseClusterEnergyCalendar + +- (void)readAttributeCalendarIDWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::CalendarID::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeCalendarIDWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = EnergyCalendar::Attributes::CalendarID::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeCalendarIDWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::CalendarID::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeNameWithCompletion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::Name::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeNameWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = EnergyCalendar::Attributes::Name::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeNameWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::Name::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeProviderIDWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::ProviderID::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeProviderIDWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = EnergyCalendar::Attributes::ProviderID::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeProviderIDWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::ProviderID::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeEventIDWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::EventID::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeEventIDWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = EnergyCalendar::Attributes::EventID::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeEventIDWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::EventID::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeStartDateWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::StartDate::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeStartDateWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = EnergyCalendar::Attributes::StartDate::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeStartDateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::StartDate::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeCalendarPeriodsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::CalendarPeriods::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeCalendarPeriodsWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = EnergyCalendar::Attributes::CalendarPeriods::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeCalendarPeriodsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::CalendarPeriods::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeSpecialDaysWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::SpecialDays::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeSpecialDaysWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = EnergyCalendar::Attributes::SpecialDays::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeSpecialDaysWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::SpecialDays::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeCurrentDayWithCompletion:(void (^)(MTREnergyCalendarClusterDayStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::CurrentDay::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeCurrentDayWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTREnergyCalendarClusterDayStruct * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = EnergyCalendar::Attributes::CurrentDay::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeCurrentDayWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTREnergyCalendarClusterDayStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::CurrentDay::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeNextDayWithCompletion:(void (^)(MTREnergyCalendarClusterDayStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::NextDay::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeNextDayWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTREnergyCalendarClusterDayStruct * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = EnergyCalendar::Attributes::NextDay::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeNextDayWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTREnergyCalendarClusterDayStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::NextDay::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeCurrentTransitionWithCompletion:(void (^)(MTREnergyCalendarClusterTransitionStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::CurrentTransition::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeCurrentTransitionWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTREnergyCalendarClusterTransitionStruct * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = EnergyCalendar::Attributes::CurrentTransition::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeCurrentTransitionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTREnergyCalendarClusterTransitionStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::CurrentTransition::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeCurrentPeakPeriodWithCompletion:(void (^)(MTREnergyCalendarClusterPeakPeriodStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::CurrentPeakPeriod::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeCurrentPeakPeriodWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTREnergyCalendarClusterPeakPeriodStruct * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = EnergyCalendar::Attributes::CurrentPeakPeriod::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeCurrentPeakPeriodWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTREnergyCalendarClusterPeakPeriodStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::CurrentPeakPeriod::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeNextPeakPeriodWithCompletion:(void (^)(MTREnergyCalendarClusterPeakPeriodStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::NextPeakPeriod::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeNextPeakPeriodWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTREnergyCalendarClusterPeakPeriodStruct * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = EnergyCalendar::Attributes::NextPeakPeriod::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeNextPeakPeriodWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTREnergyCalendarClusterPeakPeriodStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::NextPeakPeriod::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::GeneratedCommandList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = EnergyCalendar::Attributes::GeneratedCommandList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::GeneratedCommandList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::AcceptedCommandList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = EnergyCalendar::Attributes::AcceptedCommandList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::AcceptedCommandList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::EventList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = EnergyCalendar::Attributes::EventList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::EventList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::AttributeList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = EnergyCalendar::Attributes::AttributeList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::AttributeList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::FeatureMap::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = EnergyCalendar::Attributes::FeatureMap::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::FeatureMap::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::ClusterRevision::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = EnergyCalendar::Attributes::ClusterRevision::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyCalendar::Attributes::ClusterRevision::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +@end + @implementation MTRBaseClusterEnergyPreference - (void)readAttributeEnergyBalancesWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index b86600455521cd..eff83dc02f15e5 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -150,6 +150,7 @@ typedef NS_ENUM(uint32_t, MTRClusterIDType) { MTRClusterIDTypeMessagesID MTR_PROVISIONALLY_AVAILABLE = 0x00000097, MTRClusterIDTypeDeviceEnergyManagementID MTR_PROVISIONALLY_AVAILABLE = 0x00000098, MTRClusterIDTypeEnergyEVSEID MTR_PROVISIONALLY_AVAILABLE = 0x00000099, + MTRClusterIDTypeEnergyCalendarID MTR_PROVISIONALLY_AVAILABLE = 0x0000009A, MTRClusterIDTypeEnergyPreferenceID MTR_PROVISIONALLY_AVAILABLE = 0x0000009B, MTRClusterIDTypePowerTopologyID MTR_PROVISIONALLY_AVAILABLE = 0x0000009C, MTRClusterIDTypeEnergyEVSEModeID MTR_PROVISIONALLY_AVAILABLE = 0x0000009D, @@ -2630,6 +2631,26 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterEnergyEVSEAttributeFeatureMapID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeFeatureMapID, MTRAttributeIDTypeClusterEnergyEVSEAttributeClusterRevisionID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeClusterRevisionID, + // Cluster EnergyCalendar attributes + MTRAttributeIDTypeClusterEnergyCalendarAttributeCalendarIDID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, + MTRAttributeIDTypeClusterEnergyCalendarAttributeNameID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + MTRAttributeIDTypeClusterEnergyCalendarAttributeProviderIDID MTR_PROVISIONALLY_AVAILABLE = 0x00000002, + MTRAttributeIDTypeClusterEnergyCalendarAttributeEventIDID MTR_PROVISIONALLY_AVAILABLE = 0x00000003, + MTRAttributeIDTypeClusterEnergyCalendarAttributeStartDateID MTR_PROVISIONALLY_AVAILABLE = 0x00000004, + MTRAttributeIDTypeClusterEnergyCalendarAttributeCalendarPeriodsID MTR_PROVISIONALLY_AVAILABLE = 0x00000005, + MTRAttributeIDTypeClusterEnergyCalendarAttributeSpecialDaysID MTR_PROVISIONALLY_AVAILABLE = 0x00000006, + MTRAttributeIDTypeClusterEnergyCalendarAttributeCurrentDayID MTR_PROVISIONALLY_AVAILABLE = 0x00000007, + MTRAttributeIDTypeClusterEnergyCalendarAttributeNextDayID MTR_PROVISIONALLY_AVAILABLE = 0x00000008, + MTRAttributeIDTypeClusterEnergyCalendarAttributeCurrentTransitionID MTR_PROVISIONALLY_AVAILABLE = 0x00000009, + MTRAttributeIDTypeClusterEnergyCalendarAttributeCurrentPeakPeriodID MTR_PROVISIONALLY_AVAILABLE = 0x0000000A, + MTRAttributeIDTypeClusterEnergyCalendarAttributeNextPeakPeriodID MTR_PROVISIONALLY_AVAILABLE = 0x0000000B, + MTRAttributeIDTypeClusterEnergyCalendarAttributeGeneratedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID, + MTRAttributeIDTypeClusterEnergyCalendarAttributeAcceptedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID, + MTRAttributeIDTypeClusterEnergyCalendarAttributeEventListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeEventListID, + MTRAttributeIDTypeClusterEnergyCalendarAttributeAttributeListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAttributeListID, + MTRAttributeIDTypeClusterEnergyCalendarAttributeFeatureMapID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeFeatureMapID, + MTRAttributeIDTypeClusterEnergyCalendarAttributeClusterRevisionID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeClusterRevisionID, + // Cluster EnergyPreference attributes MTRAttributeIDTypeClusterEnergyPreferenceAttributeEnergyBalancesID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, MTRAttributeIDTypeClusterEnergyPreferenceAttributeCurrentEnergyBalanceID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm index 59b10037b32a43..090b4bac77d69c 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm @@ -228,6 +228,9 @@ case MTRClusterIDTypeEnergyEVSEID: result = @"EnergyEVSE"; break; + case MTRClusterIDTypeEnergyCalendarID: + result = @"EnergyCalendar"; + break; case MTRClusterIDTypeEnergyPreferenceID: result = @"EnergyPreference"; break; @@ -4655,6 +4658,88 @@ } break; + case MTRClusterIDTypeEnergyCalendarID: + + switch (attributeID) { + + // Cluster EnergyCalendar attributes + case MTRAttributeIDTypeClusterEnergyCalendarAttributeCalendarIDID: + result = @"CalendarID"; + break; + + case MTRAttributeIDTypeClusterEnergyCalendarAttributeNameID: + result = @"Name"; + break; + + case MTRAttributeIDTypeClusterEnergyCalendarAttributeProviderIDID: + result = @"ProviderID"; + break; + + case MTRAttributeIDTypeClusterEnergyCalendarAttributeEventIDID: + result = @"EventID"; + break; + + case MTRAttributeIDTypeClusterEnergyCalendarAttributeStartDateID: + result = @"StartDate"; + break; + + case MTRAttributeIDTypeClusterEnergyCalendarAttributeCalendarPeriodsID: + result = @"CalendarPeriods"; + break; + + case MTRAttributeIDTypeClusterEnergyCalendarAttributeSpecialDaysID: + result = @"SpecialDays"; + break; + + case MTRAttributeIDTypeClusterEnergyCalendarAttributeCurrentDayID: + result = @"CurrentDay"; + break; + + case MTRAttributeIDTypeClusterEnergyCalendarAttributeNextDayID: + result = @"NextDay"; + break; + + case MTRAttributeIDTypeClusterEnergyCalendarAttributeCurrentTransitionID: + result = @"CurrentTransition"; + break; + + case MTRAttributeIDTypeClusterEnergyCalendarAttributeCurrentPeakPeriodID: + result = @"CurrentPeakPeriod"; + break; + + case MTRAttributeIDTypeClusterEnergyCalendarAttributeNextPeakPeriodID: + result = @"NextPeakPeriod"; + break; + + case MTRAttributeIDTypeClusterEnergyCalendarAttributeGeneratedCommandListID: + result = @"GeneratedCommandList"; + break; + + case MTRAttributeIDTypeClusterEnergyCalendarAttributeAcceptedCommandListID: + result = @"AcceptedCommandList"; + break; + + case MTRAttributeIDTypeClusterEnergyCalendarAttributeEventListID: + result = @"EventList"; + break; + + case MTRAttributeIDTypeClusterEnergyCalendarAttributeAttributeListID: + result = @"AttributeList"; + break; + + case MTRAttributeIDTypeClusterEnergyCalendarAttributeFeatureMapID: + result = @"FeatureMap"; + break; + + case MTRAttributeIDTypeClusterEnergyCalendarAttributeClusterRevisionID: + result = @"ClusterRevision"; + break; + + default: + result = [NSString stringWithFormat:@"", attributeID]; + break; + } + case MTRClusterIDTypeEnergyPreferenceID: switch (attributeID) { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index 3a761fa7054192..f7e169ca2c4a36 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -3794,6 +3794,66 @@ MTR_PROVISIONALLY_AVAILABLE @end +/** + * Cluster Energy Calendar + * The Energy Calendar Cluster provides a mechanism for communicating schedules associated with various forms of energy consumption. + */ +MTR_PROVISIONALLY_AVAILABLE +@interface MTRClusterEnergyCalendar : MTRGenericCluster + +- (NSDictionary * _Nullable)readAttributeCalendarIDWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeNameWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeProviderIDWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeEventIDWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeStartDateWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeCalendarPeriodsWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeSpecialDaysWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeCurrentDayWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeNextDayWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeCurrentTransitionWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeCurrentPeakPeriodWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeNextPeakPeriodWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeEventListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; + +@end + +@interface MTRClusterEnergyCalendar (Availability) + +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ +- (instancetype _Nullable)initWithDevice:(MTRDevice *)device + endpointID:(NSNumber *)endpointID + queue:(dispatch_queue_t)queue MTR_PROVISIONALLY_AVAILABLE; + +@end + /** * Cluster Energy Preference * This cluster provides an interface to specify preferences for how devices should consume energy. diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm index fb882995a229e6..cfe4ba892b9445 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -10353,6 +10353,100 @@ - (void)writeAttributeApproximateEVEfficiencyWithValue:(NSDictionary * _Nullable)readAttributeCalendarIDWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeEnergyCalendarID) attributeID:@(MTRAttributeIDTypeClusterEnergyCalendarAttributeCalendarIDID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeNameWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeEnergyCalendarID) attributeID:@(MTRAttributeIDTypeClusterEnergyCalendarAttributeNameID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeProviderIDWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeEnergyCalendarID) attributeID:@(MTRAttributeIDTypeClusterEnergyCalendarAttributeProviderIDID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeEventIDWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeEnergyCalendarID) attributeID:@(MTRAttributeIDTypeClusterEnergyCalendarAttributeEventIDID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeStartDateWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeEnergyCalendarID) attributeID:@(MTRAttributeIDTypeClusterEnergyCalendarAttributeStartDateID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeCalendarPeriodsWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeEnergyCalendarID) attributeID:@(MTRAttributeIDTypeClusterEnergyCalendarAttributeCalendarPeriodsID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeSpecialDaysWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeEnergyCalendarID) attributeID:@(MTRAttributeIDTypeClusterEnergyCalendarAttributeSpecialDaysID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeCurrentDayWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeEnergyCalendarID) attributeID:@(MTRAttributeIDTypeClusterEnergyCalendarAttributeCurrentDayID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeNextDayWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeEnergyCalendarID) attributeID:@(MTRAttributeIDTypeClusterEnergyCalendarAttributeNextDayID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeCurrentTransitionWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeEnergyCalendarID) attributeID:@(MTRAttributeIDTypeClusterEnergyCalendarAttributeCurrentTransitionID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeCurrentPeakPeriodWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeEnergyCalendarID) attributeID:@(MTRAttributeIDTypeClusterEnergyCalendarAttributeCurrentPeakPeriodID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeNextPeakPeriodWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeEnergyCalendarID) attributeID:@(MTRAttributeIDTypeClusterEnergyCalendarAttributeNextPeakPeriodID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeEnergyCalendarID) attributeID:@(MTRAttributeIDTypeClusterEnergyCalendarAttributeGeneratedCommandListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeEnergyCalendarID) attributeID:@(MTRAttributeIDTypeClusterEnergyCalendarAttributeAcceptedCommandListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeEventListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeEnergyCalendarID) attributeID:@(MTRAttributeIDTypeClusterEnergyCalendarAttributeEventListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeEnergyCalendarID) attributeID:@(MTRAttributeIDTypeClusterEnergyCalendarAttributeAttributeListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeEnergyCalendarID) attributeID:@(MTRAttributeIDTypeClusterEnergyCalendarAttributeFeatureMapID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeEnergyCalendarID) attributeID:@(MTRAttributeIDTypeClusterEnergyCalendarAttributeClusterRevisionID) params:params]; +} + +@end + @implementation MTRClusterEnergyPreference - (NSDictionary * _Nullable)readAttributeEnergyBalancesWithParams:(MTRReadParams * _Nullable)params diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm index 3724ec038ef00c..cd260c4a9ca564 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm @@ -656,6 +656,15 @@ static BOOL CommandNeedsTimedInvokeInEnergyEVSECluster(AttributeId aAttributeId) } } } +static BOOL CommandNeedsTimedInvokeInEnergyCalendarCluster(AttributeId aAttributeId) +{ + using namespace Clusters::EnergyCalendar; + switch (aAttributeId) { + default: { + return NO; + } + } +} static BOOL CommandNeedsTimedInvokeInEnergyPreferenceCluster(AttributeId aAttributeId) { using namespace Clusters::EnergyPreference; @@ -1371,6 +1380,9 @@ BOOL MTRCommandNeedsTimedInvoke(NSNumber * _Nonnull aClusterID, NSNumber * _Nonn case Clusters::EnergyEvse::Id: { return CommandNeedsTimedInvokeInEnergyEVSECluster(commandID); } + case Clusters::EnergyCalendar::Id: { + return CommandNeedsTimedInvokeInEnergyCalendarCluster(commandID); + } case Clusters::EnergyPreference::Id: { return CommandNeedsTimedInvokeInEnergyPreferenceCluster(commandID); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm index 4b493a97a74df6..0267044c1d6c63 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm @@ -3367,6 +3367,18 @@ static id _Nullable DecodeEventPayloadForEnergyEVSECluster(EventId aEventId, TLV *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; return nil; } +static id _Nullable DecodeEventPayloadForEnergyCalendarCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::EnergyCalendar; + switch (aEventId) { + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} static id _Nullable DecodeEventPayloadForEnergyPreferenceCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) { using namespace Clusters::EnergyPreference; @@ -4992,6 +5004,9 @@ id _Nullable MTRDecodeEventPayload(const ConcreteEventPath & aPath, TLV::TLVRead case Clusters::EnergyEvse::Id: { return DecodeEventPayloadForEnergyEVSECluster(aPath.mEventId, aReader, aError); } + case Clusters::EnergyCalendar::Id: { + return DecodeEventPayloadForEnergyCalendarCluster(aPath.mEventId, aReader, aError); + } case Clusters::EnergyPreference::Id: { return DecodeEventPayloadForEnergyPreferenceCluster(aPath.mEventId, aReader, aError); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index 61aa5161dced29..2cae83e8f28c18 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -1508,6 +1508,44 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy) NSData * _Nonnull uid MTR_PROVISIONALLY_AVAILABLE; @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTREnergyCalendarClusterTransitionStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull transitionTime MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable priceTier MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable friendlyCredit MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable auxiliaryLoad MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTREnergyCalendarClusterDate : NSObject +@property (nonatomic, copy) NSNumber * _Nullable year MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable month MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable day MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable dayOfWeek MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTREnergyCalendarClusterDayStruct : NSObject +@property (nonatomic, copy) MTREnergyCalendarClusterDate * _Nullable date MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable daysOfWeek MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSArray * _Nonnull transitions MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable calendarID MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTREnergyCalendarClusterCalendarPeriod : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull startDate MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSArray * _Nonnull days MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTREnergyCalendarClusterPeakPeriodStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull severity MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull peakPeriod MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull startTime MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull endTime MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_PROVISIONALLY_AVAILABLE @interface MTREnergyPreferenceClusterBalanceStruct : NSObject @property (nonatomic, copy) NSNumber * _Nonnull step MTR_PROVISIONALLY_AVAILABLE; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index 5cb5806c112a69..c42d13b1f897a8 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -6265,6 +6265,180 @@ - (NSString *)description @end +@implementation MTREnergyCalendarClusterTransitionStruct +- (instancetype)init +{ + if (self = [super init]) { + + _transitionTime = @(0); + + _priceTier = nil; + + _friendlyCredit = nil; + + _auxiliaryLoad = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTREnergyCalendarClusterTransitionStruct alloc] init]; + + other.transitionTime = self.transitionTime; + other.priceTier = self.priceTier; + other.friendlyCredit = self.friendlyCredit; + other.auxiliaryLoad = self.auxiliaryLoad; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: transitionTime:%@; priceTier:%@; friendlyCredit:%@; auxiliaryLoad:%@; >", NSStringFromClass([self class]), _transitionTime, _priceTier, _friendlyCredit, _auxiliaryLoad]; + return descriptionString; +} + +@end + +@implementation MTREnergyCalendarClusterDate +- (instancetype)init +{ + if (self = [super init]) { + + _year = nil; + + _month = nil; + + _day = nil; + + _dayOfWeek = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTREnergyCalendarClusterDate alloc] init]; + + other.year = self.year; + other.month = self.month; + other.day = self.day; + other.dayOfWeek = self.dayOfWeek; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: year:%@; month:%@; day:%@; dayOfWeek:%@; >", NSStringFromClass([self class]), _year, _month, _day, _dayOfWeek]; + return descriptionString; +} + +@end + +@implementation MTREnergyCalendarClusterDayStruct +- (instancetype)init +{ + if (self = [super init]) { + + _date = nil; + + _daysOfWeek = nil; + + _transitions = [NSArray array]; + + _calendarID = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTREnergyCalendarClusterDayStruct alloc] init]; + + other.date = self.date; + other.daysOfWeek = self.daysOfWeek; + other.transitions = self.transitions; + other.calendarID = self.calendarID; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: date:%@; daysOfWeek:%@; transitions:%@; calendarID:%@; >", NSStringFromClass([self class]), _date, _daysOfWeek, _transitions, _calendarID]; + return descriptionString; +} + +@end + +@implementation MTREnergyCalendarClusterCalendarPeriod +- (instancetype)init +{ + if (self = [super init]) { + + _startDate = @(0); + + _days = [NSArray array]; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTREnergyCalendarClusterCalendarPeriod alloc] init]; + + other.startDate = self.startDate; + other.days = self.days; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: startDate:%@; days:%@; >", NSStringFromClass([self class]), _startDate, _days]; + return descriptionString; +} + +@end + +@implementation MTREnergyCalendarClusterPeakPeriodStruct +- (instancetype)init +{ + if (self = [super init]) { + + _severity = @(0); + + _peakPeriod = @(0); + + _startTime = @(0); + + _endTime = @(0); + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTREnergyCalendarClusterPeakPeriodStruct alloc] init]; + + other.severity = self.severity; + other.peakPeriod = self.peakPeriod; + other.startTime = self.startTime; + other.endTime = self.endTime; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: severity:%@; peakPeriod:%@; startTime:%@; endTime:%@; >", NSStringFromClass([self class]), _severity, _peakPeriod, _startTime, _endTime]; + return descriptionString; +} + +@end + @implementation MTREnergyPreferenceClusterBalanceStruct - (instancetype)init { From d43d0df1e3ae091e7293368451aae483ab2edd4c Mon Sep 17 00:00:00 2001 From: Mikhail Antropov Date: Tue, 18 Jun 2024 09:41:39 +0300 Subject: [PATCH 03/16] Update src/app/zap-templates/zcl/zcl*.json --- .../chip/energy-calendar-cluster.xml | 12 +- .../zcl/zcl-with-test-extensions.json | 10 + src/app/zap-templates/zcl/zcl.json | 10 + .../data_model/controller-clusters.matter | 12 +- .../chip/devicecontroller/ChipStructs.java | 32 +- .../structs/EnergyCalendarClusterDate.kt | 92 ++- .../cluster/clusters/EnergyCalendarCluster.kt | 24 +- .../structs/EnergyCalendarClusterDate.kt | 92 ++- .../CHIPAttributeTLVValueDecoder.cpp | 386 ++++++++----- .../python/chip/clusters/Objects.py | 32 +- .../MTRAttributeTLVValueDecoder.mm | 96 +++- .../zap-generated/attributes/Accessors.cpp | 529 ------------------ .../zap-generated/attributes/Accessors.h | 104 ---- .../zap-generated/cluster-objects.h | 8 +- 14 files changed, 546 insertions(+), 893 deletions(-) diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml index 82814a1215fc65..38ebeba9e04bd4 100644 --- a/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml @@ -47,10 +47,10 @@ limitations under the License. - - - - + + + + @@ -119,8 +119,8 @@ limitations under the License. CurrentDay NextDay CurrentTransition - CurrentPeakPeriod - NextPeakPeriod + CurrentPeakPeriod + NextPeakPeriod diff --git a/src/app/zap-templates/zcl/zcl-with-test-extensions.json b/src/app/zap-templates/zcl/zcl-with-test-extensions.json index 77aa4d5dc6406e..f9065ffa7eb8c0 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -681,6 +681,16 @@ "ThreadNetworkTableSize" ], "Service Area": ["CurrentArea", "EstimatedEndTime", "FeatureMap"] + "Energy Calendar": [ + "CalendarPeriods", + "SpecialDays", + "CurrentDay", + "NextDay", + "CurrentTransition", + "CurrentPeakPeriod", + "NextPeakPeriod", + "FeatureMap" + ] }, "defaultReportingPolicy": "mandatory", "ZCLDataTypes": ["ARRAY", "BITMAP", "ENUM", "NUMBER", "STRING", "STRUCT"], diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index 77376845e9874d..fd7db744719149 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -675,6 +675,16 @@ "ThreadNetworkTableSize" ], "Service Area": ["CurrentArea", "EstimatedEndTime", "FeatureMap"] + "Energy Calendar": [ + "CalendarPeriods", + "SpecialDays", + "CurrentDay", + "NextDay", + "CurrentTransition", + "CurrentPeakPeriod", + "NextPeakPeriod", + "FeatureMap" + ] }, "defaultReportingPolicy": "mandatory", "ZCLDataTypes": ["ARRAY", "BITMAP", "ENUM", "NUMBER", "STRING", "STRUCT"], diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 6c216ad9427705..a15ac804070aa5 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -5484,10 +5484,10 @@ cluster EnergyCalendar = 154 { } struct Date { - optional int16u year = 0; - optional int8u month = 1; - optional int8u day = 2; - optional int8u dayOfWeek = 3; + optional nullable int16u year = 0; + optional nullable int8u month = 1; + optional nullable int8u day = 2; + optional nullable int8u dayOfWeek = 3; } struct DayStruct { @@ -5519,8 +5519,8 @@ cluster EnergyCalendar = 154 { readonly attribute nullable DayStruct currentDay = 7; readonly attribute nullable DayStruct nextDay = 8; readonly attribute nullable TransitionStruct currentTransition = 9; - readonly attribute nullable PeakPeriodStruct currentPeakPeriod = 10; - readonly attribute nullable PeakPeriodStruct nextPeakPeriod = 11; + readonly attribute optional nullable PeakPeriodStruct currentPeakPeriod = 10; + readonly attribute optional nullable PeakPeriodStruct nextPeakPeriod = 11; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index 458fb5c43a7a09..5f9d88ef3b5054 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -8851,20 +8851,20 @@ public String toString() { } } public static class EnergyCalendarClusterDate { - public Optional year; - public Optional month; - public Optional day; - public Optional dayOfWeek; + public @Nullable Optional year; + public @Nullable Optional month; + public @Nullable Optional day; + public @Nullable Optional dayOfWeek; private static final long YEAR_ID = 0L; private static final long MONTH_ID = 1L; private static final long DAY_ID = 2L; private static final long DAY_OF_WEEK_ID = 3L; public EnergyCalendarClusterDate( - Optional year, - Optional month, - Optional day, - Optional dayOfWeek + @Nullable Optional year, + @Nullable Optional month, + @Nullable Optional day, + @Nullable Optional dayOfWeek ) { this.year = year; this.month = month; @@ -8874,10 +8874,10 @@ public EnergyCalendarClusterDate( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(YEAR_ID, year.map((nonOptionalyear) -> new UIntType(nonOptionalyear)).orElse(new EmptyType()))); - values.add(new StructElement(MONTH_ID, month.map((nonOptionalmonth) -> new UIntType(nonOptionalmonth)).orElse(new EmptyType()))); - values.add(new StructElement(DAY_ID, day.map((nonOptionalday) -> new UIntType(nonOptionalday)).orElse(new EmptyType()))); - values.add(new StructElement(DAY_OF_WEEK_ID, dayOfWeek.map((nonOptionaldayOfWeek) -> new UIntType(nonOptionaldayOfWeek)).orElse(new EmptyType()))); + values.add(new StructElement(YEAR_ID, year != null ? year.map((nonOptionalyear) -> new UIntType(nonOptionalyear)).orElse(new EmptyType()) : new NullType())); + values.add(new StructElement(MONTH_ID, month != null ? month.map((nonOptionalmonth) -> new UIntType(nonOptionalmonth)).orElse(new EmptyType()) : new NullType())); + values.add(new StructElement(DAY_ID, day != null ? day.map((nonOptionalday) -> new UIntType(nonOptionalday)).orElse(new EmptyType()) : new NullType())); + values.add(new StructElement(DAY_OF_WEEK_ID, dayOfWeek != null ? dayOfWeek.map((nonOptionaldayOfWeek) -> new UIntType(nonOptionaldayOfWeek)).orElse(new EmptyType()) : new NullType())); return new StructType(values); } @@ -8886,10 +8886,10 @@ public static EnergyCalendarClusterDate decodeTlv(BaseTLVType tlvValue) { if (tlvValue == null || tlvValue.type() != TLVType.Struct) { return null; } - Optional year = Optional.empty(); - Optional month = Optional.empty(); - Optional day = Optional.empty(); - Optional dayOfWeek = Optional.empty(); + @Nullable Optional year = null; + @Nullable Optional month = null; + @Nullable Optional day = null; + @Nullable Optional dayOfWeek = null; for (StructElement element: ((StructType)tlvValue).value()) { if (element.contextTagNum() == YEAR_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDate.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDate.kt index 82cada7f887767..3cdea415955521 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDate.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDate.kt @@ -24,10 +24,10 @@ import matter.tlv.TlvReader import matter.tlv.TlvWriter class EnergyCalendarClusterDate( - val year: Optional, - val month: Optional, - val day: Optional, - val dayOfWeek: Optional + val year: Optional?, + val month: Optional?, + val day: Optional?, + val dayOfWeek: Optional? ) { override fun toString(): String = buildString { append("EnergyCalendarClusterDate {\n") @@ -41,21 +41,37 @@ class EnergyCalendarClusterDate( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - if (year.isPresent) { - val optyear = year.get() - put(ContextSpecificTag(TAG_YEAR), optyear) + if (year != null) { + if (year.isPresent) { + val optyear = year.get() + put(ContextSpecificTag(TAG_YEAR), optyear) + } + } else { + putNull(ContextSpecificTag(TAG_YEAR)) } - if (month.isPresent) { - val optmonth = month.get() - put(ContextSpecificTag(TAG_MONTH), optmonth) + if (month != null) { + if (month.isPresent) { + val optmonth = month.get() + put(ContextSpecificTag(TAG_MONTH), optmonth) + } + } else { + putNull(ContextSpecificTag(TAG_MONTH)) } - if (day.isPresent) { - val optday = day.get() - put(ContextSpecificTag(TAG_DAY), optday) + if (day != null) { + if (day.isPresent) { + val optday = day.get() + put(ContextSpecificTag(TAG_DAY), optday) + } + } else { + putNull(ContextSpecificTag(TAG_DAY)) } - if (dayOfWeek.isPresent) { - val optdayOfWeek = dayOfWeek.get() - put(ContextSpecificTag(TAG_DAY_OF_WEEK), optdayOfWeek) + if (dayOfWeek != null) { + if (dayOfWeek.isPresent) { + val optdayOfWeek = dayOfWeek.get() + put(ContextSpecificTag(TAG_DAY_OF_WEEK), optdayOfWeek) + } + } else { + putNull(ContextSpecificTag(TAG_DAY_OF_WEEK)) } endStructure() } @@ -70,28 +86,48 @@ class EnergyCalendarClusterDate( fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyCalendarClusterDate { tlvReader.enterStructure(tlvTag) val year = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_YEAR))) { - Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_YEAR))) + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_YEAR))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_YEAR))) + } else { + Optional.empty() + } } else { - Optional.empty() + tlvReader.getNull(ContextSpecificTag(TAG_YEAR)) + null } val month = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_MONTH))) { - Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_MONTH))) + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MONTH))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_MONTH))) + } else { + Optional.empty() + } } else { - Optional.empty() + tlvReader.getNull(ContextSpecificTag(TAG_MONTH)) + null } val day = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY))) { - Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_DAY))) + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_DAY))) + } else { + Optional.empty() + } } else { - Optional.empty() + tlvReader.getNull(ContextSpecificTag(TAG_DAY)) + null } val dayOfWeek = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY_OF_WEEK))) { - Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_DAY_OF_WEEK))) + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY_OF_WEEK))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_DAY_OF_WEEK))) + } else { + Optional.empty() + } } else { - Optional.empty() + tlvReader.getNull(ContextSpecificTag(TAG_DAY_OF_WEEK)) + null } tlvReader.exitContainer() diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyCalendarCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyCalendarCluster.kt index 42323e15182912..a6357499fcdde8 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyCalendarCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyCalendarCluster.kt @@ -1171,7 +1171,11 @@ class EnergyCalendarCluster( val tlvReader = TlvReader(attributeData.data) val decodedValue: EnergyCalendarClusterPeakPeriodStruct? = if (!tlvReader.isNull()) { - EnergyCalendarClusterPeakPeriodStruct.fromTlv(AnonymousTag, tlvReader) + if (tlvReader.isNextTag(AnonymousTag)) { + EnergyCalendarClusterPeakPeriodStruct.fromTlv(AnonymousTag, tlvReader) + } else { + null + } } else { tlvReader.getNull(AnonymousTag) null @@ -1223,7 +1227,11 @@ class EnergyCalendarCluster( val tlvReader = TlvReader(attributeData.data) val decodedValue: EnergyCalendarClusterPeakPeriodStruct? = if (!tlvReader.isNull()) { - EnergyCalendarClusterPeakPeriodStruct.fromTlv(AnonymousTag, tlvReader) + if (tlvReader.isNextTag(AnonymousTag)) { + EnergyCalendarClusterPeakPeriodStruct.fromTlv(AnonymousTag, tlvReader) + } else { + null + } } else { tlvReader.getNull(AnonymousTag) null @@ -1266,7 +1274,11 @@ class EnergyCalendarCluster( val tlvReader = TlvReader(attributeData.data) val decodedValue: EnergyCalendarClusterPeakPeriodStruct? = if (!tlvReader.isNull()) { - EnergyCalendarClusterPeakPeriodStruct.fromTlv(AnonymousTag, tlvReader) + if (tlvReader.isNextTag(AnonymousTag)) { + EnergyCalendarClusterPeakPeriodStruct.fromTlv(AnonymousTag, tlvReader) + } else { + null + } } else { tlvReader.getNull(AnonymousTag) null @@ -1318,7 +1330,11 @@ class EnergyCalendarCluster( val tlvReader = TlvReader(attributeData.data) val decodedValue: EnergyCalendarClusterPeakPeriodStruct? = if (!tlvReader.isNull()) { - EnergyCalendarClusterPeakPeriodStruct.fromTlv(AnonymousTag, tlvReader) + if (tlvReader.isNextTag(AnonymousTag)) { + EnergyCalendarClusterPeakPeriodStruct.fromTlv(AnonymousTag, tlvReader) + } else { + null + } } else { tlvReader.getNull(AnonymousTag) null diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDate.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDate.kt index 7080f30a0b1b8c..112517f1d0a879 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDate.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDate.kt @@ -24,10 +24,10 @@ import matter.tlv.TlvReader import matter.tlv.TlvWriter class EnergyCalendarClusterDate( - val year: Optional, - val month: Optional, - val day: Optional, - val dayOfWeek: Optional + val year: Optional?, + val month: Optional?, + val day: Optional?, + val dayOfWeek: Optional? ) { override fun toString(): String = buildString { append("EnergyCalendarClusterDate {\n") @@ -41,21 +41,37 @@ class EnergyCalendarClusterDate( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - if (year.isPresent) { - val optyear = year.get() - put(ContextSpecificTag(TAG_YEAR), optyear) + if (year != null) { + if (year.isPresent) { + val optyear = year.get() + put(ContextSpecificTag(TAG_YEAR), optyear) + } + } else { + putNull(ContextSpecificTag(TAG_YEAR)) } - if (month.isPresent) { - val optmonth = month.get() - put(ContextSpecificTag(TAG_MONTH), optmonth) + if (month != null) { + if (month.isPresent) { + val optmonth = month.get() + put(ContextSpecificTag(TAG_MONTH), optmonth) + } + } else { + putNull(ContextSpecificTag(TAG_MONTH)) } - if (day.isPresent) { - val optday = day.get() - put(ContextSpecificTag(TAG_DAY), optday) + if (day != null) { + if (day.isPresent) { + val optday = day.get() + put(ContextSpecificTag(TAG_DAY), optday) + } + } else { + putNull(ContextSpecificTag(TAG_DAY)) } - if (dayOfWeek.isPresent) { - val optdayOfWeek = dayOfWeek.get() - put(ContextSpecificTag(TAG_DAY_OF_WEEK), optdayOfWeek) + if (dayOfWeek != null) { + if (dayOfWeek.isPresent) { + val optdayOfWeek = dayOfWeek.get() + put(ContextSpecificTag(TAG_DAY_OF_WEEK), optdayOfWeek) + } + } else { + putNull(ContextSpecificTag(TAG_DAY_OF_WEEK)) } endStructure() } @@ -70,28 +86,48 @@ class EnergyCalendarClusterDate( fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyCalendarClusterDate { tlvReader.enterStructure(tlvTag) val year = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_YEAR))) { - Optional.of(tlvReader.getUShort(ContextSpecificTag(TAG_YEAR))) + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_YEAR))) { + Optional.of(tlvReader.getUShort(ContextSpecificTag(TAG_YEAR))) + } else { + Optional.empty() + } } else { - Optional.empty() + tlvReader.getNull(ContextSpecificTag(TAG_YEAR)) + null } val month = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_MONTH))) { - Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_MONTH))) + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MONTH))) { + Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_MONTH))) + } else { + Optional.empty() + } } else { - Optional.empty() + tlvReader.getNull(ContextSpecificTag(TAG_MONTH)) + null } val day = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY))) { - Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_DAY))) + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY))) { + Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_DAY))) + } else { + Optional.empty() + } } else { - Optional.empty() + tlvReader.getNull(ContextSpecificTag(TAG_DAY)) + null } val dayOfWeek = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY_OF_WEEK))) { - Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_DAY_OF_WEEK))) + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY_OF_WEEK))) { + Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_DAY_OF_WEEK))) + } else { + Optional.empty() + } } else { - Optional.empty() + tlvReader.getNull(ContextSpecificTag(TAG_DAY_OF_WEEK)) + null } tlvReader.exitContainer() diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index 3dea3108169254..a5788b988b4a97 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -25115,15 +25115,22 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR else { jobject newElement_2_dateInsideOptional_yearInsideOptional; - std::string newElement_2_dateInsideOptional_yearInsideOptionalClassName = "java/lang/Integer"; - std::string newElement_2_dateInsideOptional_yearInsideOptionalCtorSignature = "(I)V"; - jint jninewElement_2_dateInsideOptional_yearInsideOptional = - static_cast(entry_2.date.Value().year.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_2_dateInsideOptional_yearInsideOptionalClassName.c_str(), - newElement_2_dateInsideOptional_yearInsideOptionalCtorSignature.c_str(), - jninewElement_2_dateInsideOptional_yearInsideOptional, - newElement_2_dateInsideOptional_yearInsideOptional); + if (entry_2.date.Value().year.Value().IsNull()) + { + newElement_2_dateInsideOptional_yearInsideOptional = nullptr; + } + else + { + std::string newElement_2_dateInsideOptional_yearInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_2_dateInsideOptional_yearInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_2_dateInsideOptional_yearInsideOptional = + static_cast(entry_2.date.Value().year.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_dateInsideOptional_yearInsideOptionalClassName.c_str(), + newElement_2_dateInsideOptional_yearInsideOptionalCtorSignature.c_str(), + jninewElement_2_dateInsideOptional_yearInsideOptional, + newElement_2_dateInsideOptional_yearInsideOptional); + } chip::JniReferences::GetInstance().CreateOptional(newElement_2_dateInsideOptional_yearInsideOptional, newElement_2_dateInsideOptional_year); } @@ -25135,15 +25142,22 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR else { jobject newElement_2_dateInsideOptional_monthInsideOptional; - std::string newElement_2_dateInsideOptional_monthInsideOptionalClassName = "java/lang/Integer"; - std::string newElement_2_dateInsideOptional_monthInsideOptionalCtorSignature = "(I)V"; - jint jninewElement_2_dateInsideOptional_monthInsideOptional = - static_cast(entry_2.date.Value().month.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_2_dateInsideOptional_monthInsideOptionalClassName.c_str(), - newElement_2_dateInsideOptional_monthInsideOptionalCtorSignature.c_str(), - jninewElement_2_dateInsideOptional_monthInsideOptional, - newElement_2_dateInsideOptional_monthInsideOptional); + if (entry_2.date.Value().month.Value().IsNull()) + { + newElement_2_dateInsideOptional_monthInsideOptional = nullptr; + } + else + { + std::string newElement_2_dateInsideOptional_monthInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_2_dateInsideOptional_monthInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_2_dateInsideOptional_monthInsideOptional = + static_cast(entry_2.date.Value().month.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_dateInsideOptional_monthInsideOptionalClassName.c_str(), + newElement_2_dateInsideOptional_monthInsideOptionalCtorSignature.c_str(), + jninewElement_2_dateInsideOptional_monthInsideOptional, + newElement_2_dateInsideOptional_monthInsideOptional); + } chip::JniReferences::GetInstance().CreateOptional(newElement_2_dateInsideOptional_monthInsideOptional, newElement_2_dateInsideOptional_month); } @@ -25155,15 +25169,22 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR else { jobject newElement_2_dateInsideOptional_dayInsideOptional; - std::string newElement_2_dateInsideOptional_dayInsideOptionalClassName = "java/lang/Integer"; - std::string newElement_2_dateInsideOptional_dayInsideOptionalCtorSignature = "(I)V"; - jint jninewElement_2_dateInsideOptional_dayInsideOptional = - static_cast(entry_2.date.Value().day.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_2_dateInsideOptional_dayInsideOptionalClassName.c_str(), - newElement_2_dateInsideOptional_dayInsideOptionalCtorSignature.c_str(), - jninewElement_2_dateInsideOptional_dayInsideOptional, - newElement_2_dateInsideOptional_dayInsideOptional); + if (entry_2.date.Value().day.Value().IsNull()) + { + newElement_2_dateInsideOptional_dayInsideOptional = nullptr; + } + else + { + std::string newElement_2_dateInsideOptional_dayInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_2_dateInsideOptional_dayInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_2_dateInsideOptional_dayInsideOptional = + static_cast(entry_2.date.Value().day.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_dateInsideOptional_dayInsideOptionalClassName.c_str(), + newElement_2_dateInsideOptional_dayInsideOptionalCtorSignature.c_str(), + jninewElement_2_dateInsideOptional_dayInsideOptional, + newElement_2_dateInsideOptional_dayInsideOptional); + } chip::JniReferences::GetInstance().CreateOptional(newElement_2_dateInsideOptional_dayInsideOptional, newElement_2_dateInsideOptional_day); } @@ -25175,15 +25196,22 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR else { jobject newElement_2_dateInsideOptional_dayOfWeekInsideOptional; - std::string newElement_2_dateInsideOptional_dayOfWeekInsideOptionalClassName = "java/lang/Integer"; - std::string newElement_2_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature = "(I)V"; - jint jninewElement_2_dateInsideOptional_dayOfWeekInsideOptional = - static_cast(entry_2.date.Value().dayOfWeek.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_2_dateInsideOptional_dayOfWeekInsideOptionalClassName.c_str(), - newElement_2_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature.c_str(), - jninewElement_2_dateInsideOptional_dayOfWeekInsideOptional, - newElement_2_dateInsideOptional_dayOfWeekInsideOptional); + if (entry_2.date.Value().dayOfWeek.Value().IsNull()) + { + newElement_2_dateInsideOptional_dayOfWeekInsideOptional = nullptr; + } + else + { + std::string newElement_2_dateInsideOptional_dayOfWeekInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_2_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_2_dateInsideOptional_dayOfWeekInsideOptional = + static_cast(entry_2.date.Value().dayOfWeek.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_dateInsideOptional_dayOfWeekInsideOptionalClassName.c_str(), + newElement_2_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature.c_str(), + jninewElement_2_dateInsideOptional_dayOfWeekInsideOptional, + newElement_2_dateInsideOptional_dayOfWeekInsideOptional); + } chip::JniReferences::GetInstance().CreateOptional( newElement_2_dateInsideOptional_dayOfWeekInsideOptional, newElement_2_dateInsideOptional_dayOfWeek); } @@ -25431,15 +25459,22 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR else { jobject newElement_0_dateInsideOptional_yearInsideOptional; - std::string newElement_0_dateInsideOptional_yearInsideOptionalClassName = "java/lang/Integer"; - std::string newElement_0_dateInsideOptional_yearInsideOptionalCtorSignature = "(I)V"; - jint jninewElement_0_dateInsideOptional_yearInsideOptional = - static_cast(entry_0.date.Value().year.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0_dateInsideOptional_yearInsideOptionalClassName.c_str(), - newElement_0_dateInsideOptional_yearInsideOptionalCtorSignature.c_str(), - jninewElement_0_dateInsideOptional_yearInsideOptional, - newElement_0_dateInsideOptional_yearInsideOptional); + if (entry_0.date.Value().year.Value().IsNull()) + { + newElement_0_dateInsideOptional_yearInsideOptional = nullptr; + } + else + { + std::string newElement_0_dateInsideOptional_yearInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_0_dateInsideOptional_yearInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_0_dateInsideOptional_yearInsideOptional = + static_cast(entry_0.date.Value().year.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_dateInsideOptional_yearInsideOptionalClassName.c_str(), + newElement_0_dateInsideOptional_yearInsideOptionalCtorSignature.c_str(), + jninewElement_0_dateInsideOptional_yearInsideOptional, + newElement_0_dateInsideOptional_yearInsideOptional); + } chip::JniReferences::GetInstance().CreateOptional(newElement_0_dateInsideOptional_yearInsideOptional, newElement_0_dateInsideOptional_year); } @@ -25451,15 +25486,22 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR else { jobject newElement_0_dateInsideOptional_monthInsideOptional; - std::string newElement_0_dateInsideOptional_monthInsideOptionalClassName = "java/lang/Integer"; - std::string newElement_0_dateInsideOptional_monthInsideOptionalCtorSignature = "(I)V"; - jint jninewElement_0_dateInsideOptional_monthInsideOptional = - static_cast(entry_0.date.Value().month.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0_dateInsideOptional_monthInsideOptionalClassName.c_str(), - newElement_0_dateInsideOptional_monthInsideOptionalCtorSignature.c_str(), - jninewElement_0_dateInsideOptional_monthInsideOptional, - newElement_0_dateInsideOptional_monthInsideOptional); + if (entry_0.date.Value().month.Value().IsNull()) + { + newElement_0_dateInsideOptional_monthInsideOptional = nullptr; + } + else + { + std::string newElement_0_dateInsideOptional_monthInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_0_dateInsideOptional_monthInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_0_dateInsideOptional_monthInsideOptional = + static_cast(entry_0.date.Value().month.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_dateInsideOptional_monthInsideOptionalClassName.c_str(), + newElement_0_dateInsideOptional_monthInsideOptionalCtorSignature.c_str(), + jninewElement_0_dateInsideOptional_monthInsideOptional, + newElement_0_dateInsideOptional_monthInsideOptional); + } chip::JniReferences::GetInstance().CreateOptional(newElement_0_dateInsideOptional_monthInsideOptional, newElement_0_dateInsideOptional_month); } @@ -25471,15 +25513,22 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR else { jobject newElement_0_dateInsideOptional_dayInsideOptional; - std::string newElement_0_dateInsideOptional_dayInsideOptionalClassName = "java/lang/Integer"; - std::string newElement_0_dateInsideOptional_dayInsideOptionalCtorSignature = "(I)V"; - jint jninewElement_0_dateInsideOptional_dayInsideOptional = - static_cast(entry_0.date.Value().day.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0_dateInsideOptional_dayInsideOptionalClassName.c_str(), - newElement_0_dateInsideOptional_dayInsideOptionalCtorSignature.c_str(), - jninewElement_0_dateInsideOptional_dayInsideOptional, - newElement_0_dateInsideOptional_dayInsideOptional); + if (entry_0.date.Value().day.Value().IsNull()) + { + newElement_0_dateInsideOptional_dayInsideOptional = nullptr; + } + else + { + std::string newElement_0_dateInsideOptional_dayInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_0_dateInsideOptional_dayInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_0_dateInsideOptional_dayInsideOptional = + static_cast(entry_0.date.Value().day.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_dateInsideOptional_dayInsideOptionalClassName.c_str(), + newElement_0_dateInsideOptional_dayInsideOptionalCtorSignature.c_str(), + jninewElement_0_dateInsideOptional_dayInsideOptional, + newElement_0_dateInsideOptional_dayInsideOptional); + } chip::JniReferences::GetInstance().CreateOptional(newElement_0_dateInsideOptional_dayInsideOptional, newElement_0_dateInsideOptional_day); } @@ -25491,15 +25540,22 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR else { jobject newElement_0_dateInsideOptional_dayOfWeekInsideOptional; - std::string newElement_0_dateInsideOptional_dayOfWeekInsideOptionalClassName = "java/lang/Integer"; - std::string newElement_0_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature = "(I)V"; - jint jninewElement_0_dateInsideOptional_dayOfWeekInsideOptional = - static_cast(entry_0.date.Value().dayOfWeek.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0_dateInsideOptional_dayOfWeekInsideOptionalClassName.c_str(), - newElement_0_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature.c_str(), - jninewElement_0_dateInsideOptional_dayOfWeekInsideOptional, - newElement_0_dateInsideOptional_dayOfWeekInsideOptional); + if (entry_0.date.Value().dayOfWeek.Value().IsNull()) + { + newElement_0_dateInsideOptional_dayOfWeekInsideOptional = nullptr; + } + else + { + std::string newElement_0_dateInsideOptional_dayOfWeekInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_0_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_0_dateInsideOptional_dayOfWeekInsideOptional = + static_cast(entry_0.date.Value().dayOfWeek.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_dateInsideOptional_dayOfWeekInsideOptionalClassName.c_str(), + newElement_0_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature.c_str(), + jninewElement_0_dateInsideOptional_dayOfWeekInsideOptional, + newElement_0_dateInsideOptional_dayOfWeekInsideOptional); + } chip::JniReferences::GetInstance().CreateOptional(newElement_0_dateInsideOptional_dayOfWeekInsideOptional, newElement_0_dateInsideOptional_dayOfWeek); } @@ -25719,14 +25775,21 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR else { jobject value_dateInsideOptional_yearInsideOptional; - std::string value_dateInsideOptional_yearInsideOptionalClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_yearInsideOptionalCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_yearInsideOptional = - static_cast(cppValue.Value().date.Value().year.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_yearInsideOptionalClassName.c_str(), - value_dateInsideOptional_yearInsideOptionalCtorSignature.c_str(), - jnivalue_dateInsideOptional_yearInsideOptional, value_dateInsideOptional_yearInsideOptional); + if (cppValue.Value().date.Value().year.Value().IsNull()) + { + value_dateInsideOptional_yearInsideOptional = nullptr; + } + else + { + std::string value_dateInsideOptional_yearInsideOptionalClassName = "java/lang/Integer"; + std::string value_dateInsideOptional_yearInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_dateInsideOptional_yearInsideOptional = + static_cast(cppValue.Value().date.Value().year.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dateInsideOptional_yearInsideOptionalClassName.c_str(), + value_dateInsideOptional_yearInsideOptionalCtorSignature.c_str(), + jnivalue_dateInsideOptional_yearInsideOptional, value_dateInsideOptional_yearInsideOptional); + } chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional_yearInsideOptional, value_dateInsideOptional_year); } @@ -25738,14 +25801,21 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR else { jobject value_dateInsideOptional_monthInsideOptional; - std::string value_dateInsideOptional_monthInsideOptionalClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_monthInsideOptionalCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_monthInsideOptional = - static_cast(cppValue.Value().date.Value().month.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_monthInsideOptionalClassName.c_str(), - value_dateInsideOptional_monthInsideOptionalCtorSignature.c_str(), - jnivalue_dateInsideOptional_monthInsideOptional, value_dateInsideOptional_monthInsideOptional); + if (cppValue.Value().date.Value().month.Value().IsNull()) + { + value_dateInsideOptional_monthInsideOptional = nullptr; + } + else + { + std::string value_dateInsideOptional_monthInsideOptionalClassName = "java/lang/Integer"; + std::string value_dateInsideOptional_monthInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_dateInsideOptional_monthInsideOptional = + static_cast(cppValue.Value().date.Value().month.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dateInsideOptional_monthInsideOptionalClassName.c_str(), + value_dateInsideOptional_monthInsideOptionalCtorSignature.c_str(), + jnivalue_dateInsideOptional_monthInsideOptional, value_dateInsideOptional_monthInsideOptional); + } chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional_monthInsideOptional, value_dateInsideOptional_month); } @@ -25757,14 +25827,21 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR else { jobject value_dateInsideOptional_dayInsideOptional; - std::string value_dateInsideOptional_dayInsideOptionalClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_dayInsideOptionalCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_dayInsideOptional = - static_cast(cppValue.Value().date.Value().day.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_dayInsideOptionalClassName.c_str(), - value_dateInsideOptional_dayInsideOptionalCtorSignature.c_str(), - jnivalue_dateInsideOptional_dayInsideOptional, value_dateInsideOptional_dayInsideOptional); + if (cppValue.Value().date.Value().day.Value().IsNull()) + { + value_dateInsideOptional_dayInsideOptional = nullptr; + } + else + { + std::string value_dateInsideOptional_dayInsideOptionalClassName = "java/lang/Integer"; + std::string value_dateInsideOptional_dayInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_dateInsideOptional_dayInsideOptional = + static_cast(cppValue.Value().date.Value().day.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dateInsideOptional_dayInsideOptionalClassName.c_str(), + value_dateInsideOptional_dayInsideOptionalCtorSignature.c_str(), + jnivalue_dateInsideOptional_dayInsideOptional, value_dateInsideOptional_dayInsideOptional); + } chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional_dayInsideOptional, value_dateInsideOptional_day); } @@ -25776,14 +25853,22 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR else { jobject value_dateInsideOptional_dayOfWeekInsideOptional; - std::string value_dateInsideOptional_dayOfWeekInsideOptionalClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_dayOfWeekInsideOptional = - static_cast(cppValue.Value().date.Value().dayOfWeek.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_dayOfWeekInsideOptionalClassName.c_str(), - value_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature.c_str(), - jnivalue_dateInsideOptional_dayOfWeekInsideOptional, value_dateInsideOptional_dayOfWeekInsideOptional); + if (cppValue.Value().date.Value().dayOfWeek.Value().IsNull()) + { + value_dateInsideOptional_dayOfWeekInsideOptional = nullptr; + } + else + { + std::string value_dateInsideOptional_dayOfWeekInsideOptionalClassName = "java/lang/Integer"; + std::string value_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_dateInsideOptional_dayOfWeekInsideOptional = + static_cast(cppValue.Value().date.Value().dayOfWeek.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dateInsideOptional_dayOfWeekInsideOptionalClassName.c_str(), + value_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature.c_str(), + jnivalue_dateInsideOptional_dayOfWeekInsideOptional, + value_dateInsideOptional_dayOfWeekInsideOptional); + } chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional_dayOfWeekInsideOptional, value_dateInsideOptional_dayOfWeek); } @@ -25997,14 +26082,21 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR else { jobject value_dateInsideOptional_yearInsideOptional; - std::string value_dateInsideOptional_yearInsideOptionalClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_yearInsideOptionalCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_yearInsideOptional = - static_cast(cppValue.Value().date.Value().year.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_yearInsideOptionalClassName.c_str(), - value_dateInsideOptional_yearInsideOptionalCtorSignature.c_str(), - jnivalue_dateInsideOptional_yearInsideOptional, value_dateInsideOptional_yearInsideOptional); + if (cppValue.Value().date.Value().year.Value().IsNull()) + { + value_dateInsideOptional_yearInsideOptional = nullptr; + } + else + { + std::string value_dateInsideOptional_yearInsideOptionalClassName = "java/lang/Integer"; + std::string value_dateInsideOptional_yearInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_dateInsideOptional_yearInsideOptional = + static_cast(cppValue.Value().date.Value().year.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dateInsideOptional_yearInsideOptionalClassName.c_str(), + value_dateInsideOptional_yearInsideOptionalCtorSignature.c_str(), + jnivalue_dateInsideOptional_yearInsideOptional, value_dateInsideOptional_yearInsideOptional); + } chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional_yearInsideOptional, value_dateInsideOptional_year); } @@ -26016,14 +26108,21 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR else { jobject value_dateInsideOptional_monthInsideOptional; - std::string value_dateInsideOptional_monthInsideOptionalClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_monthInsideOptionalCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_monthInsideOptional = - static_cast(cppValue.Value().date.Value().month.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_monthInsideOptionalClassName.c_str(), - value_dateInsideOptional_monthInsideOptionalCtorSignature.c_str(), - jnivalue_dateInsideOptional_monthInsideOptional, value_dateInsideOptional_monthInsideOptional); + if (cppValue.Value().date.Value().month.Value().IsNull()) + { + value_dateInsideOptional_monthInsideOptional = nullptr; + } + else + { + std::string value_dateInsideOptional_monthInsideOptionalClassName = "java/lang/Integer"; + std::string value_dateInsideOptional_monthInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_dateInsideOptional_monthInsideOptional = + static_cast(cppValue.Value().date.Value().month.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dateInsideOptional_monthInsideOptionalClassName.c_str(), + value_dateInsideOptional_monthInsideOptionalCtorSignature.c_str(), + jnivalue_dateInsideOptional_monthInsideOptional, value_dateInsideOptional_monthInsideOptional); + } chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional_monthInsideOptional, value_dateInsideOptional_month); } @@ -26035,14 +26134,21 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR else { jobject value_dateInsideOptional_dayInsideOptional; - std::string value_dateInsideOptional_dayInsideOptionalClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_dayInsideOptionalCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_dayInsideOptional = - static_cast(cppValue.Value().date.Value().day.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_dayInsideOptionalClassName.c_str(), - value_dateInsideOptional_dayInsideOptionalCtorSignature.c_str(), - jnivalue_dateInsideOptional_dayInsideOptional, value_dateInsideOptional_dayInsideOptional); + if (cppValue.Value().date.Value().day.Value().IsNull()) + { + value_dateInsideOptional_dayInsideOptional = nullptr; + } + else + { + std::string value_dateInsideOptional_dayInsideOptionalClassName = "java/lang/Integer"; + std::string value_dateInsideOptional_dayInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_dateInsideOptional_dayInsideOptional = + static_cast(cppValue.Value().date.Value().day.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dateInsideOptional_dayInsideOptionalClassName.c_str(), + value_dateInsideOptional_dayInsideOptionalCtorSignature.c_str(), + jnivalue_dateInsideOptional_dayInsideOptional, value_dateInsideOptional_dayInsideOptional); + } chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional_dayInsideOptional, value_dateInsideOptional_day); } @@ -26054,14 +26160,22 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR else { jobject value_dateInsideOptional_dayOfWeekInsideOptional; - std::string value_dateInsideOptional_dayOfWeekInsideOptionalClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_dayOfWeekInsideOptional = - static_cast(cppValue.Value().date.Value().dayOfWeek.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_dayOfWeekInsideOptionalClassName.c_str(), - value_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature.c_str(), - jnivalue_dateInsideOptional_dayOfWeekInsideOptional, value_dateInsideOptional_dayOfWeekInsideOptional); + if (cppValue.Value().date.Value().dayOfWeek.Value().IsNull()) + { + value_dateInsideOptional_dayOfWeekInsideOptional = nullptr; + } + else + { + std::string value_dateInsideOptional_dayOfWeekInsideOptionalClassName = "java/lang/Integer"; + std::string value_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_dateInsideOptional_dayOfWeekInsideOptional = + static_cast(cppValue.Value().date.Value().dayOfWeek.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dateInsideOptional_dayOfWeekInsideOptionalClassName.c_str(), + value_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature.c_str(), + jnivalue_dateInsideOptional_dayOfWeekInsideOptional, + value_dateInsideOptional_dayOfWeekInsideOptional); + } chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional_dayOfWeekInsideOptional, value_dateInsideOptional_dayOfWeek); } diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 3917b93ab80f91..e691814b516cfc 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -26587,8 +26587,8 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="currentDay", Tag=0x00000007, Type=typing.Union[Nullable, EnergyCalendar.Structs.DayStruct]), ClusterObjectFieldDescriptor(Label="nextDay", Tag=0x00000008, Type=typing.Union[Nullable, EnergyCalendar.Structs.DayStruct]), ClusterObjectFieldDescriptor(Label="currentTransition", Tag=0x00000009, Type=typing.Union[Nullable, EnergyCalendar.Structs.TransitionStruct]), - ClusterObjectFieldDescriptor(Label="currentPeakPeriod", Tag=0x0000000A, Type=typing.Union[Nullable, EnergyCalendar.Structs.PeakPeriodStruct]), - ClusterObjectFieldDescriptor(Label="nextPeakPeriod", Tag=0x0000000B, Type=typing.Union[Nullable, EnergyCalendar.Structs.PeakPeriodStruct]), + ClusterObjectFieldDescriptor(Label="currentPeakPeriod", Tag=0x0000000A, Type=typing.Union[None, Nullable, EnergyCalendar.Structs.PeakPeriodStruct]), + ClusterObjectFieldDescriptor(Label="nextPeakPeriod", Tag=0x0000000B, Type=typing.Union[None, Nullable, EnergyCalendar.Structs.PeakPeriodStruct]), ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="eventList", Tag=0x0000FFFA, Type=typing.List[uint]), @@ -26607,8 +26607,8 @@ def descriptor(cls) -> ClusterObjectDescriptor: currentDay: 'typing.Union[Nullable, EnergyCalendar.Structs.DayStruct]' = None nextDay: 'typing.Union[Nullable, EnergyCalendar.Structs.DayStruct]' = None currentTransition: 'typing.Union[Nullable, EnergyCalendar.Structs.TransitionStruct]' = None - currentPeakPeriod: 'typing.Union[Nullable, EnergyCalendar.Structs.PeakPeriodStruct]' = None - nextPeakPeriod: 'typing.Union[Nullable, EnergyCalendar.Structs.PeakPeriodStruct]' = None + currentPeakPeriod: 'typing.Union[None, Nullable, EnergyCalendar.Structs.PeakPeriodStruct]' = None + nextPeakPeriod: 'typing.Union[None, Nullable, EnergyCalendar.Structs.PeakPeriodStruct]' = None generatedCommandList: 'typing.List[uint]' = None acceptedCommandList: 'typing.List[uint]' = None eventList: 'typing.List[uint]' = None @@ -26678,16 +26678,16 @@ class Date(ClusterObject): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="year", Tag=0, Type=typing.Optional[uint]), - ClusterObjectFieldDescriptor(Label="month", Tag=1, Type=typing.Optional[uint]), - ClusterObjectFieldDescriptor(Label="day", Tag=2, Type=typing.Optional[uint]), - ClusterObjectFieldDescriptor(Label="dayOfWeek", Tag=3, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="year", Tag=0, Type=typing.Union[None, Nullable, uint]), + ClusterObjectFieldDescriptor(Label="month", Tag=1, Type=typing.Union[None, Nullable, uint]), + ClusterObjectFieldDescriptor(Label="day", Tag=2, Type=typing.Union[None, Nullable, uint]), + ClusterObjectFieldDescriptor(Label="dayOfWeek", Tag=3, Type=typing.Union[None, Nullable, uint]), ]) - year: 'typing.Optional[uint]' = None - month: 'typing.Optional[uint]' = None - day: 'typing.Optional[uint]' = None - dayOfWeek: 'typing.Optional[uint]' = None + year: 'typing.Union[None, Nullable, uint]' = None + month: 'typing.Union[None, Nullable, uint]' = None + day: 'typing.Union[None, Nullable, uint]' = None + dayOfWeek: 'typing.Union[None, Nullable, uint]' = None @dataclass class DayStruct(ClusterObject): @@ -26909,9 +26909,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, EnergyCalendar.Structs.PeakPeriodStruct]) + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, EnergyCalendar.Structs.PeakPeriodStruct]) - value: 'typing.Union[Nullable, EnergyCalendar.Structs.PeakPeriodStruct]' = NullValue + value: 'typing.Union[None, Nullable, EnergyCalendar.Structs.PeakPeriodStruct]' = None @dataclass class NextPeakPeriod(ClusterAttributeDescriptor): @@ -26925,9 +26925,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, EnergyCalendar.Structs.PeakPeriodStruct]) + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, EnergyCalendar.Structs.PeakPeriodStruct]) - value: 'typing.Union[Nullable, EnergyCalendar.Structs.PeakPeriodStruct]' = NullValue + value: 'typing.Union[None, Nullable, EnergyCalendar.Structs.PeakPeriodStruct]' = None @dataclass class GeneratedCommandList(ClusterAttributeDescriptor): diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index 93815e4e9d862f..500fc7d3b5ba00 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -9630,22 +9630,38 @@ static id _Nullable DecodeAttributeValueForEnergyCalendarCluster(AttributeId aAt if (entry_2.date.HasValue()) { newElement_2.date = [MTREnergyCalendarClusterDate new]; if (entry_2.date.Value().year.HasValue()) { - newElement_2.date.year = [NSNumber numberWithUnsignedShort:entry_2.date.Value().year.Value()]; + if (entry_2.date.Value().year.Value().IsNull()) { + newElement_2.date.year = nil; + } else { + newElement_2.date.year = [NSNumber numberWithUnsignedShort:entry_2.date.Value().year.Value().Value()]; + } } else { newElement_2.date.year = nil; } if (entry_2.date.Value().month.HasValue()) { - newElement_2.date.month = [NSNumber numberWithUnsignedChar:entry_2.date.Value().month.Value()]; + if (entry_2.date.Value().month.Value().IsNull()) { + newElement_2.date.month = nil; + } else { + newElement_2.date.month = [NSNumber numberWithUnsignedChar:entry_2.date.Value().month.Value().Value()]; + } } else { newElement_2.date.month = nil; } if (entry_2.date.Value().day.HasValue()) { - newElement_2.date.day = [NSNumber numberWithUnsignedChar:entry_2.date.Value().day.Value()]; + if (entry_2.date.Value().day.Value().IsNull()) { + newElement_2.date.day = nil; + } else { + newElement_2.date.day = [NSNumber numberWithUnsignedChar:entry_2.date.Value().day.Value().Value()]; + } } else { newElement_2.date.day = nil; } if (entry_2.date.Value().dayOfWeek.HasValue()) { - newElement_2.date.dayOfWeek = [NSNumber numberWithUnsignedChar:entry_2.date.Value().dayOfWeek.Value()]; + if (entry_2.date.Value().dayOfWeek.Value().IsNull()) { + newElement_2.date.dayOfWeek = nil; + } else { + newElement_2.date.dayOfWeek = [NSNumber numberWithUnsignedChar:entry_2.date.Value().dayOfWeek.Value().Value()]; + } } else { newElement_2.date.dayOfWeek = nil; } @@ -9732,22 +9748,38 @@ static id _Nullable DecodeAttributeValueForEnergyCalendarCluster(AttributeId aAt if (entry_0.date.HasValue()) { newElement_0.date = [MTREnergyCalendarClusterDate new]; if (entry_0.date.Value().year.HasValue()) { - newElement_0.date.year = [NSNumber numberWithUnsignedShort:entry_0.date.Value().year.Value()]; + if (entry_0.date.Value().year.Value().IsNull()) { + newElement_0.date.year = nil; + } else { + newElement_0.date.year = [NSNumber numberWithUnsignedShort:entry_0.date.Value().year.Value().Value()]; + } } else { newElement_0.date.year = nil; } if (entry_0.date.Value().month.HasValue()) { - newElement_0.date.month = [NSNumber numberWithUnsignedChar:entry_0.date.Value().month.Value()]; + if (entry_0.date.Value().month.Value().IsNull()) { + newElement_0.date.month = nil; + } else { + newElement_0.date.month = [NSNumber numberWithUnsignedChar:entry_0.date.Value().month.Value().Value()]; + } } else { newElement_0.date.month = nil; } if (entry_0.date.Value().day.HasValue()) { - newElement_0.date.day = [NSNumber numberWithUnsignedChar:entry_0.date.Value().day.Value()]; + if (entry_0.date.Value().day.Value().IsNull()) { + newElement_0.date.day = nil; + } else { + newElement_0.date.day = [NSNumber numberWithUnsignedChar:entry_0.date.Value().day.Value().Value()]; + } } else { newElement_0.date.day = nil; } if (entry_0.date.Value().dayOfWeek.HasValue()) { - newElement_0.date.dayOfWeek = [NSNumber numberWithUnsignedChar:entry_0.date.Value().dayOfWeek.Value()]; + if (entry_0.date.Value().dayOfWeek.Value().IsNull()) { + newElement_0.date.dayOfWeek = nil; + } else { + newElement_0.date.dayOfWeek = [NSNumber numberWithUnsignedChar:entry_0.date.Value().dayOfWeek.Value().Value()]; + } } else { newElement_0.date.dayOfWeek = nil; } @@ -9822,22 +9854,38 @@ static id _Nullable DecodeAttributeValueForEnergyCalendarCluster(AttributeId aAt if (cppValue.Value().date.HasValue()) { value.date = [MTREnergyCalendarClusterDate new]; if (cppValue.Value().date.Value().year.HasValue()) { - value.date.year = [NSNumber numberWithUnsignedShort:cppValue.Value().date.Value().year.Value()]; + if (cppValue.Value().date.Value().year.Value().IsNull()) { + value.date.year = nil; + } else { + value.date.year = [NSNumber numberWithUnsignedShort:cppValue.Value().date.Value().year.Value().Value()]; + } } else { value.date.year = nil; } if (cppValue.Value().date.Value().month.HasValue()) { - value.date.month = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().month.Value()]; + if (cppValue.Value().date.Value().month.Value().IsNull()) { + value.date.month = nil; + } else { + value.date.month = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().month.Value().Value()]; + } } else { value.date.month = nil; } if (cppValue.Value().date.Value().day.HasValue()) { - value.date.day = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().day.Value()]; + if (cppValue.Value().date.Value().day.Value().IsNull()) { + value.date.day = nil; + } else { + value.date.day = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().day.Value().Value()]; + } } else { value.date.day = nil; } if (cppValue.Value().date.Value().dayOfWeek.HasValue()) { - value.date.dayOfWeek = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().dayOfWeek.Value()]; + if (cppValue.Value().date.Value().dayOfWeek.Value().IsNull()) { + value.date.dayOfWeek = nil; + } else { + value.date.dayOfWeek = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().dayOfWeek.Value().Value()]; + } } else { value.date.dayOfWeek = nil; } @@ -9904,22 +9952,38 @@ static id _Nullable DecodeAttributeValueForEnergyCalendarCluster(AttributeId aAt if (cppValue.Value().date.HasValue()) { value.date = [MTREnergyCalendarClusterDate new]; if (cppValue.Value().date.Value().year.HasValue()) { - value.date.year = [NSNumber numberWithUnsignedShort:cppValue.Value().date.Value().year.Value()]; + if (cppValue.Value().date.Value().year.Value().IsNull()) { + value.date.year = nil; + } else { + value.date.year = [NSNumber numberWithUnsignedShort:cppValue.Value().date.Value().year.Value().Value()]; + } } else { value.date.year = nil; } if (cppValue.Value().date.Value().month.HasValue()) { - value.date.month = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().month.Value()]; + if (cppValue.Value().date.Value().month.Value().IsNull()) { + value.date.month = nil; + } else { + value.date.month = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().month.Value().Value()]; + } } else { value.date.month = nil; } if (cppValue.Value().date.Value().day.HasValue()) { - value.date.day = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().day.Value()]; + if (cppValue.Value().date.Value().day.Value().IsNull()) { + value.date.day = nil; + } else { + value.date.day = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().day.Value().Value()]; + } } else { value.date.day = nil; } if (cppValue.Value().date.Value().dayOfWeek.HasValue()) { - value.date.dayOfWeek = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().dayOfWeek.Value()]; + if (cppValue.Value().date.Value().dayOfWeek.Value().IsNull()) { + value.date.dayOfWeek = nil; + } else { + value.date.dayOfWeek = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().dayOfWeek.Value().Value()]; + } } else { value.date.dayOfWeek = nil; } diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp index 6a27487152b2f8..0bc56ae52cc1f7 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp @@ -15695,535 +15695,6 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::a } // namespace StartDate -#error Attribute "CurrentDay" in cluster "Energy Calendar" is struct-typed and must be added to the attributeAccessInterfaceAttributes object in src/app/zap-templates/zcl/zcl.json and src/app/zap-templates/zcl/zcl-with-test-extensions.json -namespace CurrentDay { - -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, - DataModel::Nullable & value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); - if (Traits::IsNullValue(temp)) - { - value.SetNull(); - } - else - { - value.SetNonNull() = Traits::StorageToWorking(temp); - } - return status; -} - -Protocols::InteractionModel::Status -Set(chip::EndpointId endpoint, chip::app::Clusters::EnergyCalendar::Structs::DayStruct::Type value, MarkAttributeDirty markDirty) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE, markDirty); -} - -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, - chip::app::Clusters::EnergyCalendar::Structs::DayStruct::Type value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE); -} - -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE, markDirty); -} - -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE); -} - -Protocols::InteractionModel::Status -Set(chip::EndpointId endpoint, - const chip::app::DataModel::Nullable & value, - MarkAttributeDirty markDirty) -{ - if (value.IsNull()) - { - return SetNull(endpoint, markDirty); - } - - return Set(endpoint, value.Value(), markDirty); -} - -Protocols::InteractionModel::Status -Set(chip::EndpointId endpoint, - const chip::app::DataModel::Nullable & value) -{ - if (value.IsNull()) - { - return SetNull(endpoint); - } - - return Set(endpoint, value.Value()); -} - -} // namespace CurrentDay - -#error Attribute "NextDay" in cluster "Energy Calendar" is struct-typed and must be added to the attributeAccessInterfaceAttributes object in src/app/zap-templates/zcl/zcl.json and src/app/zap-templates/zcl/zcl-with-test-extensions.json -namespace NextDay { - -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, - DataModel::Nullable & value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); - if (Traits::IsNullValue(temp)) - { - value.SetNull(); - } - else - { - value.SetNonNull() = Traits::StorageToWorking(temp); - } - return status; -} - -Protocols::InteractionModel::Status -Set(chip::EndpointId endpoint, chip::app::Clusters::EnergyCalendar::Structs::DayStruct::Type value, MarkAttributeDirty markDirty) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE, markDirty); -} - -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, - chip::app::Clusters::EnergyCalendar::Structs::DayStruct::Type value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE); -} - -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE, markDirty); -} - -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE); -} - -Protocols::InteractionModel::Status -Set(chip::EndpointId endpoint, - const chip::app::DataModel::Nullable & value, - MarkAttributeDirty markDirty) -{ - if (value.IsNull()) - { - return SetNull(endpoint, markDirty); - } - - return Set(endpoint, value.Value(), markDirty); -} - -Protocols::InteractionModel::Status -Set(chip::EndpointId endpoint, - const chip::app::DataModel::Nullable & value) -{ - if (value.IsNull()) - { - return SetNull(endpoint); - } - - return Set(endpoint, value.Value()); -} - -} // namespace NextDay - -#error Attribute "CurrentTransition" in cluster "Energy Calendar" is struct-typed and must be added to the attributeAccessInterfaceAttributes object in src/app/zap-templates/zcl/zcl.json and src/app/zap-templates/zcl/zcl-with-test-extensions.json -namespace CurrentTransition { - -Protocols::InteractionModel::Status -Get(chip::EndpointId endpoint, DataModel::Nullable & value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); - if (Traits::IsNullValue(temp)) - { - value.SetNull(); - } - else - { - value.SetNonNull() = Traits::StorageToWorking(temp); - } - return status; -} - -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, - chip::app::Clusters::EnergyCalendar::Structs::TransitionStruct::Type value, - MarkAttributeDirty markDirty) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE, markDirty); -} - -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, - chip::app::Clusters::EnergyCalendar::Structs::TransitionStruct::Type value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE); -} - -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE, markDirty); -} - -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE); -} - -Protocols::InteractionModel::Status -Set(chip::EndpointId endpoint, - const chip::app::DataModel::Nullable & value, - MarkAttributeDirty markDirty) -{ - if (value.IsNull()) - { - return SetNull(endpoint, markDirty); - } - - return Set(endpoint, value.Value(), markDirty); -} - -Protocols::InteractionModel::Status -Set(chip::EndpointId endpoint, - const chip::app::DataModel::Nullable & value) -{ - if (value.IsNull()) - { - return SetNull(endpoint); - } - - return Set(endpoint, value.Value()); -} - -} // namespace CurrentTransition - -#error Attribute "CurrentPeakPeriod" in cluster "Energy Calendar" is struct-typed and must be added to the attributeAccessInterfaceAttributes object in src/app/zap-templates/zcl/zcl.json and src/app/zap-templates/zcl/zcl-with-test-extensions.json -namespace CurrentPeakPeriod { - -Protocols::InteractionModel::Status -Get(chip::EndpointId endpoint, DataModel::Nullable & value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); - if (Traits::IsNullValue(temp)) - { - value.SetNull(); - } - else - { - value.SetNonNull() = Traits::StorageToWorking(temp); - } - return status; -} - -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, - chip::app::Clusters::EnergyCalendar::Structs::PeakPeriodStruct::Type value, - MarkAttributeDirty markDirty) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE, markDirty); -} - -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, - chip::app::Clusters::EnergyCalendar::Structs::PeakPeriodStruct::Type value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE); -} - -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE, markDirty); -} - -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE); -} - -Protocols::InteractionModel::Status -Set(chip::EndpointId endpoint, - const chip::app::DataModel::Nullable & value, - MarkAttributeDirty markDirty) -{ - if (value.IsNull()) - { - return SetNull(endpoint, markDirty); - } - - return Set(endpoint, value.Value(), markDirty); -} - -Protocols::InteractionModel::Status -Set(chip::EndpointId endpoint, - const chip::app::DataModel::Nullable & value) -{ - if (value.IsNull()) - { - return SetNull(endpoint); - } - - return Set(endpoint, value.Value()); -} - -} // namespace CurrentPeakPeriod - -#error Attribute "NextPeakPeriod" in cluster "Energy Calendar" is struct-typed and must be added to the attributeAccessInterfaceAttributes object in src/app/zap-templates/zcl/zcl.json and src/app/zap-templates/zcl/zcl-with-test-extensions.json -namespace NextPeakPeriod { - -Protocols::InteractionModel::Status -Get(chip::EndpointId endpoint, DataModel::Nullable & value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); - if (Traits::IsNullValue(temp)) - { - value.SetNull(); - } - else - { - value.SetNonNull() = Traits::StorageToWorking(temp); - } - return status; -} - -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, - chip::app::Clusters::EnergyCalendar::Structs::PeakPeriodStruct::Type value, - MarkAttributeDirty markDirty) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE, markDirty); -} - -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, - chip::app::Clusters::EnergyCalendar::Structs::PeakPeriodStruct::Type value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE); -} - -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE, markDirty); -} - -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL__ATTRIBUTE_TYPE); -} - -Protocols::InteractionModel::Status -Set(chip::EndpointId endpoint, - const chip::app::DataModel::Nullable & value, - MarkAttributeDirty markDirty) -{ - if (value.IsNull()) - { - return SetNull(endpoint, markDirty); - } - - return Set(endpoint, value.Value(), markDirty); -} - -Protocols::InteractionModel::Status -Set(chip::EndpointId endpoint, - const chip::app::DataModel::Nullable & value) -{ - if (value.IsNull()) - { - return SetNull(endpoint); - } - - return Set(endpoint, value.Value()); -} - -} // namespace NextPeakPeriod - -namespace FeatureMap { - -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint32_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - *value = Traits::StorageToWorking(temp); - return status; -} - -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE, markDirty); -} - -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); -} - -} // namespace FeatureMap - namespace ClusterRevision { Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * value) diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h index f9b2aef044b179..81b51b4e4f6f38 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h @@ -2522,110 +2522,6 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::a MarkAttributeDirty markDirty); } // namespace StartDate -namespace CurrentDay { -Protocols::InteractionModel::Status -Get(chip::EndpointId endpoint, - DataModel::Nullable & value); // DayStruct -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, - chip::app::Clusters::EnergyCalendar::Structs::DayStruct::Type value); -Protocols::InteractionModel::Status -Set(chip::EndpointId endpoint, chip::app::Clusters::EnergyCalendar::Structs::DayStruct::Type value, MarkAttributeDirty markDirty); -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint); -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty); -Protocols::InteractionModel::Status -Set(chip::EndpointId endpoint, - const chip::app::DataModel::Nullable & value); -Protocols::InteractionModel::Status -Set(chip::EndpointId endpoint, - const chip::app::DataModel::Nullable & value, - MarkAttributeDirty markDirty); -} // namespace CurrentDay - -namespace NextDay { -Protocols::InteractionModel::Status -Get(chip::EndpointId endpoint, - DataModel::Nullable & value); // DayStruct -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, - chip::app::Clusters::EnergyCalendar::Structs::DayStruct::Type value); -Protocols::InteractionModel::Status -Set(chip::EndpointId endpoint, chip::app::Clusters::EnergyCalendar::Structs::DayStruct::Type value, MarkAttributeDirty markDirty); -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint); -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty); -Protocols::InteractionModel::Status -Set(chip::EndpointId endpoint, - const chip::app::DataModel::Nullable & value); -Protocols::InteractionModel::Status -Set(chip::EndpointId endpoint, - const chip::app::DataModel::Nullable & value, - MarkAttributeDirty markDirty); -} // namespace NextDay - -namespace CurrentTransition { -Protocols::InteractionModel::Status -Get(chip::EndpointId endpoint, - DataModel::Nullable & value); // TransitionStruct -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, - chip::app::Clusters::EnergyCalendar::Structs::TransitionStruct::Type value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, - chip::app::Clusters::EnergyCalendar::Structs::TransitionStruct::Type value, - MarkAttributeDirty markDirty); -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint); -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty); -Protocols::InteractionModel::Status -Set(chip::EndpointId endpoint, - const chip::app::DataModel::Nullable & value); -Protocols::InteractionModel::Status -Set(chip::EndpointId endpoint, - const chip::app::DataModel::Nullable & value, - MarkAttributeDirty markDirty); -} // namespace CurrentTransition - -namespace CurrentPeakPeriod { -Protocols::InteractionModel::Status -Get(chip::EndpointId endpoint, - DataModel::Nullable & value); // PeakPeriodStruct -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, - chip::app::Clusters::EnergyCalendar::Structs::PeakPeriodStruct::Type value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, - chip::app::Clusters::EnergyCalendar::Structs::PeakPeriodStruct::Type value, - MarkAttributeDirty markDirty); -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint); -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty); -Protocols::InteractionModel::Status -Set(chip::EndpointId endpoint, - const chip::app::DataModel::Nullable & value); -Protocols::InteractionModel::Status -Set(chip::EndpointId endpoint, - const chip::app::DataModel::Nullable & value, - MarkAttributeDirty markDirty); -} // namespace CurrentPeakPeriod - -namespace NextPeakPeriod { -Protocols::InteractionModel::Status -Get(chip::EndpointId endpoint, - DataModel::Nullable & value); // PeakPeriodStruct -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, - chip::app::Clusters::EnergyCalendar::Structs::PeakPeriodStruct::Type value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, - chip::app::Clusters::EnergyCalendar::Structs::PeakPeriodStruct::Type value, - MarkAttributeDirty markDirty); -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint); -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty); -Protocols::InteractionModel::Status -Set(chip::EndpointId endpoint, - const chip::app::DataModel::Nullable & value); -Protocols::InteractionModel::Status -Set(chip::EndpointId endpoint, - const chip::app::DataModel::Nullable & value, - MarkAttributeDirty markDirty); -} // namespace NextPeakPeriod - -namespace FeatureMap { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty); -} // namespace FeatureMap - namespace ClusterRevision { Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * value); // int16u Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value); 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 a5a3838f602bb6..9ad8a2d81f1c09 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 @@ -24362,10 +24362,10 @@ enum class Fields : uint8_t struct Type { public: - Optional year; - Optional month; - Optional day; - Optional dayOfWeek; + Optional> year; + Optional> month; + Optional> day; + Optional> dayOfWeek; CHIP_ERROR Decode(TLV::TLVReader & reader); From eb690144acb41db198dcaae9d0ac0e971cc7c6ea Mon Sep 17 00:00:00 2001 From: Mikhail Antropov Date: Mon, 24 Jun 2024 14:36:22 +0300 Subject: [PATCH 04/16] Update XMLs using tools --- data_model/1.3/clusters/EnergyCalendar.xml | 186 ++- .../chip/energy-calendar-cluster.xml | 70 +- src/app/zap_cluster_list.json | 163 ++- .../data_model/controller-clusters.matter | 23 +- .../chip/devicecontroller/ChipClusters.java | 12 +- .../chip/devicecontroller/ChipStructs.java | 139 +- .../devicecontroller/ClusterInfoMapping.java | 6 +- .../chip/devicecontroller/cluster/files.gni | 3 +- ...ergyCalendarClusterCalendarPeriodStruct.kt | 81 ++ .../structs/EnergyCalendarClusterDayStruct.kt | 6 +- .../EnergyCalendarClusterPeakPeriodStruct.kt | 32 +- .../cluster/clusters/EnergyCalendarCluster.kt | 80 +- .../java/matter/controller/cluster/files.gni | 3 +- ...ergyCalendarClusterCalendarPeriodStruct.kt | 81 ++ .../structs/EnergyCalendarClusterDayStruct.kt | 6 +- .../EnergyCalendarClusterPeakPeriodStruct.kt | 32 +- .../CHIPAttributeTLVValueDecoder.cpp | 1184 ++++++----------- .../python/chip/clusters/Objects.py | 51 +- .../MTRAttributeTLVValueDecoder.mm | 422 +++--- .../CHIP/zap-generated/MTRStructsObjc.h | 18 +- .../CHIP/zap-generated/MTRStructsObjc.mm | 46 +- .../zap-generated/cluster-objects.cpp | 55 +- .../zap-generated/cluster-objects.h | 65 +- .../zap-generated/cluster/Commands.h | 8 +- .../cluster/ComplexArgumentParser.cpp | 56 +- .../cluster/ComplexArgumentParser.h | 9 +- .../cluster/logging/DataModelLogger.cpp | 54 +- .../cluster/logging/DataModelLogger.h | 5 +- 28 files changed, 1145 insertions(+), 1751 deletions(-) create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterCalendarPeriodStruct.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterCalendarPeriodStruct.kt diff --git a/data_model/1.3/clusters/EnergyCalendar.xml b/data_model/1.3/clusters/EnergyCalendar.xml index c920a2cc965145..75db315f49fcf0 100644 --- a/data_model/1.3/clusters/EnergyCalendar.xml +++ b/data_model/1.3/clusters/EnergyCalendar.xml @@ -1,61 +1,61 @@ - @@ -83,16 +83,16 @@ Davis, CA 95616, USA - + - + - + - + @@ -145,35 +145,20 @@ Davis, CA 95616, USA - - - - - - - - - - - - - - - - - - + + + - + - + @@ -183,30 +168,32 @@ Davis, CA 95616, USA - + - + - + + + - + @@ -228,67 +215,70 @@ Davis, CA 95616, USA - + - + - + - + - + + - + - + + - + + - + - + - + - + - + diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml index 38ebeba9e04bd4..c5219ccb625c43 100644 --- a/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml @@ -13,7 +13,6 @@ limitations under the License. --> - @@ -45,42 +44,34 @@ limitations under the License. - - - - - - - - - + - - + + - - - - + + + + - - - - + + + + - + - + @@ -91,36 +82,33 @@ limitations under the License. true true The Energy Calendar Cluster provides a mechanism for communicating schedules associated with various forms of energy consumption. - - + - + - + - + - - CalendarID - Name - ProviderID - EventID - StartDate - CalendarPeriods - SpecialDays - CurrentDay - NextDay - CurrentTransition - CurrentPeakPeriod - NextPeakPeriod + CalendarID + Name + ProviderID + EventID + StartDate + CalendarPeriods + SpecialDays + CurrentDay + NextDay + CurrentTransition + CurrentPeakPeriod + NextPeakPeriod - diff --git a/src/app/zap_cluster_list.json b/src/app/zap_cluster_list.json index 4052253aed5fa1..5104d072787be4 100644 --- a/src/app/zap_cluster_list.json +++ b/src/app/zap_cluster_list.json @@ -110,7 +110,9 @@ "TARGET_NAVIGATOR_CLUSTER": [], "TEMPERATURE_CONTROL_CLUSTER": [], "TEMPERATURE_MEASUREMENT_CLUSTER": [], - "THERMOSTAT_CLUSTER": ["thermostat-client"], + "THERMOSTAT_CLUSTER": [ + "thermostat-client" + ], "THERMOSTAT_USER_INTERFACE_CONFIGURATION_CLUSTER": [], "THREAD_BORDER_ROUTER_MANAGEMENT_CLUSTER": [], "THREAD_NETWORK_DIAGNOSTICS_CLUSTER": [], @@ -135,8 +137,12 @@ "ENERGY_CALENDAR_CLUSTER": [], }, "ServerDirectories": { - "ACCESS_CONTROL_CLUSTER": ["access-control-server"], - "ACCOUNT_LOGIN_CLUSTER": ["account-login-server"], + "ACCESS_CONTROL_CLUSTER": [ + "access-control-server" + ], + "ACCOUNT_LOGIN_CLUSTER": [ + "account-login-server" + ], "ACTIONS_CLUSTER": [], "ACTIVATED_CARBON_FILTER_MONITORING_CLUSTER": [ "resource-monitoring-server" @@ -144,11 +150,19 @@ "ADMINISTRATOR_COMMISSIONING_CLUSTER": [ "administrator-commissioning-server" ], - "AIR_QUALITY_CLUSTER": ["air-quality-server"], + "AIR_QUALITY_CLUSTER": [ + "air-quality-server" + ], "ALARM_CLUSTER": [], - "APPLICATION_BASIC_CLUSTER": ["application-basic-server"], - "APPLICATION_LAUNCHER_CLUSTER": ["application-launcher-server"], - "AUDIO_OUTPUT_CLUSTER": ["audio-output-server"], + "APPLICATION_BASIC_CLUSTER": [ + "application-basic-server" + ], + "APPLICATION_LAUNCHER_CLUSTER": [ + "application-launcher-server" + ], + "AUDIO_OUTPUT_CLUSTER": [ + "audio-output-server" + ], "BALLAST_CONFIGURATION_CLUSTER": [], "BASIC_INFORMATION_CLUSTER": ["basic-information"], "BINDING_CLUSTER": ["bindings"], @@ -169,12 +183,24 @@ "COLOR_CONTROL_CLUSTER": ["color-control-server"], "COMMISSIONER_CONTROL_CLUSTER": ["commissioner-control-server"], "COMMISSIONING_CLUSTER": [], - "CONTENT_LAUNCHER_CLUSTER": ["content-launch-server"], - "CONTENT_CONTROL_CLUSTER": ["content-control-server"], - "CONTENT_APP_OBSERVER_CLUSTER": ["content-app-observer"], - "DESCRIPTOR_CLUSTER": ["descriptor"], - "DEVICE_ENERGY_MANAGEMENT_CLUSTER": ["device-energy-management-server"], - "DEVICE_ENERGY_MANAGEMENT_MODE_CLUSTER": ["mode-base-server"], + "CONTENT_LAUNCHER_CLUSTER": [ + "content-launch-server" + ], + "CONTENT_CONTROL_CLUSTER": [ + "content-control-server" + ], + "CONTENT_APP_OBSERVER_CLUSTER": [ + "content-app-observer" + ], + "DESCRIPTOR_CLUSTER": [ + "descriptor" + ], + "DEVICE_ENERGY_MANAGEMENT_CLUSTER": [ + "device-energy-management-server" + ], + "DEVICE_ENERGY_MANAGEMENT_MODE_CLUSTER": [ + "mode-base-server" + ], "DEVICE_TEMP_CLUSTER": [], "DIAGNOSTIC_LOGS_CLUSTER": ["diagnostic-logs-server"], "DISHWASHER_ALARM_CLUSTER": ["dishwasher-alarm-server"], @@ -188,15 +214,27 @@ "ELECTRICAL_POWER_MEASUREMENT_CLUSTER": [ "electrical-power-measurement-server" ], - "ENERGY_EVSE_CLUSTER": ["energy-evse-server"], - "ENERGY_EVSE_MODE_CLUSTER": ["mode-base-server"], + "ENERGY_EVSE_CLUSTER": [ + "energy-evse-server" + ], + "ENERGY_EVSE_MODE_CLUSTER": [ + "mode-base-server" + ], "ETHERNET_NETWORK_DIAGNOSTICS_CLUSTER": [ "ethernet-network-diagnostics-server" ], - "ENERGY_PREFERENCE_CLUSTER": ["energy-preference-server"], - "FAN_CONTROL_CLUSTER": ["fan-control-server"], - "FAULT_INJECTION_CLUSTER": ["fault-injection-server"], - "FIXED_LABEL_CLUSTER": ["fixed-label-server"], + "ENERGY_PREFERENCE_CLUSTER": [ + "energy-preference-server" + ], + "FAN_CONTROL_CLUSTER": [ + "fan-control-server" + ], + "FAULT_INJECTION_CLUSTER": [ + "fault-injection-server" + ], + "FIXED_LABEL_CLUSTER": [ + "fixed-label-server" + ], "FLOW_MEASUREMENT_CLUSTER": [], "FORMALDEHYDE_CONCENTRATION_MEASUREMENT_CLUSTER": [ "concentration-measurement-server" @@ -209,19 +247,39 @@ "ICD_MANAGEMENT_CLUSTER": ["icd-management-server"], "IDENTIFY_CLUSTER": ["identify-server"], "ILLUMINANCE_MEASUREMENT_CLUSTER": [], - "KEYPAD_INPUT_CLUSTER": ["keypad-input-server"], - "LAUNDRY_WASHER_MODE_CLUSTER": ["mode-base-server"], - "LEVEL_CONTROL_CLUSTER": ["level-control"], + "KEYPAD_INPUT_CLUSTER": [ + "keypad-input-server" + ], + "LAUNDRY_WASHER_MODE_CLUSTER": [ + "mode-base-server" + ], + "LEVEL_CONTROL_CLUSTER": [ + "level-control" + ], "LOCALIZATION_CONFIGURATION_CLUSTER": [ "localization-configuration-server" ], - "LOW_POWER_CLUSTER": ["low-power-server"], - "MEDIA_INPUT_CLUSTER": ["media-input-server"], - "MEDIA_PLAYBACK_CLUSTER": ["media-playback-server"], - "MICROWAVE_OVEN_CONTROL_CLUSTER": ["microwave-oven-control-server"], - "MESSAGES_CLUSTER": ["messages-server"], - "MODE_SELECT_CLUSTER": ["mode-select-server"], - "NETWORK_COMMISSIONING_CLUSTER": ["network-commissioning"], + "LOW_POWER_CLUSTER": [ + "low-power-server" + ], + "MEDIA_INPUT_CLUSTER": [ + "media-input-server" + ], + "MEDIA_PLAYBACK_CLUSTER": [ + "media-playback-server" + ], + "MICROWAVE_OVEN_CONTROL_CLUSTER": [ + "microwave-oven-control-server" + ], + "MESSAGES_CLUSTER": [ + "messages-server" + ], + "MODE_SELECT_CLUSTER": [ + "mode-select-server" + ], + "NETWORK_COMMISSIONING_CLUSTER": [ + "network-commissioning" + ], "NITROGEN_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER": [ "concentration-measurement-server" ], @@ -234,9 +292,15 @@ "OPERATIONAL_STATE_OVEN_CLUSTER": ["operational-state-server"], "OPERATIONAL_STATE_RVC_CLUSTER": ["operational-state-server"], "OTA_BOOTLOAD_CLUSTER": [], - "OTA_SOFTWARE_UPDATE_PROVIDER_CLUSTER": ["ota-provider"], - "OTA_SOFTWARE_UPDATE_REQUESTOR_CLUSTER": ["ota-requestor"], - "OVEN_MODE_CLUSTER": ["mode-base-server"], + "OTA_SOFTWARE_UPDATE_PROVIDER_CLUSTER": [ + "ota-provider" + ], + "OTA_SOFTWARE_UPDATE_REQUESTOR_CLUSTER": [ + "ota-requestor" + ], + "OVEN_MODE_CLUSTER": [ + "mode-base-server" + ], "OZONE_CONCENTRATION_MEASUREMENT_CLUSTER": [ "concentration-measurement-server" ], @@ -252,7 +316,9 @@ "POLL_CONTROL_CLUSTER": [], "POWER_CONFIG_CLUSTER": [], "POWER_PROFILE_CLUSTER": [], - "POWER_SOURCE_CLUSTER": ["power-source-server"], + "POWER_SOURCE_CLUSTER": [ + "power-source-server" + ], "POWER_SOURCE_CONFIGURATION_CLUSTER": [ "power-source-configuration-server" ], @@ -267,7 +333,9 @@ "RADON_CONCENTRATION_MEASUREMENT_CLUSTER": [ "concentration-measurement-server" ], - "REFRIGERATOR_ALARM_CLUSTER": ["refrigerator-alarm-server"], + "REFRIGERATOR_ALARM_CLUSTER": [ + "refrigerator-alarm-server" + ], "REFRIGERATOR_AND_TEMPERATURE_CONTROLLED_CABINET_MODE_CLUSTER": [ "mode-base-server" ], @@ -282,7 +350,9 @@ "TARGET_NAVIGATOR_CLUSTER": ["target-navigator-server"], "TEMPERATURE_CONTROL_CLUSTER": ["temperature-control-server"], "TEMPERATURE_MEASUREMENT_CLUSTER": [], - "THERMOSTAT_CLUSTER": ["thermostat-server"], + "THERMOSTAT_CLUSTER": [ + "thermostat-server" + ], "THERMOSTAT_USER_INTERFACE_CONFIGURATION_CLUSTER": [ "thermostat-user-interface-configuration-server" ], @@ -294,15 +364,25 @@ ], "THREAD_NETWORK_DIRECTORY_CLUSTER": ["thread-network-directory-server"], "TIME_CLUSTER": [], - "TIME_FORMAT_LOCALIZATION_CLUSTER": ["time-format-localization-server"], - "TIME_SYNCHRONIZATION_CLUSTER": ["time-synchronization-server"], - "TIMER_CLUSTER": ["timer-server"], + "TIME_FORMAT_LOCALIZATION_CLUSTER": [ + "time-format-localization-server" + ], + "TIME_SYNCHRONIZATION_CLUSTER": [ + "time-synchronization-server" + ], + "TIMER_CLUSTER": [ + "timer-server" + ], "TVOC_CONCENTRATION_MEASUREMENT_CLUSTER": [ "concentration-measurement-server" ], "UNIT_LOCALIZATION_CLUSTER": [], - "UNIT_TESTING_CLUSTER": ["test-cluster-server"], - "USER_LABEL_CLUSTER": ["user-label-server"], + "UNIT_TESTING_CLUSTER": [ + "test-cluster-server" + ], + "USER_LABEL_CLUSTER": [ + "user-label-server" + ], "VALVE_CONFIGURATION_AND_CONTROL_CLUSTER": [ "valve-configuration-and-control-server" ], @@ -315,5 +395,6 @@ "WATER_HEATER_MANAGEMENT_CLUSTER": ["water-heater-management-server"], "WATER_HEATER_MODE_CLUSTER": ["mode-base-server"] "ENERGY_CALENDAR_CLUSTER": ["energy-calendar-server"], + "ZLL_COMMISSIONING_CLUSTER": [] } -} +} \ No newline at end of file diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index a15ac804070aa5..4d96357eff344e 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -5439,7 +5439,7 @@ cluster EnergyEvse = 153 { /** The Energy Calendar Cluster provides a mechanism for communicating schedules associated with various forms of energy consumption. */ cluster EnergyCalendar = 154 { - revision 2; + revision 3; enum PeakPeriodSeverityEnum : enum8 { kUnused = 0; @@ -5483,30 +5483,23 @@ cluster EnergyCalendar = 154 { optional AuxiliaryLoadBitmap auxiliaryLoad = 3; } - struct Date { - optional nullable int16u year = 0; - optional nullable int8u month = 1; - optional nullable int8u day = 2; - optional nullable int8u dayOfWeek = 3; - } - struct DayStruct { - optional Date date = 0; + optional date date = 0; optional TransitionDayOfWeekBitmap daysOfWeek = 1; TransitionStruct transitions[] = 2; optional int32u calendarID = 3; } - struct CalendarPeriod { - epoch_s startDate = 0; + struct CalendarPeriodStruct { + nullable epoch_s startDate = 0; DayStruct days[] = 1; } struct PeakPeriodStruct { PeakPeriodSeverityEnum severity = 0; int16u peakPeriod = 1; - epoch_s startTime = 2; - epoch_s endTime = 3; + nullable epoch_s startTime = 2; + nullable epoch_s endTime = 3; } readonly attribute nullable int32u calendarID = 0; @@ -5514,8 +5507,8 @@ cluster EnergyCalendar = 154 { readonly attribute nullable int32u providerID = 2; readonly attribute nullable int32u eventID = 3; readonly attribute nullable epoch_s startDate = 4; - readonly attribute CalendarPeriod calendarPeriods[] = 5; - readonly attribute DayStruct specialDays[] = 6; + readonly attribute nullable CalendarPeriodStruct calendarPeriods[] = 5; + readonly attribute nullable DayStruct specialDays[] = 6; readonly attribute nullable DayStruct currentDay = 7; readonly attribute nullable DayStruct nextDay = 8; readonly attribute nullable TransitionStruct currentTransition = 9; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index d5feb9d01491d2..c0d433e67a0d90 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -32712,11 +32712,11 @@ public interface StartDateAttributeCallback extends BaseAttributeCallback { } public interface CalendarPeriodsAttributeCallback extends BaseAttributeCallback { - void onSuccess(List value); + void onSuccess(@Nullable List value); } public interface SpecialDaysAttributeCallback extends BaseAttributeCallback { - void onSuccess(List value); + void onSuccess(@Nullable List value); } public interface CurrentDayAttributeCallback extends BaseAttributeCallback { @@ -32892,7 +32892,7 @@ public void readCalendarPeriodsAttribute( readAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } }, CALENDAR_PERIODS_ATTRIBUTE_ID, true); @@ -32905,7 +32905,7 @@ public void subscribeCalendarPeriodsAttribute( subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } }, CALENDAR_PERIODS_ATTRIBUTE_ID, minInterval, maxInterval); @@ -32918,7 +32918,7 @@ public void readSpecialDaysAttribute( readAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } }, SPECIAL_DAYS_ATTRIBUTE_ID, true); @@ -32931,7 +32931,7 @@ public void subscribeSpecialDaysAttribute( subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } }, SPECIAL_DAYS_ATTRIBUTE_ID, minInterval, maxInterval); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index 5f9d88ef3b5054..4cbe6c8e2daeb1 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -8850,99 +8850,8 @@ public String toString() { return output.toString(); } } -public static class EnergyCalendarClusterDate { - public @Nullable Optional year; - public @Nullable Optional month; - public @Nullable Optional day; - public @Nullable Optional dayOfWeek; - private static final long YEAR_ID = 0L; - private static final long MONTH_ID = 1L; - private static final long DAY_ID = 2L; - private static final long DAY_OF_WEEK_ID = 3L; - - public EnergyCalendarClusterDate( - @Nullable Optional year, - @Nullable Optional month, - @Nullable Optional day, - @Nullable Optional dayOfWeek - ) { - this.year = year; - this.month = month; - this.day = day; - this.dayOfWeek = dayOfWeek; - } - - public StructType encodeTlv() { - ArrayList values = new ArrayList<>(); - values.add(new StructElement(YEAR_ID, year != null ? year.map((nonOptionalyear) -> new UIntType(nonOptionalyear)).orElse(new EmptyType()) : new NullType())); - values.add(new StructElement(MONTH_ID, month != null ? month.map((nonOptionalmonth) -> new UIntType(nonOptionalmonth)).orElse(new EmptyType()) : new NullType())); - values.add(new StructElement(DAY_ID, day != null ? day.map((nonOptionalday) -> new UIntType(nonOptionalday)).orElse(new EmptyType()) : new NullType())); - values.add(new StructElement(DAY_OF_WEEK_ID, dayOfWeek != null ? dayOfWeek.map((nonOptionaldayOfWeek) -> new UIntType(nonOptionaldayOfWeek)).orElse(new EmptyType()) : new NullType())); - - return new StructType(values); - } - - public static EnergyCalendarClusterDate decodeTlv(BaseTLVType tlvValue) { - if (tlvValue == null || tlvValue.type() != TLVType.Struct) { - return null; - } - @Nullable Optional year = null; - @Nullable Optional month = null; - @Nullable Optional day = null; - @Nullable Optional dayOfWeek = null; - for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == YEAR_ID) { - if (element.value(BaseTLVType.class).type() == TLVType.UInt) { - UIntType castingValue = element.value(UIntType.class); - year = Optional.of(castingValue.value(Integer.class)); - } - } else if (element.contextTagNum() == MONTH_ID) { - if (element.value(BaseTLVType.class).type() == TLVType.UInt) { - UIntType castingValue = element.value(UIntType.class); - month = Optional.of(castingValue.value(Integer.class)); - } - } else if (element.contextTagNum() == DAY_ID) { - if (element.value(BaseTLVType.class).type() == TLVType.UInt) { - UIntType castingValue = element.value(UIntType.class); - day = Optional.of(castingValue.value(Integer.class)); - } - } else if (element.contextTagNum() == DAY_OF_WEEK_ID) { - if (element.value(BaseTLVType.class).type() == TLVType.UInt) { - UIntType castingValue = element.value(UIntType.class); - dayOfWeek = Optional.of(castingValue.value(Integer.class)); - } - } - } - return new EnergyCalendarClusterDate( - year, - month, - day, - dayOfWeek - ); - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(); - output.append("EnergyCalendarClusterDate {\n"); - output.append("\tyear: "); - output.append(year); - output.append("\n"); - output.append("\tmonth: "); - output.append(month); - output.append("\n"); - output.append("\tday: "); - output.append(day); - output.append("\n"); - output.append("\tdayOfWeek: "); - output.append(dayOfWeek); - output.append("\n"); - output.append("}\n"); - return output.toString(); - } -} public static class EnergyCalendarClusterDayStruct { - public Optional date; + public Optional date; public Optional daysOfWeek; public ArrayList transitions; public Optional calendarID; @@ -8952,7 +8861,7 @@ public static class EnergyCalendarClusterDayStruct { private static final long CALENDAR_I_D_ID = 3L; public EnergyCalendarClusterDayStruct( - Optional date, + Optional date, Optional daysOfWeek, ArrayList transitions, Optional calendarID @@ -8965,7 +8874,7 @@ public EnergyCalendarClusterDayStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(DATE_ID, date.map((nonOptionaldate) -> nonOptionaldate.encodeTlv()).orElse(new EmptyType()))); + values.add(new StructElement(DATE_ID, date.map((nonOptionaldate) -> new UIntType(nonOptionaldate)).orElse(new EmptyType()))); values.add(new StructElement(DAYS_OF_WEEK_ID, daysOfWeek.map((nonOptionaldaysOfWeek) -> new UIntType(nonOptionaldaysOfWeek)).orElse(new EmptyType()))); values.add(new StructElement(TRANSITIONS_ID, ArrayType.generateArrayType(transitions, (elementtransitions) -> elementtransitions.encodeTlv()))); values.add(new StructElement(CALENDAR_I_D_ID, calendarID.map((nonOptionalcalendarID) -> new UIntType(nonOptionalcalendarID)).orElse(new EmptyType()))); @@ -8977,15 +8886,15 @@ public static EnergyCalendarClusterDayStruct decodeTlv(BaseTLVType tlvValue) { if (tlvValue == null || tlvValue.type() != TLVType.Struct) { return null; } - Optional date = Optional.empty(); + Optional date = Optional.empty(); Optional daysOfWeek = Optional.empty(); ArrayList transitions = null; Optional calendarID = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { if (element.contextTagNum() == DATE_ID) { - if (element.value(BaseTLVType.class).type() == TLVType.Struct) { - StructType castingValue = element.value(StructType.class); - date = Optional.of(ChipStructs.EnergyCalendarClusterDate.decodeTlv(castingValue)); + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + date = Optional.of(castingValue.value(Long.class)); } } else if (element.contextTagNum() == DAYS_OF_WEEK_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { @@ -9032,14 +8941,14 @@ public String toString() { return output.toString(); } } -public static class EnergyCalendarClusterCalendarPeriod { - public Long startDate; +public static class EnergyCalendarClusterCalendarPeriodStruct { + public @Nullable Long startDate; public ArrayList days; private static final long START_DATE_ID = 0L; private static final long DAYS_ID = 1L; - public EnergyCalendarClusterCalendarPeriod( - Long startDate, + public EnergyCalendarClusterCalendarPeriodStruct( + @Nullable Long startDate, ArrayList days ) { this.startDate = startDate; @@ -9048,17 +8957,17 @@ public EnergyCalendarClusterCalendarPeriod( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(START_DATE_ID, new UIntType(startDate))); + values.add(new StructElement(START_DATE_ID, startDate != null ? new UIntType(startDate) : new NullType())); values.add(new StructElement(DAYS_ID, ArrayType.generateArrayType(days, (elementdays) -> elementdays.encodeTlv()))); return new StructType(values); } - public static EnergyCalendarClusterCalendarPeriod decodeTlv(BaseTLVType tlvValue) { + public static EnergyCalendarClusterCalendarPeriodStruct decodeTlv(BaseTLVType tlvValue) { if (tlvValue == null || tlvValue.type() != TLVType.Struct) { return null; } - Long startDate = null; + @Nullable Long startDate = null; ArrayList days = null; for (StructElement element: ((StructType)tlvValue).value()) { if (element.contextTagNum() == START_DATE_ID) { @@ -9073,7 +8982,7 @@ public static EnergyCalendarClusterCalendarPeriod decodeTlv(BaseTLVType tlvValue } } } - return new EnergyCalendarClusterCalendarPeriod( + return new EnergyCalendarClusterCalendarPeriodStruct( startDate, days ); @@ -9082,7 +8991,7 @@ public static EnergyCalendarClusterCalendarPeriod decodeTlv(BaseTLVType tlvValue @Override public String toString() { StringBuilder output = new StringBuilder(); - output.append("EnergyCalendarClusterCalendarPeriod {\n"); + output.append("EnergyCalendarClusterCalendarPeriodStruct {\n"); output.append("\tstartDate: "); output.append(startDate); output.append("\n"); @@ -9096,8 +9005,8 @@ public String toString() { public static class EnergyCalendarClusterPeakPeriodStruct { public Integer severity; public Integer peakPeriod; - public Long startTime; - public Long endTime; + public @Nullable Long startTime; + public @Nullable Long endTime; private static final long SEVERITY_ID = 0L; private static final long PEAK_PERIOD_ID = 1L; private static final long START_TIME_ID = 2L; @@ -9106,8 +9015,8 @@ public static class EnergyCalendarClusterPeakPeriodStruct { public EnergyCalendarClusterPeakPeriodStruct( Integer severity, Integer peakPeriod, - Long startTime, - Long endTime + @Nullable Long startTime, + @Nullable Long endTime ) { this.severity = severity; this.peakPeriod = peakPeriod; @@ -9119,8 +9028,8 @@ public StructType encodeTlv() { ArrayList values = new ArrayList<>(); values.add(new StructElement(SEVERITY_ID, new UIntType(severity))); values.add(new StructElement(PEAK_PERIOD_ID, new UIntType(peakPeriod))); - values.add(new StructElement(START_TIME_ID, new UIntType(startTime))); - values.add(new StructElement(END_TIME_ID, new UIntType(endTime))); + values.add(new StructElement(START_TIME_ID, startTime != null ? new UIntType(startTime) : new NullType())); + values.add(new StructElement(END_TIME_ID, endTime != null ? new UIntType(endTime) : new NullType())); return new StructType(values); } @@ -9131,8 +9040,8 @@ public static EnergyCalendarClusterPeakPeriodStruct decodeTlv(BaseTLVType tlvVal } Integer severity = null; Integer peakPeriod = null; - Long startTime = null; - Long endTime = null; + @Nullable Long startTime = null; + @Nullable Long endTime = null; for (StructElement element: ((StructType)tlvValue).value()) { if (element.contextTagNum() == SEVERITY_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java index 2fa4a337767fe7..8e2e2efcad8095 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java @@ -11537,9 +11537,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(@Nullable List valueList) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -11558,7 +11558,7 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(@Nullable List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); responseValues.put(commandResponseInfo, valueList); diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni index 0a5b9bf25e1ed6..cdb840b563f936 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni @@ -71,8 +71,7 @@ structs_sources = [ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementAccuracyStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementRangeStruct.kt", - "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterCalendarPeriod.kt", - "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDate.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterCalendarPeriodStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterTransitionStruct.kt", diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterCalendarPeriodStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterCalendarPeriodStruct.kt new file mode 100644 index 00000000000000..ea44538217a6ce --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterCalendarPeriodStruct.kt @@ -0,0 +1,81 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * 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. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class EnergyCalendarClusterCalendarPeriodStruct( + val startDate: ULong?, + val days: List +) { + override fun toString(): String = buildString { + append("EnergyCalendarClusterCalendarPeriodStruct {\n") + append("\tstartDate : $startDate\n") + append("\tdays : $days\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (startDate != null) { + put(ContextSpecificTag(TAG_START_DATE), startDate) + } else { + putNull(ContextSpecificTag(TAG_START_DATE)) + } + startArray(ContextSpecificTag(TAG_DAYS)) + for (item in days.iterator()) { + item.toTlv(AnonymousTag, this) + } + endArray() + endStructure() + } + } + + companion object { + private const val TAG_START_DATE = 0 + private const val TAG_DAYS = 1 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyCalendarClusterCalendarPeriodStruct { + tlvReader.enterStructure(tlvTag) + val startDate = + if (!tlvReader.isNull()) { + tlvReader.getULong(ContextSpecificTag(TAG_START_DATE)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_START_DATE)) + null + } + val days = + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_DAYS)) + while (!tlvReader.isEndOfContainer()) { + add(EnergyCalendarClusterDayStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return EnergyCalendarClusterCalendarPeriodStruct(startDate, days) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt index da6e09f467c164..a2386cbcc12957 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt @@ -25,7 +25,7 @@ import matter.tlv.TlvReader import matter.tlv.TlvWriter class EnergyCalendarClusterDayStruct( - val date: Optional, + val date: Optional, val daysOfWeek: Optional, val transitions: List, val calendarID: Optional @@ -44,7 +44,7 @@ class EnergyCalendarClusterDayStruct( startStructure(tlvTag) if (date.isPresent) { val optdate = date.get() - optdate.toTlv(ContextSpecificTag(TAG_DATE), this) + put(ContextSpecificTag(TAG_DATE), optdate) } if (daysOfWeek.isPresent) { val optdaysOfWeek = daysOfWeek.get() @@ -73,7 +73,7 @@ class EnergyCalendarClusterDayStruct( tlvReader.enterStructure(tlvTag) val date = if (tlvReader.isNextTag(ContextSpecificTag(TAG_DATE))) { - Optional.of(EnergyCalendarClusterDate.fromTlv(ContextSpecificTag(TAG_DATE), tlvReader)) + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_DATE))) } else { Optional.empty() } diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt index 51125536bd8767..962a0bb1e1a46c 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt @@ -25,8 +25,8 @@ import matter.tlv.TlvWriter class EnergyCalendarClusterPeakPeriodStruct( val severity: UInt, val peakPeriod: UInt, - val startTime: ULong, - val endTime: ULong + val startTime: ULong?, + val endTime: ULong? ) { override fun toString(): String = buildString { append("EnergyCalendarClusterPeakPeriodStruct {\n") @@ -42,8 +42,16 @@ class EnergyCalendarClusterPeakPeriodStruct( startStructure(tlvTag) put(ContextSpecificTag(TAG_SEVERITY), severity) put(ContextSpecificTag(TAG_PEAK_PERIOD), peakPeriod) - put(ContextSpecificTag(TAG_START_TIME), startTime) - put(ContextSpecificTag(TAG_END_TIME), endTime) + if (startTime != null) { + put(ContextSpecificTag(TAG_START_TIME), startTime) + } else { + putNull(ContextSpecificTag(TAG_START_TIME)) + } + if (endTime != null) { + put(ContextSpecificTag(TAG_END_TIME), endTime) + } else { + putNull(ContextSpecificTag(TAG_END_TIME)) + } endStructure() } } @@ -58,8 +66,20 @@ class EnergyCalendarClusterPeakPeriodStruct( tlvReader.enterStructure(tlvTag) val severity = tlvReader.getUInt(ContextSpecificTag(TAG_SEVERITY)) val peakPeriod = tlvReader.getUInt(ContextSpecificTag(TAG_PEAK_PERIOD)) - val startTime = tlvReader.getULong(ContextSpecificTag(TAG_START_TIME)) - val endTime = tlvReader.getULong(ContextSpecificTag(TAG_END_TIME)) + val startTime = + if (!tlvReader.isNull()) { + tlvReader.getULong(ContextSpecificTag(TAG_START_TIME)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_START_TIME)) + null + } + val endTime = + if (!tlvReader.isNull()) { + tlvReader.getULong(ContextSpecificTag(TAG_END_TIME)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_END_TIME)) + null + } tlvReader.exitContainer() diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyCalendarCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyCalendarCluster.kt index a6357499fcdde8..242d4aa724f180 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyCalendarCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyCalendarCluster.kt @@ -88,10 +88,10 @@ class EnergyCalendarCluster( object SubscriptionEstablished : StartDateAttributeSubscriptionState() } - class CalendarPeriodsAttribute(val value: List) + class CalendarPeriodsAttribute(val value: List?) sealed class CalendarPeriodsAttributeSubscriptionState { - data class Success(val value: List) : + data class Success(val value: List?) : CalendarPeriodsAttributeSubscriptionState() data class Error(val exception: Exception) : CalendarPeriodsAttributeSubscriptionState() @@ -99,10 +99,10 @@ class EnergyCalendarCluster( object SubscriptionEstablished : CalendarPeriodsAttributeSubscriptionState() } - class SpecialDaysAttribute(val value: List) + class SpecialDaysAttribute(val value: List?) sealed class SpecialDaysAttributeSubscriptionState { - data class Success(val value: List) : + data class Success(val value: List?) : SpecialDaysAttributeSubscriptionState() data class Error(val exception: Exception) : SpecialDaysAttributeSubscriptionState() @@ -696,13 +696,18 @@ class EnergyCalendarCluster( // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: List = - buildList { - tlvReader.enterArray(AnonymousTag) - while (!tlvReader.isEndOfContainer()) { - add(EnergyCalendarClusterCalendarPeriod.fromTlv(AnonymousTag, tlvReader)) + val decodedValue: List? = + if (!tlvReader.isNull()) { + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(EnergyCalendarClusterCalendarPeriodStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() } - tlvReader.exitContainer() + } else { + tlvReader.getNull(AnonymousTag) + null } return CalendarPeriodsAttribute(decodedValue) @@ -749,16 +754,21 @@ class EnergyCalendarCluster( // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: List = - buildList { - tlvReader.enterArray(AnonymousTag) - while (!tlvReader.isEndOfContainer()) { - add(EnergyCalendarClusterCalendarPeriod.fromTlv(AnonymousTag, tlvReader)) + val decodedValue: List? = + if (!tlvReader.isNull()) { + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(EnergyCalendarClusterCalendarPeriodStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() } - tlvReader.exitContainer() + } else { + tlvReader.getNull(AnonymousTag) + null } - emit(CalendarPeriodsAttributeSubscriptionState.Success(decodedValue)) + decodedValue?.let { emit(CalendarPeriodsAttributeSubscriptionState.Success(it)) } } SubscriptionState.SubscriptionEstablished -> { emit(CalendarPeriodsAttributeSubscriptionState.SubscriptionEstablished) @@ -793,13 +803,18 @@ class EnergyCalendarCluster( // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: List = - buildList { - tlvReader.enterArray(AnonymousTag) - while (!tlvReader.isEndOfContainer()) { - add(EnergyCalendarClusterDayStruct.fromTlv(AnonymousTag, tlvReader)) + val decodedValue: List? = + if (!tlvReader.isNull()) { + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(EnergyCalendarClusterDayStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() } - tlvReader.exitContainer() + } else { + tlvReader.getNull(AnonymousTag) + null } return SpecialDaysAttribute(decodedValue) @@ -844,16 +859,21 @@ class EnergyCalendarCluster( // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: List = - buildList { - tlvReader.enterArray(AnonymousTag) - while (!tlvReader.isEndOfContainer()) { - add(EnergyCalendarClusterDayStruct.fromTlv(AnonymousTag, tlvReader)) + val decodedValue: List? = + if (!tlvReader.isNull()) { + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(EnergyCalendarClusterDayStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() } - tlvReader.exitContainer() + } else { + tlvReader.getNull(AnonymousTag) + null } - emit(SpecialDaysAttributeSubscriptionState.Success(decodedValue)) + decodedValue?.let { emit(SpecialDaysAttributeSubscriptionState.Success(it)) } } SubscriptionState.SubscriptionEstablished -> { emit(SpecialDaysAttributeSubscriptionState.SubscriptionEstablished) diff --git a/src/controller/java/generated/java/matter/controller/cluster/files.gni b/src/controller/java/generated/java/matter/controller/cluster/files.gni index 5017b360c1b24b..3e99c3837fa529 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/files.gni +++ b/src/controller/java/generated/java/matter/controller/cluster/files.gni @@ -71,8 +71,7 @@ matter_structs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementAccuracyStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementRangeStruct.kt", - "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterCalendarPeriod.kt", - "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDate.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterCalendarPeriodStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterTransitionStruct.kt", diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterCalendarPeriodStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterCalendarPeriodStruct.kt new file mode 100644 index 00000000000000..e32c8bdc7d8094 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterCalendarPeriodStruct.kt @@ -0,0 +1,81 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * 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. + */ +package matter.controller.cluster.structs + +import matter.controller.cluster.* +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class EnergyCalendarClusterCalendarPeriodStruct( + val startDate: UInt?, + val days: List +) { + override fun toString(): String = buildString { + append("EnergyCalendarClusterCalendarPeriodStruct {\n") + append("\tstartDate : $startDate\n") + append("\tdays : $days\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (startDate != null) { + put(ContextSpecificTag(TAG_START_DATE), startDate) + } else { + putNull(ContextSpecificTag(TAG_START_DATE)) + } + startArray(ContextSpecificTag(TAG_DAYS)) + for (item in days.iterator()) { + item.toTlv(AnonymousTag, this) + } + endArray() + endStructure() + } + } + + companion object { + private const val TAG_START_DATE = 0 + private const val TAG_DAYS = 1 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyCalendarClusterCalendarPeriodStruct { + tlvReader.enterStructure(tlvTag) + val startDate = + if (!tlvReader.isNull()) { + tlvReader.getUInt(ContextSpecificTag(TAG_START_DATE)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_START_DATE)) + null + } + val days = + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_DAYS)) + while (!tlvReader.isEndOfContainer()) { + add(EnergyCalendarClusterDayStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return EnergyCalendarClusterCalendarPeriodStruct(startDate, days) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt index c27a9bff26e20b..7efced98109f2c 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt @@ -25,7 +25,7 @@ import matter.tlv.TlvReader import matter.tlv.TlvWriter class EnergyCalendarClusterDayStruct( - val date: Optional, + val date: Optional, val daysOfWeek: Optional, val transitions: List, val calendarID: Optional @@ -44,7 +44,7 @@ class EnergyCalendarClusterDayStruct( startStructure(tlvTag) if (date.isPresent) { val optdate = date.get() - optdate.toTlv(ContextSpecificTag(TAG_DATE), this) + put(ContextSpecificTag(TAG_DATE), optdate) } if (daysOfWeek.isPresent) { val optdaysOfWeek = daysOfWeek.get() @@ -73,7 +73,7 @@ class EnergyCalendarClusterDayStruct( tlvReader.enterStructure(tlvTag) val date = if (tlvReader.isNextTag(ContextSpecificTag(TAG_DATE))) { - Optional.of(EnergyCalendarClusterDate.fromTlv(ContextSpecificTag(TAG_DATE), tlvReader)) + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_DATE))) } else { Optional.empty() } diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt index be9f72ed83e2bf..51cd331853ae98 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt @@ -25,8 +25,8 @@ import matter.tlv.TlvWriter class EnergyCalendarClusterPeakPeriodStruct( val severity: UByte, val peakPeriod: UShort, - val startTime: UInt, - val endTime: UInt + val startTime: UInt?, + val endTime: UInt? ) { override fun toString(): String = buildString { append("EnergyCalendarClusterPeakPeriodStruct {\n") @@ -42,8 +42,16 @@ class EnergyCalendarClusterPeakPeriodStruct( startStructure(tlvTag) put(ContextSpecificTag(TAG_SEVERITY), severity) put(ContextSpecificTag(TAG_PEAK_PERIOD), peakPeriod) - put(ContextSpecificTag(TAG_START_TIME), startTime) - put(ContextSpecificTag(TAG_END_TIME), endTime) + if (startTime != null) { + put(ContextSpecificTag(TAG_START_TIME), startTime) + } else { + putNull(ContextSpecificTag(TAG_START_TIME)) + } + if (endTime != null) { + put(ContextSpecificTag(TAG_END_TIME), endTime) + } else { + putNull(ContextSpecificTag(TAG_END_TIME)) + } endStructure() } } @@ -58,8 +66,20 @@ class EnergyCalendarClusterPeakPeriodStruct( tlvReader.enterStructure(tlvTag) val severity = tlvReader.getUByte(ContextSpecificTag(TAG_SEVERITY)) val peakPeriod = tlvReader.getUShort(ContextSpecificTag(TAG_PEAK_PERIOD)) - val startTime = tlvReader.getUInt(ContextSpecificTag(TAG_START_TIME)) - val endTime = tlvReader.getUInt(ContextSpecificTag(TAG_END_TIME)) + val startTime = + if (!tlvReader.isNull()) { + tlvReader.getUInt(ContextSpecificTag(TAG_START_TIME)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_START_TIME)) + null + } + val endTime = + if (!tlvReader.isNull()) { + tlvReader.getUInt(ContextSpecificTag(TAG_END_TIME)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_END_TIME)) + null + } tlvReader.exitContainer() diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index a5788b988b4a97..5aa0af60b4a9bb 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -25077,353 +25077,242 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR return nullptr; } jobject value; - chip::JniReferences::GetInstance().CreateArrayList(value); - - auto iter_value_0 = cppValue.begin(); - while (iter_value_0.Next()) + if (cppValue.IsNull()) { - auto & entry_0 = iter_value_0.GetValue(); - jobject newElement_0; - jobject newElement_0_startDate; - std::string newElement_0_startDateClassName = "java/lang/Long"; - std::string newElement_0_startDateCtorSignature = "(J)V"; - jlong jninewElement_0_startDate = static_cast(entry_0.startDate); - chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_startDateClassName.c_str(), - newElement_0_startDateCtorSignature.c_str(), - jninewElement_0_startDate, newElement_0_startDate); - jobject newElement_0_days; - chip::JniReferences::GetInstance().CreateArrayList(newElement_0_days); + value = nullptr; + } + else + { + chip::JniReferences::GetInstance().CreateArrayList(value); - auto iter_newElement_0_days_2 = entry_0.days.begin(); - while (iter_newElement_0_days_2.Next()) + auto iter_value_1 = cppValue.Value().begin(); + while (iter_value_1.Next()) { - auto & entry_2 = iter_newElement_0_days_2.GetValue(); - jobject newElement_2; - jobject newElement_2_date; - if (!entry_2.date.HasValue()) + auto & entry_1 = iter_value_1.GetValue(); + jobject newElement_1; + jobject newElement_1_startDate; + if (entry_1.startDate.IsNull()) { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_date); + newElement_1_startDate = nullptr; } else { - jobject newElement_2_dateInsideOptional; - jobject newElement_2_dateInsideOptional_year; - if (!entry_2.date.Value().year.HasValue()) + std::string newElement_1_startDateClassName = "java/lang/Long"; + std::string newElement_1_startDateCtorSignature = "(J)V"; + jlong jninewElement_1_startDate = static_cast(entry_1.startDate.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_1_startDateClassName.c_str(), newElement_1_startDateCtorSignature.c_str(), + jninewElement_1_startDate, newElement_1_startDate); + } + jobject newElement_1_days; + chip::JniReferences::GetInstance().CreateArrayList(newElement_1_days); + + auto iter_newElement_1_days_3 = entry_1.days.begin(); + while (iter_newElement_1_days_3.Next()) + { + auto & entry_3 = iter_newElement_1_days_3.GetValue(); + jobject newElement_3; + jobject newElement_3_date; + if (!entry_3.date.HasValue()) { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_dateInsideOptional_year); + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_3_date); } else { - jobject newElement_2_dateInsideOptional_yearInsideOptional; - if (entry_2.date.Value().year.Value().IsNull()) - { - newElement_2_dateInsideOptional_yearInsideOptional = nullptr; - } - else - { - std::string newElement_2_dateInsideOptional_yearInsideOptionalClassName = "java/lang/Integer"; - std::string newElement_2_dateInsideOptional_yearInsideOptionalCtorSignature = "(I)V"; - jint jninewElement_2_dateInsideOptional_yearInsideOptional = - static_cast(entry_2.date.Value().year.Value().Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_2_dateInsideOptional_yearInsideOptionalClassName.c_str(), - newElement_2_dateInsideOptional_yearInsideOptionalCtorSignature.c_str(), - jninewElement_2_dateInsideOptional_yearInsideOptional, - newElement_2_dateInsideOptional_yearInsideOptional); - } - chip::JniReferences::GetInstance().CreateOptional(newElement_2_dateInsideOptional_yearInsideOptional, - newElement_2_dateInsideOptional_year); + jobject newElement_3_dateInsideOptional; + std::string newElement_3_dateInsideOptionalClassName = "java/lang/Long"; + std::string newElement_3_dateInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_3_dateInsideOptional = static_cast(entry_3.date.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_3_dateInsideOptionalClassName.c_str(), + newElement_3_dateInsideOptionalCtorSignature.c_str(), jninewElement_3_dateInsideOptional, + newElement_3_dateInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_3_dateInsideOptional, newElement_3_date); } - jobject newElement_2_dateInsideOptional_month; - if (!entry_2.date.Value().month.HasValue()) + jobject newElement_3_daysOfWeek; + if (!entry_3.daysOfWeek.HasValue()) { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_dateInsideOptional_month); + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_3_daysOfWeek); } else { - jobject newElement_2_dateInsideOptional_monthInsideOptional; - if (entry_2.date.Value().month.Value().IsNull()) + jobject newElement_3_daysOfWeekInsideOptional; + std::string newElement_3_daysOfWeekInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_3_daysOfWeekInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_3_daysOfWeekInsideOptional = static_cast(entry_3.daysOfWeek.Value().Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_3_daysOfWeekInsideOptionalClassName.c_str(), + newElement_3_daysOfWeekInsideOptionalCtorSignature.c_str(), + jninewElement_3_daysOfWeekInsideOptional, newElement_3_daysOfWeekInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_3_daysOfWeekInsideOptional, + newElement_3_daysOfWeek); + } + jobject newElement_3_transitions; + chip::JniReferences::GetInstance().CreateArrayList(newElement_3_transitions); + + auto iter_newElement_3_transitions_5 = entry_3.transitions.begin(); + while (iter_newElement_3_transitions_5.Next()) + { + auto & entry_5 = iter_newElement_3_transitions_5.GetValue(); + jobject newElement_5; + jobject newElement_5_transitionTime; + std::string newElement_5_transitionTimeClassName = "java/lang/Integer"; + std::string newElement_5_transitionTimeCtorSignature = "(I)V"; + jint jninewElement_5_transitionTime = static_cast(entry_5.transitionTime); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_5_transitionTimeClassName.c_str(), newElement_5_transitionTimeCtorSignature.c_str(), + jninewElement_5_transitionTime, newElement_5_transitionTime); + jobject newElement_5_priceTier; + if (!entry_5.priceTier.HasValue()) { - newElement_2_dateInsideOptional_monthInsideOptional = nullptr; + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_5_priceTier); } else { - std::string newElement_2_dateInsideOptional_monthInsideOptionalClassName = "java/lang/Integer"; - std::string newElement_2_dateInsideOptional_monthInsideOptionalCtorSignature = "(I)V"; - jint jninewElement_2_dateInsideOptional_monthInsideOptional = - static_cast(entry_2.date.Value().month.Value().Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_2_dateInsideOptional_monthInsideOptionalClassName.c_str(), - newElement_2_dateInsideOptional_monthInsideOptionalCtorSignature.c_str(), - jninewElement_2_dateInsideOptional_monthInsideOptional, - newElement_2_dateInsideOptional_monthInsideOptional); + jobject newElement_5_priceTierInsideOptional; + std::string newElement_5_priceTierInsideOptionalClassName = "java/lang/Long"; + std::string newElement_5_priceTierInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_5_priceTierInsideOptional = static_cast(entry_5.priceTier.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_5_priceTierInsideOptionalClassName.c_str(), + newElement_5_priceTierInsideOptionalCtorSignature.c_str(), + jninewElement_5_priceTierInsideOptional, newElement_5_priceTierInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_5_priceTierInsideOptional, + newElement_5_priceTier); } - chip::JniReferences::GetInstance().CreateOptional(newElement_2_dateInsideOptional_monthInsideOptional, - newElement_2_dateInsideOptional_month); - } - jobject newElement_2_dateInsideOptional_day; - if (!entry_2.date.Value().day.HasValue()) - { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_dateInsideOptional_day); - } - else - { - jobject newElement_2_dateInsideOptional_dayInsideOptional; - if (entry_2.date.Value().day.Value().IsNull()) + jobject newElement_5_friendlyCredit; + if (!entry_5.friendlyCredit.HasValue()) { - newElement_2_dateInsideOptional_dayInsideOptional = nullptr; + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_5_friendlyCredit); } else { - std::string newElement_2_dateInsideOptional_dayInsideOptionalClassName = "java/lang/Integer"; - std::string newElement_2_dateInsideOptional_dayInsideOptionalCtorSignature = "(I)V"; - jint jninewElement_2_dateInsideOptional_dayInsideOptional = - static_cast(entry_2.date.Value().day.Value().Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_2_dateInsideOptional_dayInsideOptionalClassName.c_str(), - newElement_2_dateInsideOptional_dayInsideOptionalCtorSignature.c_str(), - jninewElement_2_dateInsideOptional_dayInsideOptional, - newElement_2_dateInsideOptional_dayInsideOptional); + jobject newElement_5_friendlyCreditInsideOptional; + std::string newElement_5_friendlyCreditInsideOptionalClassName = "java/lang/Boolean"; + std::string newElement_5_friendlyCreditInsideOptionalCtorSignature = "(Z)V"; + jboolean jninewElement_5_friendlyCreditInsideOptional = + static_cast(entry_5.friendlyCredit.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_5_friendlyCreditInsideOptionalClassName.c_str(), + newElement_5_friendlyCreditInsideOptionalCtorSignature.c_str(), + jninewElement_5_friendlyCreditInsideOptional, newElement_5_friendlyCreditInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_5_friendlyCreditInsideOptional, + newElement_5_friendlyCredit); } - chip::JniReferences::GetInstance().CreateOptional(newElement_2_dateInsideOptional_dayInsideOptional, - newElement_2_dateInsideOptional_day); - } - jobject newElement_2_dateInsideOptional_dayOfWeek; - if (!entry_2.date.Value().dayOfWeek.HasValue()) - { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_dateInsideOptional_dayOfWeek); - } - else - { - jobject newElement_2_dateInsideOptional_dayOfWeekInsideOptional; - if (entry_2.date.Value().dayOfWeek.Value().IsNull()) + jobject newElement_5_auxiliaryLoad; + if (!entry_5.auxiliaryLoad.HasValue()) { - newElement_2_dateInsideOptional_dayOfWeekInsideOptional = nullptr; + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_5_auxiliaryLoad); } else { - std::string newElement_2_dateInsideOptional_dayOfWeekInsideOptionalClassName = "java/lang/Integer"; - std::string newElement_2_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature = "(I)V"; - jint jninewElement_2_dateInsideOptional_dayOfWeekInsideOptional = - static_cast(entry_2.date.Value().dayOfWeek.Value().Value()); + jobject newElement_5_auxiliaryLoadInsideOptional; + std::string newElement_5_auxiliaryLoadInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_5_auxiliaryLoadInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_5_auxiliaryLoadInsideOptional = + static_cast(entry_5.auxiliaryLoad.Value().Raw()); chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_2_dateInsideOptional_dayOfWeekInsideOptionalClassName.c_str(), - newElement_2_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature.c_str(), - jninewElement_2_dateInsideOptional_dayOfWeekInsideOptional, - newElement_2_dateInsideOptional_dayOfWeekInsideOptional); + newElement_5_auxiliaryLoadInsideOptionalClassName.c_str(), + newElement_5_auxiliaryLoadInsideOptionalCtorSignature.c_str(), + jninewElement_5_auxiliaryLoadInsideOptional, newElement_5_auxiliaryLoadInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_5_auxiliaryLoadInsideOptional, + newElement_5_auxiliaryLoad); } - chip::JniReferences::GetInstance().CreateOptional( - newElement_2_dateInsideOptional_dayOfWeekInsideOptional, newElement_2_dateInsideOptional_dayOfWeek); - } - - jclass dateStructClass_5; - err = chip::JniReferences::GetInstance().GetLocalClassRef( - env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterDate", dateStructClass_5); - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterDate"); - return nullptr; - } - jmethodID dateStructCtor_5; - err = chip::JniReferences::GetInstance().FindMethod( - env, dateStructClass_5, "", - "(Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V", - &dateStructCtor_5); - if (err != CHIP_NO_ERROR || dateStructCtor_5 == nullptr) - { - ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterDate constructor"); - return nullptr; - } + jclass transitionStructStructClass_6; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterTransitionStruct", + transitionStructStructClass_6); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterTransitionStruct"); + return nullptr; + } - newElement_2_dateInsideOptional = - env->NewObject(dateStructClass_5, dateStructCtor_5, newElement_2_dateInsideOptional_year, - newElement_2_dateInsideOptional_month, newElement_2_dateInsideOptional_day, - newElement_2_dateInsideOptional_dayOfWeek); - chip::JniReferences::GetInstance().CreateOptional(newElement_2_dateInsideOptional, newElement_2_date); - } - jobject newElement_2_daysOfWeek; - if (!entry_2.daysOfWeek.HasValue()) - { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_daysOfWeek); - } - else - { - jobject newElement_2_daysOfWeekInsideOptional; - std::string newElement_2_daysOfWeekInsideOptionalClassName = "java/lang/Integer"; - std::string newElement_2_daysOfWeekInsideOptionalCtorSignature = "(I)V"; - jint jninewElement_2_daysOfWeekInsideOptional = static_cast(entry_2.daysOfWeek.Value().Raw()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_2_daysOfWeekInsideOptionalClassName.c_str(), - newElement_2_daysOfWeekInsideOptionalCtorSignature.c_str(), jninewElement_2_daysOfWeekInsideOptional, - newElement_2_daysOfWeekInsideOptional); - chip::JniReferences::GetInstance().CreateOptional(newElement_2_daysOfWeekInsideOptional, - newElement_2_daysOfWeek); - } - jobject newElement_2_transitions; - chip::JniReferences::GetInstance().CreateArrayList(newElement_2_transitions); + jmethodID transitionStructStructCtor_6; + err = chip::JniReferences::GetInstance().FindMethod( + env, transitionStructStructClass_6, "", + "(Ljava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V", + &transitionStructStructCtor_6); + if (err != CHIP_NO_ERROR || transitionStructStructCtor_6 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterTransitionStruct constructor"); + return nullptr; + } - auto iter_newElement_2_transitions_4 = entry_2.transitions.begin(); - while (iter_newElement_2_transitions_4.Next()) - { - auto & entry_4 = iter_newElement_2_transitions_4.GetValue(); - jobject newElement_4; - jobject newElement_4_transitionTime; - std::string newElement_4_transitionTimeClassName = "java/lang/Integer"; - std::string newElement_4_transitionTimeCtorSignature = "(I)V"; - jint jninewElement_4_transitionTime = static_cast(entry_4.transitionTime); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_4_transitionTimeClassName.c_str(), newElement_4_transitionTimeCtorSignature.c_str(), - jninewElement_4_transitionTime, newElement_4_transitionTime); - jobject newElement_4_priceTier; - if (!entry_4.priceTier.HasValue()) - { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_4_priceTier); - } - else - { - jobject newElement_4_priceTierInsideOptional; - std::string newElement_4_priceTierInsideOptionalClassName = "java/lang/Long"; - std::string newElement_4_priceTierInsideOptionalCtorSignature = "(J)V"; - jlong jninewElement_4_priceTierInsideOptional = static_cast(entry_4.priceTier.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_4_priceTierInsideOptionalClassName.c_str(), - newElement_4_priceTierInsideOptionalCtorSignature.c_str(), jninewElement_4_priceTierInsideOptional, - newElement_4_priceTierInsideOptional); - chip::JniReferences::GetInstance().CreateOptional(newElement_4_priceTierInsideOptional, - newElement_4_priceTier); - } - jobject newElement_4_friendlyCredit; - if (!entry_4.friendlyCredit.HasValue()) - { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_4_friendlyCredit); - } - else - { - jobject newElement_4_friendlyCreditInsideOptional; - std::string newElement_4_friendlyCreditInsideOptionalClassName = "java/lang/Boolean"; - std::string newElement_4_friendlyCreditInsideOptionalCtorSignature = "(Z)V"; - jboolean jninewElement_4_friendlyCreditInsideOptional = - static_cast(entry_4.friendlyCredit.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_4_friendlyCreditInsideOptionalClassName.c_str(), - newElement_4_friendlyCreditInsideOptionalCtorSignature.c_str(), - jninewElement_4_friendlyCreditInsideOptional, newElement_4_friendlyCreditInsideOptional); - chip::JniReferences::GetInstance().CreateOptional(newElement_4_friendlyCreditInsideOptional, - newElement_4_friendlyCredit); + newElement_5 = env->NewObject(transitionStructStructClass_6, transitionStructStructCtor_6, + newElement_5_transitionTime, newElement_5_priceTier, + newElement_5_friendlyCredit, newElement_5_auxiliaryLoad); + chip::JniReferences::GetInstance().AddToList(newElement_3_transitions, newElement_5); } - jobject newElement_4_auxiliaryLoad; - if (!entry_4.auxiliaryLoad.HasValue()) + jobject newElement_3_calendarID; + if (!entry_3.calendarID.HasValue()) { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_4_auxiliaryLoad); + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_3_calendarID); } else { - jobject newElement_4_auxiliaryLoadInsideOptional; - std::string newElement_4_auxiliaryLoadInsideOptionalClassName = "java/lang/Integer"; - std::string newElement_4_auxiliaryLoadInsideOptionalCtorSignature = "(I)V"; - jint jninewElement_4_auxiliaryLoadInsideOptional = - static_cast(entry_4.auxiliaryLoad.Value().Raw()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_4_auxiliaryLoadInsideOptionalClassName.c_str(), - newElement_4_auxiliaryLoadInsideOptionalCtorSignature.c_str(), - jninewElement_4_auxiliaryLoadInsideOptional, newElement_4_auxiliaryLoadInsideOptional); - chip::JniReferences::GetInstance().CreateOptional(newElement_4_auxiliaryLoadInsideOptional, - newElement_4_auxiliaryLoad); + jobject newElement_3_calendarIDInsideOptional; + std::string newElement_3_calendarIDInsideOptionalClassName = "java/lang/Long"; + std::string newElement_3_calendarIDInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_3_calendarIDInsideOptional = static_cast(entry_3.calendarID.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_3_calendarIDInsideOptionalClassName.c_str(), + newElement_3_calendarIDInsideOptionalCtorSignature.c_str(), + jninewElement_3_calendarIDInsideOptional, newElement_3_calendarIDInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_3_calendarIDInsideOptional, + newElement_3_calendarID); } - jclass transitionStructStructClass_5; + jclass dayStructStructClass_4; err = chip::JniReferences::GetInstance().GetLocalClassRef( - env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterTransitionStruct", - transitionStructStructClass_5); + env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterDayStruct", dayStructStructClass_4); if (err != CHIP_NO_ERROR) { - ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterTransitionStruct"); + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterDayStruct"); return nullptr; } - jmethodID transitionStructStructCtor_5; + jmethodID dayStructStructCtor_4; err = chip::JniReferences::GetInstance().FindMethod( - env, transitionStructStructClass_5, "", - "(Ljava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V", - &transitionStructStructCtor_5); - if (err != CHIP_NO_ERROR || transitionStructStructCtor_5 == nullptr) + env, dayStructStructClass_4, "", + "(Ljava/util/Optional;Ljava/util/Optional;Ljava/util/ArrayList;Ljava/util/Optional;)V", + &dayStructStructCtor_4); + if (err != CHIP_NO_ERROR || dayStructStructCtor_4 == nullptr) { - ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterTransitionStruct constructor"); + ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterDayStruct constructor"); return nullptr; } - newElement_4 = - env->NewObject(transitionStructStructClass_5, transitionStructStructCtor_5, newElement_4_transitionTime, - newElement_4_priceTier, newElement_4_friendlyCredit, newElement_4_auxiliaryLoad); - chip::JniReferences::GetInstance().AddToList(newElement_2_transitions, newElement_4); - } - jobject newElement_2_calendarID; - if (!entry_2.calendarID.HasValue()) - { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_calendarID); - } - else - { - jobject newElement_2_calendarIDInsideOptional; - std::string newElement_2_calendarIDInsideOptionalClassName = "java/lang/Long"; - std::string newElement_2_calendarIDInsideOptionalCtorSignature = "(J)V"; - jlong jninewElement_2_calendarIDInsideOptional = static_cast(entry_2.calendarID.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_2_calendarIDInsideOptionalClassName.c_str(), - newElement_2_calendarIDInsideOptionalCtorSignature.c_str(), jninewElement_2_calendarIDInsideOptional, - newElement_2_calendarIDInsideOptional); - chip::JniReferences::GetInstance().CreateOptional(newElement_2_calendarIDInsideOptional, - newElement_2_calendarID); + newElement_3 = env->NewObject(dayStructStructClass_4, dayStructStructCtor_4, newElement_3_date, + newElement_3_daysOfWeek, newElement_3_transitions, newElement_3_calendarID); + chip::JniReferences::GetInstance().AddToList(newElement_1_days, newElement_3); } - jclass dayStructStructClass_3; + jclass calendarPeriodStructStructClass_2; err = chip::JniReferences::GetInstance().GetLocalClassRef( - env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterDayStruct", dayStructStructClass_3); + env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterCalendarPeriodStruct", + calendarPeriodStructStructClass_2); if (err != CHIP_NO_ERROR) { - ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterDayStruct"); + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterCalendarPeriodStruct"); return nullptr; } - jmethodID dayStructStructCtor_3; - err = chip::JniReferences::GetInstance().FindMethod( - env, dayStructStructClass_3, "", - "(Ljava/util/Optional;Ljava/util/Optional;Ljava/util/ArrayList;Ljava/util/Optional;)V", - &dayStructStructCtor_3); - if (err != CHIP_NO_ERROR || dayStructStructCtor_3 == nullptr) + jmethodID calendarPeriodStructStructCtor_2; + err = chip::JniReferences::GetInstance().FindMethod(env, calendarPeriodStructStructClass_2, "", + "(Ljava/lang/Long;Ljava/util/ArrayList;)V", + &calendarPeriodStructStructCtor_2); + if (err != CHIP_NO_ERROR || calendarPeriodStructStructCtor_2 == nullptr) { - ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterDayStruct constructor"); + ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterCalendarPeriodStruct constructor"); return nullptr; } - newElement_2 = env->NewObject(dayStructStructClass_3, dayStructStructCtor_3, newElement_2_date, - newElement_2_daysOfWeek, newElement_2_transitions, newElement_2_calendarID); - chip::JniReferences::GetInstance().AddToList(newElement_0_days, newElement_2); - } - - jclass calendarPeriodStructClass_1; - err = chip::JniReferences::GetInstance().GetLocalClassRef( - env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterCalendarPeriod", calendarPeriodStructClass_1); - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterCalendarPeriod"); - return nullptr; - } - - jmethodID calendarPeriodStructCtor_1; - err = chip::JniReferences::GetInstance().FindMethod(env, calendarPeriodStructClass_1, "", - "(Ljava/lang/Long;Ljava/util/ArrayList;)V", - &calendarPeriodStructCtor_1); - if (err != CHIP_NO_ERROR || calendarPeriodStructCtor_1 == nullptr) - { - ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterCalendarPeriod constructor"); - return nullptr; + newElement_1 = env->NewObject(calendarPeriodStructStructClass_2, calendarPeriodStructStructCtor_2, + newElement_1_startDate, newElement_1_days); + chip::JniReferences::GetInstance().AddToList(value, newElement_1); } - - newElement_0 = env->NewObject(calendarPeriodStructClass_1, calendarPeriodStructCtor_1, newElement_0_startDate, - newElement_0_days); - chip::JniReferences::GetInstance().AddToList(value, newElement_0); } return value; } @@ -25436,311 +25325,194 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR return nullptr; } jobject value; - chip::JniReferences::GetInstance().CreateArrayList(value); - - auto iter_value_0 = cppValue.begin(); - while (iter_value_0.Next()) + if (cppValue.IsNull()) { - auto & entry_0 = iter_value_0.GetValue(); - jobject newElement_0; - jobject newElement_0_date; - if (!entry_0.date.HasValue()) - { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_date); - } - else + value = nullptr; + } + else + { + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_1 = cppValue.Value().begin(); + while (iter_value_1.Next()) { - jobject newElement_0_dateInsideOptional; - jobject newElement_0_dateInsideOptional_year; - if (!entry_0.date.Value().year.HasValue()) + auto & entry_1 = iter_value_1.GetValue(); + jobject newElement_1; + jobject newElement_1_date; + if (!entry_1.date.HasValue()) { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_dateInsideOptional_year); + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_1_date); } else { - jobject newElement_0_dateInsideOptional_yearInsideOptional; - if (entry_0.date.Value().year.Value().IsNull()) - { - newElement_0_dateInsideOptional_yearInsideOptional = nullptr; - } - else - { - std::string newElement_0_dateInsideOptional_yearInsideOptionalClassName = "java/lang/Integer"; - std::string newElement_0_dateInsideOptional_yearInsideOptionalCtorSignature = "(I)V"; - jint jninewElement_0_dateInsideOptional_yearInsideOptional = - static_cast(entry_0.date.Value().year.Value().Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0_dateInsideOptional_yearInsideOptionalClassName.c_str(), - newElement_0_dateInsideOptional_yearInsideOptionalCtorSignature.c_str(), - jninewElement_0_dateInsideOptional_yearInsideOptional, - newElement_0_dateInsideOptional_yearInsideOptional); - } - chip::JniReferences::GetInstance().CreateOptional(newElement_0_dateInsideOptional_yearInsideOptional, - newElement_0_dateInsideOptional_year); + jobject newElement_1_dateInsideOptional; + std::string newElement_1_dateInsideOptionalClassName = "java/lang/Long"; + std::string newElement_1_dateInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_1_dateInsideOptional = static_cast(entry_1.date.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_1_dateInsideOptionalClassName.c_str(), newElement_1_dateInsideOptionalCtorSignature.c_str(), + jninewElement_1_dateInsideOptional, newElement_1_dateInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_1_dateInsideOptional, newElement_1_date); } - jobject newElement_0_dateInsideOptional_month; - if (!entry_0.date.Value().month.HasValue()) + jobject newElement_1_daysOfWeek; + if (!entry_1.daysOfWeek.HasValue()) { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_dateInsideOptional_month); + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_1_daysOfWeek); } else { - jobject newElement_0_dateInsideOptional_monthInsideOptional; - if (entry_0.date.Value().month.Value().IsNull()) + jobject newElement_1_daysOfWeekInsideOptional; + std::string newElement_1_daysOfWeekInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_1_daysOfWeekInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_1_daysOfWeekInsideOptional = static_cast(entry_1.daysOfWeek.Value().Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_1_daysOfWeekInsideOptionalClassName.c_str(), + newElement_1_daysOfWeekInsideOptionalCtorSignature.c_str(), jninewElement_1_daysOfWeekInsideOptional, + newElement_1_daysOfWeekInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_1_daysOfWeekInsideOptional, + newElement_1_daysOfWeek); + } + jobject newElement_1_transitions; + chip::JniReferences::GetInstance().CreateArrayList(newElement_1_transitions); + + auto iter_newElement_1_transitions_3 = entry_1.transitions.begin(); + while (iter_newElement_1_transitions_3.Next()) + { + auto & entry_3 = iter_newElement_1_transitions_3.GetValue(); + jobject newElement_3; + jobject newElement_3_transitionTime; + std::string newElement_3_transitionTimeClassName = "java/lang/Integer"; + std::string newElement_3_transitionTimeCtorSignature = "(I)V"; + jint jninewElement_3_transitionTime = static_cast(entry_3.transitionTime); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_3_transitionTimeClassName.c_str(), newElement_3_transitionTimeCtorSignature.c_str(), + jninewElement_3_transitionTime, newElement_3_transitionTime); + jobject newElement_3_priceTier; + if (!entry_3.priceTier.HasValue()) { - newElement_0_dateInsideOptional_monthInsideOptional = nullptr; + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_3_priceTier); } else { - std::string newElement_0_dateInsideOptional_monthInsideOptionalClassName = "java/lang/Integer"; - std::string newElement_0_dateInsideOptional_monthInsideOptionalCtorSignature = "(I)V"; - jint jninewElement_0_dateInsideOptional_monthInsideOptional = - static_cast(entry_0.date.Value().month.Value().Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0_dateInsideOptional_monthInsideOptionalClassName.c_str(), - newElement_0_dateInsideOptional_monthInsideOptionalCtorSignature.c_str(), - jninewElement_0_dateInsideOptional_monthInsideOptional, - newElement_0_dateInsideOptional_monthInsideOptional); + jobject newElement_3_priceTierInsideOptional; + std::string newElement_3_priceTierInsideOptionalClassName = "java/lang/Long"; + std::string newElement_3_priceTierInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_3_priceTierInsideOptional = static_cast(entry_3.priceTier.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_3_priceTierInsideOptionalClassName.c_str(), + newElement_3_priceTierInsideOptionalCtorSignature.c_str(), jninewElement_3_priceTierInsideOptional, + newElement_3_priceTierInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_3_priceTierInsideOptional, + newElement_3_priceTier); } - chip::JniReferences::GetInstance().CreateOptional(newElement_0_dateInsideOptional_monthInsideOptional, - newElement_0_dateInsideOptional_month); - } - jobject newElement_0_dateInsideOptional_day; - if (!entry_0.date.Value().day.HasValue()) - { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_dateInsideOptional_day); - } - else - { - jobject newElement_0_dateInsideOptional_dayInsideOptional; - if (entry_0.date.Value().day.Value().IsNull()) + jobject newElement_3_friendlyCredit; + if (!entry_3.friendlyCredit.HasValue()) { - newElement_0_dateInsideOptional_dayInsideOptional = nullptr; + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_3_friendlyCredit); } else { - std::string newElement_0_dateInsideOptional_dayInsideOptionalClassName = "java/lang/Integer"; - std::string newElement_0_dateInsideOptional_dayInsideOptionalCtorSignature = "(I)V"; - jint jninewElement_0_dateInsideOptional_dayInsideOptional = - static_cast(entry_0.date.Value().day.Value().Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0_dateInsideOptional_dayInsideOptionalClassName.c_str(), - newElement_0_dateInsideOptional_dayInsideOptionalCtorSignature.c_str(), - jninewElement_0_dateInsideOptional_dayInsideOptional, - newElement_0_dateInsideOptional_dayInsideOptional); + jobject newElement_3_friendlyCreditInsideOptional; + std::string newElement_3_friendlyCreditInsideOptionalClassName = "java/lang/Boolean"; + std::string newElement_3_friendlyCreditInsideOptionalCtorSignature = "(Z)V"; + jboolean jninewElement_3_friendlyCreditInsideOptional = + static_cast(entry_3.friendlyCredit.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_3_friendlyCreditInsideOptionalClassName.c_str(), + newElement_3_friendlyCreditInsideOptionalCtorSignature.c_str(), + jninewElement_3_friendlyCreditInsideOptional, newElement_3_friendlyCreditInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_3_friendlyCreditInsideOptional, + newElement_3_friendlyCredit); } - chip::JniReferences::GetInstance().CreateOptional(newElement_0_dateInsideOptional_dayInsideOptional, - newElement_0_dateInsideOptional_day); - } - jobject newElement_0_dateInsideOptional_dayOfWeek; - if (!entry_0.date.Value().dayOfWeek.HasValue()) - { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_dateInsideOptional_dayOfWeek); - } - else - { - jobject newElement_0_dateInsideOptional_dayOfWeekInsideOptional; - if (entry_0.date.Value().dayOfWeek.Value().IsNull()) + jobject newElement_3_auxiliaryLoad; + if (!entry_3.auxiliaryLoad.HasValue()) { - newElement_0_dateInsideOptional_dayOfWeekInsideOptional = nullptr; + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_3_auxiliaryLoad); } else { - std::string newElement_0_dateInsideOptional_dayOfWeekInsideOptionalClassName = "java/lang/Integer"; - std::string newElement_0_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature = "(I)V"; - jint jninewElement_0_dateInsideOptional_dayOfWeekInsideOptional = - static_cast(entry_0.date.Value().dayOfWeek.Value().Value()); + jobject newElement_3_auxiliaryLoadInsideOptional; + std::string newElement_3_auxiliaryLoadInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_3_auxiliaryLoadInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_3_auxiliaryLoadInsideOptional = + static_cast(entry_3.auxiliaryLoad.Value().Raw()); chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0_dateInsideOptional_dayOfWeekInsideOptionalClassName.c_str(), - newElement_0_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature.c_str(), - jninewElement_0_dateInsideOptional_dayOfWeekInsideOptional, - newElement_0_dateInsideOptional_dayOfWeekInsideOptional); + newElement_3_auxiliaryLoadInsideOptionalClassName.c_str(), + newElement_3_auxiliaryLoadInsideOptionalCtorSignature.c_str(), + jninewElement_3_auxiliaryLoadInsideOptional, newElement_3_auxiliaryLoadInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_3_auxiliaryLoadInsideOptional, + newElement_3_auxiliaryLoad); } - chip::JniReferences::GetInstance().CreateOptional(newElement_0_dateInsideOptional_dayOfWeekInsideOptional, - newElement_0_dateInsideOptional_dayOfWeek); - } - - jclass dateStructClass_3; - err = chip::JniReferences::GetInstance().GetLocalClassRef( - env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterDate", dateStructClass_3); - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterDate"); - return nullptr; - } - jmethodID dateStructCtor_3; - err = chip::JniReferences::GetInstance().FindMethod( - env, dateStructClass_3, "", - "(Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V", &dateStructCtor_3); - if (err != CHIP_NO_ERROR || dateStructCtor_3 == nullptr) - { - ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterDate constructor"); - return nullptr; - } + jclass transitionStructStructClass_4; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterTransitionStruct", + transitionStructStructClass_4); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterTransitionStruct"); + return nullptr; + } - newElement_0_dateInsideOptional = - env->NewObject(dateStructClass_3, dateStructCtor_3, newElement_0_dateInsideOptional_year, - newElement_0_dateInsideOptional_month, newElement_0_dateInsideOptional_day, - newElement_0_dateInsideOptional_dayOfWeek); - chip::JniReferences::GetInstance().CreateOptional(newElement_0_dateInsideOptional, newElement_0_date); - } - jobject newElement_0_daysOfWeek; - if (!entry_0.daysOfWeek.HasValue()) - { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_daysOfWeek); - } - else - { - jobject newElement_0_daysOfWeekInsideOptional; - std::string newElement_0_daysOfWeekInsideOptionalClassName = "java/lang/Integer"; - std::string newElement_0_daysOfWeekInsideOptionalCtorSignature = "(I)V"; - jint jninewElement_0_daysOfWeekInsideOptional = static_cast(entry_0.daysOfWeek.Value().Raw()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0_daysOfWeekInsideOptionalClassName.c_str(), - newElement_0_daysOfWeekInsideOptionalCtorSignature.c_str(), jninewElement_0_daysOfWeekInsideOptional, - newElement_0_daysOfWeekInsideOptional); - chip::JniReferences::GetInstance().CreateOptional(newElement_0_daysOfWeekInsideOptional, - newElement_0_daysOfWeek); - } - jobject newElement_0_transitions; - chip::JniReferences::GetInstance().CreateArrayList(newElement_0_transitions); + jmethodID transitionStructStructCtor_4; + err = chip::JniReferences::GetInstance().FindMethod( + env, transitionStructStructClass_4, "", + "(Ljava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V", + &transitionStructStructCtor_4); + if (err != CHIP_NO_ERROR || transitionStructStructCtor_4 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterTransitionStruct constructor"); + return nullptr; + } - auto iter_newElement_0_transitions_2 = entry_0.transitions.begin(); - while (iter_newElement_0_transitions_2.Next()) - { - auto & entry_2 = iter_newElement_0_transitions_2.GetValue(); - jobject newElement_2; - jobject newElement_2_transitionTime; - std::string newElement_2_transitionTimeClassName = "java/lang/Integer"; - std::string newElement_2_transitionTimeCtorSignature = "(I)V"; - jint jninewElement_2_transitionTime = static_cast(entry_2.transitionTime); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_2_transitionTimeClassName.c_str(), newElement_2_transitionTimeCtorSignature.c_str(), - jninewElement_2_transitionTime, newElement_2_transitionTime); - jobject newElement_2_priceTier; - if (!entry_2.priceTier.HasValue()) - { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_priceTier); - } - else - { - jobject newElement_2_priceTierInsideOptional; - std::string newElement_2_priceTierInsideOptionalClassName = "java/lang/Long"; - std::string newElement_2_priceTierInsideOptionalCtorSignature = "(J)V"; - jlong jninewElement_2_priceTierInsideOptional = static_cast(entry_2.priceTier.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_2_priceTierInsideOptionalClassName.c_str(), - newElement_2_priceTierInsideOptionalCtorSignature.c_str(), jninewElement_2_priceTierInsideOptional, - newElement_2_priceTierInsideOptional); - chip::JniReferences::GetInstance().CreateOptional(newElement_2_priceTierInsideOptional, - newElement_2_priceTier); - } - jobject newElement_2_friendlyCredit; - if (!entry_2.friendlyCredit.HasValue()) - { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_friendlyCredit); - } - else - { - jobject newElement_2_friendlyCreditInsideOptional; - std::string newElement_2_friendlyCreditInsideOptionalClassName = "java/lang/Boolean"; - std::string newElement_2_friendlyCreditInsideOptionalCtorSignature = "(Z)V"; - jboolean jninewElement_2_friendlyCreditInsideOptional = - static_cast(entry_2.friendlyCredit.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_2_friendlyCreditInsideOptionalClassName.c_str(), - newElement_2_friendlyCreditInsideOptionalCtorSignature.c_str(), - jninewElement_2_friendlyCreditInsideOptional, newElement_2_friendlyCreditInsideOptional); - chip::JniReferences::GetInstance().CreateOptional(newElement_2_friendlyCreditInsideOptional, - newElement_2_friendlyCredit); + newElement_3 = + env->NewObject(transitionStructStructClass_4, transitionStructStructCtor_4, newElement_3_transitionTime, + newElement_3_priceTier, newElement_3_friendlyCredit, newElement_3_auxiliaryLoad); + chip::JniReferences::GetInstance().AddToList(newElement_1_transitions, newElement_3); } - jobject newElement_2_auxiliaryLoad; - if (!entry_2.auxiliaryLoad.HasValue()) + jobject newElement_1_calendarID; + if (!entry_1.calendarID.HasValue()) { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_auxiliaryLoad); + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_1_calendarID); } else { - jobject newElement_2_auxiliaryLoadInsideOptional; - std::string newElement_2_auxiliaryLoadInsideOptionalClassName = "java/lang/Integer"; - std::string newElement_2_auxiliaryLoadInsideOptionalCtorSignature = "(I)V"; - jint jninewElement_2_auxiliaryLoadInsideOptional = static_cast(entry_2.auxiliaryLoad.Value().Raw()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_2_auxiliaryLoadInsideOptionalClassName.c_str(), - newElement_2_auxiliaryLoadInsideOptionalCtorSignature.c_str(), - jninewElement_2_auxiliaryLoadInsideOptional, newElement_2_auxiliaryLoadInsideOptional); - chip::JniReferences::GetInstance().CreateOptional(newElement_2_auxiliaryLoadInsideOptional, - newElement_2_auxiliaryLoad); + jobject newElement_1_calendarIDInsideOptional; + std::string newElement_1_calendarIDInsideOptionalClassName = "java/lang/Long"; + std::string newElement_1_calendarIDInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_1_calendarIDInsideOptional = static_cast(entry_1.calendarID.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_1_calendarIDInsideOptionalClassName.c_str(), + newElement_1_calendarIDInsideOptionalCtorSignature.c_str(), jninewElement_1_calendarIDInsideOptional, + newElement_1_calendarIDInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_1_calendarIDInsideOptional, + newElement_1_calendarID); } - jclass transitionStructStructClass_3; + jclass dayStructStructClass_2; err = chip::JniReferences::GetInstance().GetLocalClassRef( - env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterTransitionStruct", - transitionStructStructClass_3); + env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterDayStruct", dayStructStructClass_2); if (err != CHIP_NO_ERROR) { - ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterTransitionStruct"); + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterDayStruct"); return nullptr; } - jmethodID transitionStructStructCtor_3; + jmethodID dayStructStructCtor_2; err = chip::JniReferences::GetInstance().FindMethod( - env, transitionStructStructClass_3, "", - "(Ljava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V", - &transitionStructStructCtor_3); - if (err != CHIP_NO_ERROR || transitionStructStructCtor_3 == nullptr) + env, dayStructStructClass_2, "", + "(Ljava/util/Optional;Ljava/util/Optional;Ljava/util/ArrayList;Ljava/util/Optional;)V", + &dayStructStructCtor_2); + if (err != CHIP_NO_ERROR || dayStructStructCtor_2 == nullptr) { - ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterTransitionStruct constructor"); + ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterDayStruct constructor"); return nullptr; } - newElement_2 = - env->NewObject(transitionStructStructClass_3, transitionStructStructCtor_3, newElement_2_transitionTime, - newElement_2_priceTier, newElement_2_friendlyCredit, newElement_2_auxiliaryLoad); - chip::JniReferences::GetInstance().AddToList(newElement_0_transitions, newElement_2); - } - jobject newElement_0_calendarID; - if (!entry_0.calendarID.HasValue()) - { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_calendarID); - } - else - { - jobject newElement_0_calendarIDInsideOptional; - std::string newElement_0_calendarIDInsideOptionalClassName = "java/lang/Long"; - std::string newElement_0_calendarIDInsideOptionalCtorSignature = "(J)V"; - jlong jninewElement_0_calendarIDInsideOptional = static_cast(entry_0.calendarID.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0_calendarIDInsideOptionalClassName.c_str(), - newElement_0_calendarIDInsideOptionalCtorSignature.c_str(), jninewElement_0_calendarIDInsideOptional, - newElement_0_calendarIDInsideOptional); - chip::JniReferences::GetInstance().CreateOptional(newElement_0_calendarIDInsideOptional, - newElement_0_calendarID); - } - - jclass dayStructStructClass_1; - err = chip::JniReferences::GetInstance().GetLocalClassRef( - env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterDayStruct", dayStructStructClass_1); - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterDayStruct"); - return nullptr; - } - - jmethodID dayStructStructCtor_1; - err = chip::JniReferences::GetInstance().FindMethod( - env, dayStructStructClass_1, "", - "(Ljava/util/Optional;Ljava/util/Optional;Ljava/util/ArrayList;Ljava/util/Optional;)V", &dayStructStructCtor_1); - if (err != CHIP_NO_ERROR || dayStructStructCtor_1 == nullptr) - { - ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterDayStruct constructor"); - return nullptr; + newElement_1 = env->NewObject(dayStructStructClass_2, dayStructStructCtor_2, newElement_1_date, + newElement_1_daysOfWeek, newElement_1_transitions, newElement_1_calendarID); + chip::JniReferences::GetInstance().AddToList(value, newElement_1); } - - newElement_0 = env->NewObject(dayStructStructClass_1, dayStructStructCtor_1, newElement_0_date, - newElement_0_daysOfWeek, newElement_0_transitions, newElement_0_calendarID); - chip::JniReferences::GetInstance().AddToList(value, newElement_0); } return value; } @@ -25767,134 +25539,12 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR else { jobject value_dateInsideOptional; - jobject value_dateInsideOptional_year; - if (!cppValue.Value().date.Value().year.HasValue()) - { - chip::JniReferences::GetInstance().CreateOptional(nullptr, value_dateInsideOptional_year); - } - else - { - jobject value_dateInsideOptional_yearInsideOptional; - if (cppValue.Value().date.Value().year.Value().IsNull()) - { - value_dateInsideOptional_yearInsideOptional = nullptr; - } - else - { - std::string value_dateInsideOptional_yearInsideOptionalClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_yearInsideOptionalCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_yearInsideOptional = - static_cast(cppValue.Value().date.Value().year.Value().Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_yearInsideOptionalClassName.c_str(), - value_dateInsideOptional_yearInsideOptionalCtorSignature.c_str(), - jnivalue_dateInsideOptional_yearInsideOptional, value_dateInsideOptional_yearInsideOptional); - } - chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional_yearInsideOptional, - value_dateInsideOptional_year); - } - jobject value_dateInsideOptional_month; - if (!cppValue.Value().date.Value().month.HasValue()) - { - chip::JniReferences::GetInstance().CreateOptional(nullptr, value_dateInsideOptional_month); - } - else - { - jobject value_dateInsideOptional_monthInsideOptional; - if (cppValue.Value().date.Value().month.Value().IsNull()) - { - value_dateInsideOptional_monthInsideOptional = nullptr; - } - else - { - std::string value_dateInsideOptional_monthInsideOptionalClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_monthInsideOptionalCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_monthInsideOptional = - static_cast(cppValue.Value().date.Value().month.Value().Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_monthInsideOptionalClassName.c_str(), - value_dateInsideOptional_monthInsideOptionalCtorSignature.c_str(), - jnivalue_dateInsideOptional_monthInsideOptional, value_dateInsideOptional_monthInsideOptional); - } - chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional_monthInsideOptional, - value_dateInsideOptional_month); - } - jobject value_dateInsideOptional_day; - if (!cppValue.Value().date.Value().day.HasValue()) - { - chip::JniReferences::GetInstance().CreateOptional(nullptr, value_dateInsideOptional_day); - } - else - { - jobject value_dateInsideOptional_dayInsideOptional; - if (cppValue.Value().date.Value().day.Value().IsNull()) - { - value_dateInsideOptional_dayInsideOptional = nullptr; - } - else - { - std::string value_dateInsideOptional_dayInsideOptionalClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_dayInsideOptionalCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_dayInsideOptional = - static_cast(cppValue.Value().date.Value().day.Value().Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_dayInsideOptionalClassName.c_str(), - value_dateInsideOptional_dayInsideOptionalCtorSignature.c_str(), - jnivalue_dateInsideOptional_dayInsideOptional, value_dateInsideOptional_dayInsideOptional); - } - chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional_dayInsideOptional, - value_dateInsideOptional_day); - } - jobject value_dateInsideOptional_dayOfWeek; - if (!cppValue.Value().date.Value().dayOfWeek.HasValue()) - { - chip::JniReferences::GetInstance().CreateOptional(nullptr, value_dateInsideOptional_dayOfWeek); - } - else - { - jobject value_dateInsideOptional_dayOfWeekInsideOptional; - if (cppValue.Value().date.Value().dayOfWeek.Value().IsNull()) - { - value_dateInsideOptional_dayOfWeekInsideOptional = nullptr; - } - else - { - std::string value_dateInsideOptional_dayOfWeekInsideOptionalClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_dayOfWeekInsideOptional = - static_cast(cppValue.Value().date.Value().dayOfWeek.Value().Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_dayOfWeekInsideOptionalClassName.c_str(), - value_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature.c_str(), - jnivalue_dateInsideOptional_dayOfWeekInsideOptional, - value_dateInsideOptional_dayOfWeekInsideOptional); - } - chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional_dayOfWeekInsideOptional, - value_dateInsideOptional_dayOfWeek); - } - - jclass dateStructClass_3; - err = chip::JniReferences::GetInstance().GetLocalClassRef( - env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterDate", dateStructClass_3); - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterDate"); - return nullptr; - } - - jmethodID dateStructCtor_3; - err = chip::JniReferences::GetInstance().FindMethod( - env, dateStructClass_3, "", - "(Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V", &dateStructCtor_3); - if (err != CHIP_NO_ERROR || dateStructCtor_3 == nullptr) - { - ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterDate constructor"); - return nullptr; - } - - value_dateInsideOptional = env->NewObject(dateStructClass_3, dateStructCtor_3, value_dateInsideOptional_year, - value_dateInsideOptional_month, value_dateInsideOptional_day, - value_dateInsideOptional_dayOfWeek); + std::string value_dateInsideOptionalClassName = "java/lang/Long"; + std::string value_dateInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_dateInsideOptional = static_cast(cppValue.Value().date.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dateInsideOptionalClassName.c_str(), value_dateInsideOptionalCtorSignature.c_str(), + jnivalue_dateInsideOptional, value_dateInsideOptional); chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional, value_date); } jobject value_daysOfWeek; @@ -26074,134 +25724,12 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR else { jobject value_dateInsideOptional; - jobject value_dateInsideOptional_year; - if (!cppValue.Value().date.Value().year.HasValue()) - { - chip::JniReferences::GetInstance().CreateOptional(nullptr, value_dateInsideOptional_year); - } - else - { - jobject value_dateInsideOptional_yearInsideOptional; - if (cppValue.Value().date.Value().year.Value().IsNull()) - { - value_dateInsideOptional_yearInsideOptional = nullptr; - } - else - { - std::string value_dateInsideOptional_yearInsideOptionalClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_yearInsideOptionalCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_yearInsideOptional = - static_cast(cppValue.Value().date.Value().year.Value().Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_yearInsideOptionalClassName.c_str(), - value_dateInsideOptional_yearInsideOptionalCtorSignature.c_str(), - jnivalue_dateInsideOptional_yearInsideOptional, value_dateInsideOptional_yearInsideOptional); - } - chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional_yearInsideOptional, - value_dateInsideOptional_year); - } - jobject value_dateInsideOptional_month; - if (!cppValue.Value().date.Value().month.HasValue()) - { - chip::JniReferences::GetInstance().CreateOptional(nullptr, value_dateInsideOptional_month); - } - else - { - jobject value_dateInsideOptional_monthInsideOptional; - if (cppValue.Value().date.Value().month.Value().IsNull()) - { - value_dateInsideOptional_monthInsideOptional = nullptr; - } - else - { - std::string value_dateInsideOptional_monthInsideOptionalClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_monthInsideOptionalCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_monthInsideOptional = - static_cast(cppValue.Value().date.Value().month.Value().Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_monthInsideOptionalClassName.c_str(), - value_dateInsideOptional_monthInsideOptionalCtorSignature.c_str(), - jnivalue_dateInsideOptional_monthInsideOptional, value_dateInsideOptional_monthInsideOptional); - } - chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional_monthInsideOptional, - value_dateInsideOptional_month); - } - jobject value_dateInsideOptional_day; - if (!cppValue.Value().date.Value().day.HasValue()) - { - chip::JniReferences::GetInstance().CreateOptional(nullptr, value_dateInsideOptional_day); - } - else - { - jobject value_dateInsideOptional_dayInsideOptional; - if (cppValue.Value().date.Value().day.Value().IsNull()) - { - value_dateInsideOptional_dayInsideOptional = nullptr; - } - else - { - std::string value_dateInsideOptional_dayInsideOptionalClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_dayInsideOptionalCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_dayInsideOptional = - static_cast(cppValue.Value().date.Value().day.Value().Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_dayInsideOptionalClassName.c_str(), - value_dateInsideOptional_dayInsideOptionalCtorSignature.c_str(), - jnivalue_dateInsideOptional_dayInsideOptional, value_dateInsideOptional_dayInsideOptional); - } - chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional_dayInsideOptional, - value_dateInsideOptional_day); - } - jobject value_dateInsideOptional_dayOfWeek; - if (!cppValue.Value().date.Value().dayOfWeek.HasValue()) - { - chip::JniReferences::GetInstance().CreateOptional(nullptr, value_dateInsideOptional_dayOfWeek); - } - else - { - jobject value_dateInsideOptional_dayOfWeekInsideOptional; - if (cppValue.Value().date.Value().dayOfWeek.Value().IsNull()) - { - value_dateInsideOptional_dayOfWeekInsideOptional = nullptr; - } - else - { - std::string value_dateInsideOptional_dayOfWeekInsideOptionalClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_dayOfWeekInsideOptional = - static_cast(cppValue.Value().date.Value().dayOfWeek.Value().Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_dayOfWeekInsideOptionalClassName.c_str(), - value_dateInsideOptional_dayOfWeekInsideOptionalCtorSignature.c_str(), - jnivalue_dateInsideOptional_dayOfWeekInsideOptional, - value_dateInsideOptional_dayOfWeekInsideOptional); - } - chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional_dayOfWeekInsideOptional, - value_dateInsideOptional_dayOfWeek); - } - - jclass dateStructClass_3; - err = chip::JniReferences::GetInstance().GetLocalClassRef( - env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterDate", dateStructClass_3); - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterDate"); - return nullptr; - } - - jmethodID dateStructCtor_3; - err = chip::JniReferences::GetInstance().FindMethod( - env, dateStructClass_3, "", - "(Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V", &dateStructCtor_3); - if (err != CHIP_NO_ERROR || dateStructCtor_3 == nullptr) - { - ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterDate constructor"); - return nullptr; - } - - value_dateInsideOptional = env->NewObject(dateStructClass_3, dateStructCtor_3, value_dateInsideOptional_year, - value_dateInsideOptional_month, value_dateInsideOptional_day, - value_dateInsideOptional_dayOfWeek); + std::string value_dateInsideOptionalClassName = "java/lang/Long"; + std::string value_dateInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_dateInsideOptional = static_cast(cppValue.Value().date.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dateInsideOptionalClassName.c_str(), value_dateInsideOptionalCtorSignature.c_str(), + jnivalue_dateInsideOptional, value_dateInsideOptional); chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional, value_date); } jobject value_daysOfWeek; @@ -26484,17 +26012,32 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR value_peakPeriodCtorSignature.c_str(), jnivalue_peakPeriod, value_peakPeriod); jobject value_startTime; - std::string value_startTimeClassName = "java/lang/Long"; - std::string value_startTimeCtorSignature = "(J)V"; - jlong jnivalue_startTime = static_cast(cppValue.Value().startTime); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_startTimeClassName.c_str(), value_startTimeCtorSignature.c_str(), jnivalue_startTime, value_startTime); + if (cppValue.Value().startTime.IsNull()) + { + value_startTime = nullptr; + } + else + { + std::string value_startTimeClassName = "java/lang/Long"; + std::string value_startTimeCtorSignature = "(J)V"; + jlong jnivalue_startTime = static_cast(cppValue.Value().startTime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(value_startTimeClassName.c_str(), + value_startTimeCtorSignature.c_str(), + jnivalue_startTime, value_startTime); + } jobject value_endTime; - std::string value_endTimeClassName = "java/lang/Long"; - std::string value_endTimeCtorSignature = "(J)V"; - jlong jnivalue_endTime = static_cast(cppValue.Value().endTime); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_endTimeClassName.c_str(), value_endTimeCtorSignature.c_str(), jnivalue_endTime, value_endTime); + if (cppValue.Value().endTime.IsNull()) + { + value_endTime = nullptr; + } + else + { + std::string value_endTimeClassName = "java/lang/Long"; + std::string value_endTimeCtorSignature = "(J)V"; + jlong jnivalue_endTime = static_cast(cppValue.Value().endTime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_endTimeClassName.c_str(), value_endTimeCtorSignature.c_str(), jnivalue_endTime, value_endTime); + } jclass peakPeriodStructStructClass_1; err = chip::JniReferences::GetInstance().GetLocalClassRef( @@ -26549,17 +26092,32 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR value_peakPeriodCtorSignature.c_str(), jnivalue_peakPeriod, value_peakPeriod); jobject value_startTime; - std::string value_startTimeClassName = "java/lang/Long"; - std::string value_startTimeCtorSignature = "(J)V"; - jlong jnivalue_startTime = static_cast(cppValue.Value().startTime); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_startTimeClassName.c_str(), value_startTimeCtorSignature.c_str(), jnivalue_startTime, value_startTime); + if (cppValue.Value().startTime.IsNull()) + { + value_startTime = nullptr; + } + else + { + std::string value_startTimeClassName = "java/lang/Long"; + std::string value_startTimeCtorSignature = "(J)V"; + jlong jnivalue_startTime = static_cast(cppValue.Value().startTime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(value_startTimeClassName.c_str(), + value_startTimeCtorSignature.c_str(), + jnivalue_startTime, value_startTime); + } jobject value_endTime; - std::string value_endTimeClassName = "java/lang/Long"; - std::string value_endTimeCtorSignature = "(J)V"; - jlong jnivalue_endTime = static_cast(cppValue.Value().endTime); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_endTimeClassName.c_str(), value_endTimeCtorSignature.c_str(), jnivalue_endTime, value_endTime); + if (cppValue.Value().endTime.IsNull()) + { + value_endTime = nullptr; + } + else + { + std::string value_endTimeClassName = "java/lang/Long"; + std::string value_endTimeCtorSignature = "(J)V"; + jlong jnivalue_endTime = static_cast(cppValue.Value().endTime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_endTimeClassName.c_str(), value_endTimeCtorSignature.c_str(), jnivalue_endTime, value_endTime); + } jclass peakPeriodStructStructClass_1; err = chip::JniReferences::GetInstance().GetLocalClassRef( diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index e691814b516cfc..9c2aca3786b8d2 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -26582,8 +26582,8 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="providerID", Tag=0x00000002, Type=typing.Union[Nullable, uint]), ClusterObjectFieldDescriptor(Label="eventID", Tag=0x00000003, Type=typing.Union[Nullable, uint]), ClusterObjectFieldDescriptor(Label="startDate", Tag=0x00000004, Type=typing.Union[Nullable, uint]), - ClusterObjectFieldDescriptor(Label="calendarPeriods", Tag=0x00000005, Type=typing.List[EnergyCalendar.Structs.CalendarPeriod]), - ClusterObjectFieldDescriptor(Label="specialDays", Tag=0x00000006, Type=typing.List[EnergyCalendar.Structs.DayStruct]), + ClusterObjectFieldDescriptor(Label="calendarPeriods", Tag=0x00000005, Type=typing.Union[Nullable, typing.List[EnergyCalendar.Structs.CalendarPeriodStruct]]), + ClusterObjectFieldDescriptor(Label="specialDays", Tag=0x00000006, Type=typing.Union[Nullable, typing.List[EnergyCalendar.Structs.DayStruct]]), ClusterObjectFieldDescriptor(Label="currentDay", Tag=0x00000007, Type=typing.Union[Nullable, EnergyCalendar.Structs.DayStruct]), ClusterObjectFieldDescriptor(Label="nextDay", Tag=0x00000008, Type=typing.Union[Nullable, EnergyCalendar.Structs.DayStruct]), ClusterObjectFieldDescriptor(Label="currentTransition", Tag=0x00000009, Type=typing.Union[Nullable, EnergyCalendar.Structs.TransitionStruct]), @@ -26602,8 +26602,8 @@ def descriptor(cls) -> ClusterObjectDescriptor: providerID: 'typing.Union[Nullable, uint]' = None eventID: 'typing.Union[Nullable, uint]' = None startDate: 'typing.Union[Nullable, uint]' = None - calendarPeriods: 'typing.List[EnergyCalendar.Structs.CalendarPeriod]' = None - specialDays: 'typing.List[EnergyCalendar.Structs.DayStruct]' = None + calendarPeriods: 'typing.Union[Nullable, typing.List[EnergyCalendar.Structs.CalendarPeriodStruct]]' = None + specialDays: 'typing.Union[Nullable, typing.List[EnergyCalendar.Structs.DayStruct]]' = None currentDay: 'typing.Union[Nullable, EnergyCalendar.Structs.DayStruct]' = None nextDay: 'typing.Union[Nullable, EnergyCalendar.Structs.DayStruct]' = None currentTransition: 'typing.Union[Nullable, EnergyCalendar.Structs.TransitionStruct]' = None @@ -26672,51 +26672,34 @@ def descriptor(cls) -> ClusterObjectDescriptor: friendlyCredit: 'typing.Optional[bool]' = None auxiliaryLoad: 'typing.Optional[uint]' = None - @dataclass - class Date(ClusterObject): - @ChipUtility.classproperty - def descriptor(cls) -> ClusterObjectDescriptor: - return ClusterObjectDescriptor( - Fields=[ - ClusterObjectFieldDescriptor(Label="year", Tag=0, Type=typing.Union[None, Nullable, uint]), - ClusterObjectFieldDescriptor(Label="month", Tag=1, Type=typing.Union[None, Nullable, uint]), - ClusterObjectFieldDescriptor(Label="day", Tag=2, Type=typing.Union[None, Nullable, uint]), - ClusterObjectFieldDescriptor(Label="dayOfWeek", Tag=3, Type=typing.Union[None, Nullable, uint]), - ]) - - year: 'typing.Union[None, Nullable, uint]' = None - month: 'typing.Union[None, Nullable, uint]' = None - day: 'typing.Union[None, Nullable, uint]' = None - dayOfWeek: 'typing.Union[None, Nullable, uint]' = None - @dataclass class DayStruct(ClusterObject): @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="date", Tag=0, Type=typing.Optional[EnergyCalendar.Structs.Date]), + ClusterObjectFieldDescriptor(Label="date", Tag=0, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="daysOfWeek", Tag=1, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="transitions", Tag=2, Type=typing.List[EnergyCalendar.Structs.TransitionStruct]), ClusterObjectFieldDescriptor(Label="calendarID", Tag=3, Type=typing.Optional[uint]), ]) - date: 'typing.Optional[EnergyCalendar.Structs.Date]' = None + date: 'typing.Optional[uint]' = None daysOfWeek: 'typing.Optional[uint]' = None transitions: 'typing.List[EnergyCalendar.Structs.TransitionStruct]' = field(default_factory=lambda: []) calendarID: 'typing.Optional[uint]' = None @dataclass - class CalendarPeriod(ClusterObject): + class CalendarPeriodStruct(ClusterObject): @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="startDate", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="startDate", Tag=0, Type=typing.Union[Nullable, uint]), ClusterObjectFieldDescriptor(Label="days", Tag=1, Type=typing.List[EnergyCalendar.Structs.DayStruct]), ]) - startDate: 'uint' = 0 + startDate: 'typing.Union[Nullable, uint]' = NullValue days: 'typing.List[EnergyCalendar.Structs.DayStruct]' = field(default_factory=lambda: []) @dataclass @@ -26727,14 +26710,14 @@ def descriptor(cls) -> ClusterObjectDescriptor: Fields=[ ClusterObjectFieldDescriptor(Label="severity", Tag=0, Type=EnergyCalendar.Enums.PeakPeriodSeverityEnum), ClusterObjectFieldDescriptor(Label="peakPeriod", Tag=1, Type=uint), - ClusterObjectFieldDescriptor(Label="startTime", Tag=2, Type=uint), - ClusterObjectFieldDescriptor(Label="endTime", Tag=3, Type=uint), + ClusterObjectFieldDescriptor(Label="startTime", Tag=2, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="endTime", Tag=3, Type=typing.Union[Nullable, uint]), ]) severity: 'EnergyCalendar.Enums.PeakPeriodSeverityEnum' = 0 peakPeriod: 'uint' = 0 - startTime: 'uint' = 0 - endTime: 'uint' = 0 + startTime: 'typing.Union[Nullable, uint]' = NullValue + endTime: 'typing.Union[Nullable, uint]' = NullValue class Attributes: @dataclass @@ -26829,9 +26812,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.List[EnergyCalendar.Structs.CalendarPeriod]) + return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, typing.List[EnergyCalendar.Structs.CalendarPeriodStruct]]) - value: 'typing.List[EnergyCalendar.Structs.CalendarPeriod]' = field(default_factory=lambda: []) + value: 'typing.Union[Nullable, typing.List[EnergyCalendar.Structs.CalendarPeriodStruct]]' = NullValue @dataclass class SpecialDays(ClusterAttributeDescriptor): @@ -26845,9 +26828,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.List[EnergyCalendar.Structs.DayStruct]) + return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, typing.List[EnergyCalendar.Structs.DayStruct]]) - value: 'typing.List[EnergyCalendar.Structs.DayStruct]' = field(default_factory=lambda: []) + value: 'typing.Union[Nullable, typing.List[EnergyCalendar.Structs.DayStruct]]' = NullValue @dataclass class CurrentDay(ClusterAttributeDescriptor): diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index 500fc7d3b5ba00..207d6edd3d0ae7 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -9611,122 +9611,94 @@ static id _Nullable DecodeAttributeValueForEnergyCalendarCluster(AttributeId aAt if (*aError != CHIP_NO_ERROR) { return nil; } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - MTREnergyCalendarClusterCalendarPeriod * newElement_0; - newElement_0 = [MTREnergyCalendarClusterCalendarPeriod new]; - newElement_0.startDate = [NSNumber numberWithUnsignedInt:entry_0.startDate]; - { // Scope for our temporary variables - auto * array_2 = [NSMutableArray new]; - auto iter_2 = entry_0.days.begin(); - while (iter_2.Next()) { - auto & entry_2 = iter_2.GetValue(); - MTREnergyCalendarClusterDayStruct * newElement_2; - newElement_2 = [MTREnergyCalendarClusterDayStruct new]; - if (entry_2.date.HasValue()) { - newElement_2.date = [MTREnergyCalendarClusterDate new]; - if (entry_2.date.Value().year.HasValue()) { - if (entry_2.date.Value().year.Value().IsNull()) { - newElement_2.date.year = nil; - } else { - newElement_2.date.year = [NSNumber numberWithUnsignedShort:entry_2.date.Value().year.Value().Value()]; - } - } else { - newElement_2.date.year = nil; - } - if (entry_2.date.Value().month.HasValue()) { - if (entry_2.date.Value().month.Value().IsNull()) { - newElement_2.date.month = nil; - } else { - newElement_2.date.month = [NSNumber numberWithUnsignedChar:entry_2.date.Value().month.Value().Value()]; - } - } else { - newElement_2.date.month = nil; - } - if (entry_2.date.Value().day.HasValue()) { - if (entry_2.date.Value().day.Value().IsNull()) { - newElement_2.date.day = nil; - } else { - newElement_2.date.day = [NSNumber numberWithUnsignedChar:entry_2.date.Value().day.Value().Value()]; - } + NSArray * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + { // Scope for our temporary variables + auto * array_1 = [NSMutableArray new]; + auto iter_1 = cppValue.Value().begin(); + while (iter_1.Next()) { + auto & entry_1 = iter_1.GetValue(); + MTREnergyCalendarClusterCalendarPeriodStruct * newElement_1; + newElement_1 = [MTREnergyCalendarClusterCalendarPeriodStruct new]; + if (entry_1.startDate.IsNull()) { + newElement_1.startDate = nil; + } else { + newElement_1.startDate = [NSNumber numberWithUnsignedInt:entry_1.startDate.Value()]; + } + { // Scope for our temporary variables + auto * array_3 = [NSMutableArray new]; + auto iter_3 = entry_1.days.begin(); + while (iter_3.Next()) { + auto & entry_3 = iter_3.GetValue(); + MTREnergyCalendarClusterDayStruct * newElement_3; + newElement_3 = [MTREnergyCalendarClusterDayStruct new]; + if (entry_3.date.HasValue()) { + newElement_3.date = [NSNumber numberWithUnsignedInt:entry_3.date.Value()]; } else { - newElement_2.date.day = nil; + newElement_3.date = nil; } - if (entry_2.date.Value().dayOfWeek.HasValue()) { - if (entry_2.date.Value().dayOfWeek.Value().IsNull()) { - newElement_2.date.dayOfWeek = nil; - } else { - newElement_2.date.dayOfWeek = [NSNumber numberWithUnsignedChar:entry_2.date.Value().dayOfWeek.Value().Value()]; - } + if (entry_3.daysOfWeek.HasValue()) { + newElement_3.daysOfWeek = [NSNumber numberWithUnsignedChar:entry_3.daysOfWeek.Value().Raw()]; } else { - newElement_2.date.dayOfWeek = nil; + newElement_3.daysOfWeek = nil; } - } else { - newElement_2.date = nil; - } - if (entry_2.daysOfWeek.HasValue()) { - newElement_2.daysOfWeek = [NSNumber numberWithUnsignedChar:entry_2.daysOfWeek.Value().Raw()]; - } else { - newElement_2.daysOfWeek = nil; - } - { // Scope for our temporary variables - auto * array_4 = [NSMutableArray new]; - auto iter_4 = entry_2.transitions.begin(); - while (iter_4.Next()) { - auto & entry_4 = iter_4.GetValue(); - MTREnergyCalendarClusterTransitionStruct * newElement_4; - newElement_4 = [MTREnergyCalendarClusterTransitionStruct new]; - newElement_4.transitionTime = [NSNumber numberWithUnsignedShort:entry_4.transitionTime]; - if (entry_4.priceTier.HasValue()) { - newElement_4.priceTier = [NSNumber numberWithUnsignedInt:entry_4.priceTier.Value()]; - } else { - newElement_4.priceTier = nil; - } - if (entry_4.friendlyCredit.HasValue()) { - newElement_4.friendlyCredit = [NSNumber numberWithBool:entry_4.friendlyCredit.Value()]; - } else { - newElement_4.friendlyCredit = nil; + { // Scope for our temporary variables + auto * array_5 = [NSMutableArray new]; + auto iter_5 = entry_3.transitions.begin(); + while (iter_5.Next()) { + auto & entry_5 = iter_5.GetValue(); + MTREnergyCalendarClusterTransitionStruct * newElement_5; + newElement_5 = [MTREnergyCalendarClusterTransitionStruct new]; + newElement_5.transitionTime = [NSNumber numberWithUnsignedShort:entry_5.transitionTime]; + if (entry_5.priceTier.HasValue()) { + newElement_5.priceTier = [NSNumber numberWithUnsignedInt:entry_5.priceTier.Value()]; + } else { + newElement_5.priceTier = nil; + } + if (entry_5.friendlyCredit.HasValue()) { + newElement_5.friendlyCredit = [NSNumber numberWithBool:entry_5.friendlyCredit.Value()]; + } else { + newElement_5.friendlyCredit = nil; + } + if (entry_5.auxiliaryLoad.HasValue()) { + newElement_5.auxiliaryLoad = [NSNumber numberWithUnsignedChar:entry_5.auxiliaryLoad.Value().Raw()]; + } else { + newElement_5.auxiliaryLoad = nil; + } + [array_5 addObject:newElement_5]; } - if (entry_4.auxiliaryLoad.HasValue()) { - newElement_4.auxiliaryLoad = [NSNumber numberWithUnsignedChar:entry_4.auxiliaryLoad.Value().Raw()]; - } else { - newElement_4.auxiliaryLoad = nil; + CHIP_ERROR err = iter_5.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; } - [array_4 addObject:newElement_4]; + newElement_3.transitions = array_5; } - CHIP_ERROR err = iter_4.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; + if (entry_3.calendarID.HasValue()) { + newElement_3.calendarID = [NSNumber numberWithUnsignedInt:entry_3.calendarID.Value()]; + } else { + newElement_3.calendarID = nil; } - newElement_2.transitions = array_4; + [array_3 addObject:newElement_3]; } - if (entry_2.calendarID.HasValue()) { - newElement_2.calendarID = [NSNumber numberWithUnsignedInt:entry_2.calendarID.Value()]; - } else { - newElement_2.calendarID = nil; + CHIP_ERROR err = iter_3.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; } - [array_2 addObject:newElement_2]; + newElement_1.days = array_3; } - CHIP_ERROR err = iter_2.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - newElement_0.days = array_2; + [array_1 addObject:newElement_1]; } - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; + CHIP_ERROR err = iter_1.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_1; } - value = array_0; } return value; } @@ -9737,105 +9709,73 @@ static id _Nullable DecodeAttributeValueForEnergyCalendarCluster(AttributeId aAt if (*aError != CHIP_NO_ERROR) { return nil; } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - MTREnergyCalendarClusterDayStruct * newElement_0; - newElement_0 = [MTREnergyCalendarClusterDayStruct new]; - if (entry_0.date.HasValue()) { - newElement_0.date = [MTREnergyCalendarClusterDate new]; - if (entry_0.date.Value().year.HasValue()) { - if (entry_0.date.Value().year.Value().IsNull()) { - newElement_0.date.year = nil; - } else { - newElement_0.date.year = [NSNumber numberWithUnsignedShort:entry_0.date.Value().year.Value().Value()]; - } - } else { - newElement_0.date.year = nil; - } - if (entry_0.date.Value().month.HasValue()) { - if (entry_0.date.Value().month.Value().IsNull()) { - newElement_0.date.month = nil; - } else { - newElement_0.date.month = [NSNumber numberWithUnsignedChar:entry_0.date.Value().month.Value().Value()]; - } - } else { - newElement_0.date.month = nil; - } - if (entry_0.date.Value().day.HasValue()) { - if (entry_0.date.Value().day.Value().IsNull()) { - newElement_0.date.day = nil; - } else { - newElement_0.date.day = [NSNumber numberWithUnsignedChar:entry_0.date.Value().day.Value().Value()]; - } + NSArray * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + { // Scope for our temporary variables + auto * array_1 = [NSMutableArray new]; + auto iter_1 = cppValue.Value().begin(); + while (iter_1.Next()) { + auto & entry_1 = iter_1.GetValue(); + MTREnergyCalendarClusterDayStruct * newElement_1; + newElement_1 = [MTREnergyCalendarClusterDayStruct new]; + if (entry_1.date.HasValue()) { + newElement_1.date = [NSNumber numberWithUnsignedInt:entry_1.date.Value()]; } else { - newElement_0.date.day = nil; + newElement_1.date = nil; } - if (entry_0.date.Value().dayOfWeek.HasValue()) { - if (entry_0.date.Value().dayOfWeek.Value().IsNull()) { - newElement_0.date.dayOfWeek = nil; - } else { - newElement_0.date.dayOfWeek = [NSNumber numberWithUnsignedChar:entry_0.date.Value().dayOfWeek.Value().Value()]; - } + if (entry_1.daysOfWeek.HasValue()) { + newElement_1.daysOfWeek = [NSNumber numberWithUnsignedChar:entry_1.daysOfWeek.Value().Raw()]; } else { - newElement_0.date.dayOfWeek = nil; + newElement_1.daysOfWeek = nil; } - } else { - newElement_0.date = nil; - } - if (entry_0.daysOfWeek.HasValue()) { - newElement_0.daysOfWeek = [NSNumber numberWithUnsignedChar:entry_0.daysOfWeek.Value().Raw()]; - } else { - newElement_0.daysOfWeek = nil; - } - { // Scope for our temporary variables - auto * array_2 = [NSMutableArray new]; - auto iter_2 = entry_0.transitions.begin(); - while (iter_2.Next()) { - auto & entry_2 = iter_2.GetValue(); - MTREnergyCalendarClusterTransitionStruct * newElement_2; - newElement_2 = [MTREnergyCalendarClusterTransitionStruct new]; - newElement_2.transitionTime = [NSNumber numberWithUnsignedShort:entry_2.transitionTime]; - if (entry_2.priceTier.HasValue()) { - newElement_2.priceTier = [NSNumber numberWithUnsignedInt:entry_2.priceTier.Value()]; - } else { - newElement_2.priceTier = nil; - } - if (entry_2.friendlyCredit.HasValue()) { - newElement_2.friendlyCredit = [NSNumber numberWithBool:entry_2.friendlyCredit.Value()]; - } else { - newElement_2.friendlyCredit = nil; + { // Scope for our temporary variables + auto * array_3 = [NSMutableArray new]; + auto iter_3 = entry_1.transitions.begin(); + while (iter_3.Next()) { + auto & entry_3 = iter_3.GetValue(); + MTREnergyCalendarClusterTransitionStruct * newElement_3; + newElement_3 = [MTREnergyCalendarClusterTransitionStruct new]; + newElement_3.transitionTime = [NSNumber numberWithUnsignedShort:entry_3.transitionTime]; + if (entry_3.priceTier.HasValue()) { + newElement_3.priceTier = [NSNumber numberWithUnsignedInt:entry_3.priceTier.Value()]; + } else { + newElement_3.priceTier = nil; + } + if (entry_3.friendlyCredit.HasValue()) { + newElement_3.friendlyCredit = [NSNumber numberWithBool:entry_3.friendlyCredit.Value()]; + } else { + newElement_3.friendlyCredit = nil; + } + if (entry_3.auxiliaryLoad.HasValue()) { + newElement_3.auxiliaryLoad = [NSNumber numberWithUnsignedChar:entry_3.auxiliaryLoad.Value().Raw()]; + } else { + newElement_3.auxiliaryLoad = nil; + } + [array_3 addObject:newElement_3]; } - if (entry_2.auxiliaryLoad.HasValue()) { - newElement_2.auxiliaryLoad = [NSNumber numberWithUnsignedChar:entry_2.auxiliaryLoad.Value().Raw()]; - } else { - newElement_2.auxiliaryLoad = nil; + CHIP_ERROR err = iter_3.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; } - [array_2 addObject:newElement_2]; + newElement_1.transitions = array_3; } - CHIP_ERROR err = iter_2.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; + if (entry_1.calendarID.HasValue()) { + newElement_1.calendarID = [NSNumber numberWithUnsignedInt:entry_1.calendarID.Value()]; + } else { + newElement_1.calendarID = nil; } - newElement_0.transitions = array_2; + [array_1 addObject:newElement_1]; } - if (entry_0.calendarID.HasValue()) { - newElement_0.calendarID = [NSNumber numberWithUnsignedInt:entry_0.calendarID.Value()]; - } else { - newElement_0.calendarID = nil; + CHIP_ERROR err = iter_1.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; } - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; + value = array_1; } - value = array_0; } return value; } @@ -9852,43 +9792,7 @@ static id _Nullable DecodeAttributeValueForEnergyCalendarCluster(AttributeId aAt } else { value = [MTREnergyCalendarClusterDayStruct new]; if (cppValue.Value().date.HasValue()) { - value.date = [MTREnergyCalendarClusterDate new]; - if (cppValue.Value().date.Value().year.HasValue()) { - if (cppValue.Value().date.Value().year.Value().IsNull()) { - value.date.year = nil; - } else { - value.date.year = [NSNumber numberWithUnsignedShort:cppValue.Value().date.Value().year.Value().Value()]; - } - } else { - value.date.year = nil; - } - if (cppValue.Value().date.Value().month.HasValue()) { - if (cppValue.Value().date.Value().month.Value().IsNull()) { - value.date.month = nil; - } else { - value.date.month = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().month.Value().Value()]; - } - } else { - value.date.month = nil; - } - if (cppValue.Value().date.Value().day.HasValue()) { - if (cppValue.Value().date.Value().day.Value().IsNull()) { - value.date.day = nil; - } else { - value.date.day = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().day.Value().Value()]; - } - } else { - value.date.day = nil; - } - if (cppValue.Value().date.Value().dayOfWeek.HasValue()) { - if (cppValue.Value().date.Value().dayOfWeek.Value().IsNull()) { - value.date.dayOfWeek = nil; - } else { - value.date.dayOfWeek = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().dayOfWeek.Value().Value()]; - } - } else { - value.date.dayOfWeek = nil; - } + value.date = [NSNumber numberWithUnsignedInt:cppValue.Value().date.Value()]; } else { value.date = nil; } @@ -9950,43 +9854,7 @@ static id _Nullable DecodeAttributeValueForEnergyCalendarCluster(AttributeId aAt } else { value = [MTREnergyCalendarClusterDayStruct new]; if (cppValue.Value().date.HasValue()) { - value.date = [MTREnergyCalendarClusterDate new]; - if (cppValue.Value().date.Value().year.HasValue()) { - if (cppValue.Value().date.Value().year.Value().IsNull()) { - value.date.year = nil; - } else { - value.date.year = [NSNumber numberWithUnsignedShort:cppValue.Value().date.Value().year.Value().Value()]; - } - } else { - value.date.year = nil; - } - if (cppValue.Value().date.Value().month.HasValue()) { - if (cppValue.Value().date.Value().month.Value().IsNull()) { - value.date.month = nil; - } else { - value.date.month = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().month.Value().Value()]; - } - } else { - value.date.month = nil; - } - if (cppValue.Value().date.Value().day.HasValue()) { - if (cppValue.Value().date.Value().day.Value().IsNull()) { - value.date.day = nil; - } else { - value.date.day = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().day.Value().Value()]; - } - } else { - value.date.day = nil; - } - if (cppValue.Value().date.Value().dayOfWeek.HasValue()) { - if (cppValue.Value().date.Value().dayOfWeek.Value().IsNull()) { - value.date.dayOfWeek = nil; - } else { - value.date.dayOfWeek = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().dayOfWeek.Value().Value()]; - } - } else { - value.date.dayOfWeek = nil; - } + value.date = [NSNumber numberWithUnsignedInt:cppValue.Value().date.Value()]; } else { value.date = nil; } @@ -10080,8 +9948,16 @@ static id _Nullable DecodeAttributeValueForEnergyCalendarCluster(AttributeId aAt value = [MTREnergyCalendarClusterPeakPeriodStruct new]; value.severity = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value().severity)]; value.peakPeriod = [NSNumber numberWithUnsignedShort:cppValue.Value().peakPeriod]; - value.startTime = [NSNumber numberWithUnsignedInt:cppValue.Value().startTime]; - value.endTime = [NSNumber numberWithUnsignedInt:cppValue.Value().endTime]; + if (cppValue.Value().startTime.IsNull()) { + value.startTime = nil; + } else { + value.startTime = [NSNumber numberWithUnsignedInt:cppValue.Value().startTime.Value()]; + } + if (cppValue.Value().endTime.IsNull()) { + value.endTime = nil; + } else { + value.endTime = [NSNumber numberWithUnsignedInt:cppValue.Value().endTime.Value()]; + } } return value; } @@ -10099,8 +9975,16 @@ static id _Nullable DecodeAttributeValueForEnergyCalendarCluster(AttributeId aAt value = [MTREnergyCalendarClusterPeakPeriodStruct new]; value.severity = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value().severity)]; value.peakPeriod = [NSNumber numberWithUnsignedShort:cppValue.Value().peakPeriod]; - value.startTime = [NSNumber numberWithUnsignedInt:cppValue.Value().startTime]; - value.endTime = [NSNumber numberWithUnsignedInt:cppValue.Value().endTime]; + if (cppValue.Value().startTime.IsNull()) { + value.startTime = nil; + } else { + value.startTime = [NSNumber numberWithUnsignedInt:cppValue.Value().startTime.Value()]; + } + if (cppValue.Value().endTime.IsNull()) { + value.endTime = nil; + } else { + value.endTime = [NSNumber numberWithUnsignedInt:cppValue.Value().endTime.Value()]; + } } return value; } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index 2cae83e8f28c18..9b3e921582549d 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -1516,25 +1516,17 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy) NSNumber * _Nullable auxiliaryLoad MTR_PROVISIONALLY_AVAILABLE; @end -MTR_PROVISIONALLY_AVAILABLE -@interface MTREnergyCalendarClusterDate : NSObject -@property (nonatomic, copy) NSNumber * _Nullable year MTR_PROVISIONALLY_AVAILABLE; -@property (nonatomic, copy) NSNumber * _Nullable month MTR_PROVISIONALLY_AVAILABLE; -@property (nonatomic, copy) NSNumber * _Nullable day MTR_PROVISIONALLY_AVAILABLE; -@property (nonatomic, copy) NSNumber * _Nullable dayOfWeek MTR_PROVISIONALLY_AVAILABLE; -@end - MTR_PROVISIONALLY_AVAILABLE @interface MTREnergyCalendarClusterDayStruct : NSObject -@property (nonatomic, copy) MTREnergyCalendarClusterDate * _Nullable date MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable date MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nullable daysOfWeek MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSArray * _Nonnull transitions MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nullable calendarID MTR_PROVISIONALLY_AVAILABLE; @end MTR_PROVISIONALLY_AVAILABLE -@interface MTREnergyCalendarClusterCalendarPeriod : NSObject -@property (nonatomic, copy) NSNumber * _Nonnull startDate MTR_PROVISIONALLY_AVAILABLE; +@interface MTREnergyCalendarClusterCalendarPeriodStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nullable startDate MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSArray * _Nonnull days MTR_PROVISIONALLY_AVAILABLE; @end @@ -1542,8 +1534,8 @@ MTR_PROVISIONALLY_AVAILABLE @interface MTREnergyCalendarClusterPeakPeriodStruct : NSObject @property (nonatomic, copy) NSNumber * _Nonnull severity MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nonnull peakPeriod MTR_PROVISIONALLY_AVAILABLE; -@property (nonatomic, copy) NSNumber * _Nonnull startTime MTR_PROVISIONALLY_AVAILABLE; -@property (nonatomic, copy) NSNumber * _Nonnull endTime MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable startTime MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable endTime MTR_PROVISIONALLY_AVAILABLE; @end MTR_PROVISIONALLY_AVAILABLE diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index c42d13b1f897a8..8a1a54c6113a12 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -6301,42 +6301,6 @@ - (NSString *)description @end -@implementation MTREnergyCalendarClusterDate -- (instancetype)init -{ - if (self = [super init]) { - - _year = nil; - - _month = nil; - - _day = nil; - - _dayOfWeek = nil; - } - return self; -} - -- (id)copyWithZone:(NSZone * _Nullable)zone -{ - auto other = [[MTREnergyCalendarClusterDate alloc] init]; - - other.year = self.year; - other.month = self.month; - other.day = self.day; - other.dayOfWeek = self.dayOfWeek; - - return other; -} - -- (NSString *)description -{ - NSString * descriptionString = [NSString stringWithFormat:@"<%@: year:%@; month:%@; day:%@; dayOfWeek:%@; >", NSStringFromClass([self class]), _year, _month, _day, _dayOfWeek]; - return descriptionString; -} - -@end - @implementation MTREnergyCalendarClusterDayStruct - (instancetype)init { @@ -6373,12 +6337,12 @@ - (NSString *)description @end -@implementation MTREnergyCalendarClusterCalendarPeriod +@implementation MTREnergyCalendarClusterCalendarPeriodStruct - (instancetype)init { if (self = [super init]) { - _startDate = @(0); + _startDate = nil; _days = [NSArray array]; } @@ -6387,7 +6351,7 @@ - (instancetype)init - (id)copyWithZone:(NSZone * _Nullable)zone { - auto other = [[MTREnergyCalendarClusterCalendarPeriod alloc] init]; + auto other = [[MTREnergyCalendarClusterCalendarPeriodStruct alloc] init]; other.startDate = self.startDate; other.days = self.days; @@ -6412,9 +6376,9 @@ - (instancetype)init _peakPeriod = @(0); - _startTime = @(0); + _startTime = nil; - _endTime = @(0); + _endTime = nil; } return self; } diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp index 8fa7458e60df1a..b1205acd619430 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp @@ -17925,57 +17925,6 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } // namespace TransitionStruct -namespace Date { -CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const -{ - DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kYear), year); - encoder.Encode(to_underlying(Fields::kMonth), month); - encoder.Encode(to_underlying(Fields::kDay), day); - encoder.Encode(to_underlying(Fields::kDayOfWeek), dayOfWeek); - return encoder.Finalize(); -} - -CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) -{ - detail::StructDecodeIterator __iterator(reader); - while (true) - { - auto __element = __iterator.Next(); - if (std::holds_alternative(__element)) - { - return std::get(__element); - } - - CHIP_ERROR err = CHIP_NO_ERROR; - const uint8_t __context_tag = std::get(__element); - - if (__context_tag == to_underlying(Fields::kYear)) - { - err = DataModel::Decode(reader, year); - } - else if (__context_tag == to_underlying(Fields::kMonth)) - { - err = DataModel::Decode(reader, month); - } - else if (__context_tag == to_underlying(Fields::kDay)) - { - err = DataModel::Decode(reader, day); - } - else if (__context_tag == to_underlying(Fields::kDayOfWeek)) - { - err = DataModel::Decode(reader, dayOfWeek); - } - else - { - } - - ReturnErrorOnFailure(err); - } -} - -} // namespace Date - namespace DayStruct { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { @@ -18027,7 +17976,7 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } // namespace DayStruct -namespace CalendarPeriod { +namespace CalendarPeriodStruct { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; @@ -18066,7 +18015,7 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } } -} // namespace CalendarPeriod +} // namespace CalendarPeriodStruct namespace PeakPeriodStruct { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const 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 9ad8a2d81f1c09..559603845ae133 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 @@ -24350,33 +24350,6 @@ struct Type using DecodableType = Type; } // namespace TransitionStruct -namespace Date { -enum class Fields : uint8_t -{ - kYear = 0, - kMonth = 1, - kDay = 2, - kDayOfWeek = 3, -}; - -struct Type -{ -public: - Optional> year; - Optional> month; - Optional> day; - Optional> dayOfWeek; - - CHIP_ERROR Decode(TLV::TLVReader & reader); - - static constexpr bool kIsFabricScoped = false; - - CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; -}; - -using DecodableType = Type; - -} // namespace Date namespace DayStruct { enum class Fields : uint8_t { @@ -24389,7 +24362,7 @@ enum class Fields : uint8_t struct Type { public: - Optional date; + Optional date; Optional> daysOfWeek; DataModel::List transitions; Optional calendarID; @@ -24402,7 +24375,7 @@ struct Type struct DecodableType { public: - Optional date; + Optional date; Optional> daysOfWeek; DataModel::DecodableList transitions; Optional calendarID; @@ -24413,7 +24386,7 @@ struct DecodableType }; } // namespace DayStruct -namespace CalendarPeriod { +namespace CalendarPeriodStruct { enum class Fields : uint8_t { kStartDate = 0, @@ -24423,7 +24396,7 @@ enum class Fields : uint8_t struct Type { public: - uint32_t startDate = static_cast(0); + DataModel::Nullable startDate; DataModel::List days; static constexpr bool kIsFabricScoped = false; @@ -24434,7 +24407,7 @@ struct Type struct DecodableType { public: - uint32_t startDate = static_cast(0); + DataModel::Nullable startDate; DataModel::DecodableList days; CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -24442,7 +24415,7 @@ struct DecodableType static constexpr bool kIsFabricScoped = false; }; -} // namespace CalendarPeriod +} // namespace CalendarPeriodStruct namespace PeakPeriodStruct { enum class Fields : uint8_t { @@ -24457,8 +24430,8 @@ struct Type public: PeakPeriodSeverityEnum severity = static_cast(0); uint16_t peakPeriod = static_cast(0); - uint32_t startTime = static_cast(0); - uint32_t endTime = static_cast(0); + DataModel::Nullable startTime; + DataModel::Nullable endTime; CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -24538,11 +24511,12 @@ struct TypeInfo namespace CalendarPeriods { struct TypeInfo { - using Type = chip::app::DataModel::List; - using DecodableType = - chip::app::DataModel::DecodableList; - using DecodableArgType = - const chip::app::DataModel::DecodableList &; + using Type = chip::app::DataModel::Nullable< + chip::app::DataModel::List>; + using DecodableType = chip::app::DataModel::Nullable< + chip::app::DataModel::DecodableList>; + using DecodableArgType = const chip::app::DataModel::Nullable< + chip::app::DataModel::DecodableList> &; static constexpr ClusterId GetClusterId() { return Clusters::EnergyCalendar::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::CalendarPeriods::Id; } @@ -24552,11 +24526,12 @@ struct TypeInfo namespace SpecialDays { struct TypeInfo { - using Type = chip::app::DataModel::List; - using DecodableType = - chip::app::DataModel::DecodableList; - using DecodableArgType = - const chip::app::DataModel::DecodableList &; + using Type = chip::app::DataModel::Nullable< + chip::app::DataModel::List>; + using DecodableType = chip::app::DataModel::Nullable< + chip::app::DataModel::DecodableList>; + using DecodableArgType = const chip::app::DataModel::Nullable< + chip::app::DataModel::DecodableList> &; static constexpr ClusterId GetClusterId() { return Clusters::EnergyCalendar::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::SpecialDays::Id; } diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 9048d2d7a66438..8c75a496dcc8ef 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -21354,11 +21354,11 @@ void registerClusterEnergyCalendar(Commands & commands, CredentialIssuerCommands Id, "event-id", 0, UINT32_MAX, Attributes::EventID::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>( Id, "start-date", 0, UINT32_MAX, Attributes::StartDate::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>>( + make_unique>>>( Id, "calendar-periods", Attributes::CalendarPeriods::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>>( + make_unique>>>( Id, "special-days", Attributes::SpecialDays::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique< WriteAttributeAsComplex>>( diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index 3cd2a1edf70564..91489bfd7fee76 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -4026,54 +4026,6 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::EnergyCalendar::Struct ComplexArgumentParser::Finalize(request.auxiliaryLoad); } -CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::EnergyCalendar::Structs::Date::Type & request, - Json::Value & value) -{ - VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); - - // Copy to track which members we already processed. - Json::Value valueCopy(value); - - char labelWithMember[kMaxLabelLength]; - if (value.isMember("year")) - { - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "year"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.year, value["year"])); - } - valueCopy.removeMember("year"); - - if (value.isMember("month")) - { - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "month"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.month, value["month"])); - } - valueCopy.removeMember("month"); - - if (value.isMember("day")) - { - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "day"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.day, value["day"])); - } - valueCopy.removeMember("day"); - - if (value.isMember("dayOfWeek")) - { - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "dayOfWeek"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.dayOfWeek, value["dayOfWeek"])); - } - valueCopy.removeMember("dayOfWeek"); - - return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); -} - -void ComplexArgumentParser::Finalize(chip::app::Clusters::EnergyCalendar::Structs::Date::Type & request) -{ - ComplexArgumentParser::Finalize(request.year); - ComplexArgumentParser::Finalize(request.month); - ComplexArgumentParser::Finalize(request.day); - ComplexArgumentParser::Finalize(request.dayOfWeek); -} - CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::EnergyCalendar::Structs::DayStruct::Type & request, Json::Value & value) { @@ -4123,7 +4075,7 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::EnergyCalendar::Struct } CHIP_ERROR ComplexArgumentParser::Setup(const char * label, - chip::app::Clusters::EnergyCalendar::Structs::CalendarPeriod::Type & request, + chip::app::Clusters::EnergyCalendar::Structs::CalendarPeriodStruct::Type & request, Json::Value & value) { VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); @@ -4132,8 +4084,8 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, Json::Value valueCopy(value); ReturnErrorOnFailure( - ComplexArgumentParser::EnsureMemberExist("CalendarPeriod.startDate", "startDate", value.isMember("startDate"))); - ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("CalendarPeriod.days", "days", value.isMember("days"))); + ComplexArgumentParser::EnsureMemberExist("CalendarPeriodStruct.startDate", "startDate", value.isMember("startDate"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("CalendarPeriodStruct.days", "days", value.isMember("days"))); char labelWithMember[kMaxLabelLength]; snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "startDate"); @@ -4147,7 +4099,7 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); } -void ComplexArgumentParser::Finalize(chip::app::Clusters::EnergyCalendar::Structs::CalendarPeriod::Type & request) +void ComplexArgumentParser::Finalize(chip::app::Clusters::EnergyCalendar::Structs::CalendarPeriodStruct::Type & request) { ComplexArgumentParser::Finalize(request.startDate); ComplexArgumentParser::Finalize(request.days); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h index eeffd3af0a8b41..4d05bb09f58db8 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h @@ -459,20 +459,15 @@ static CHIP_ERROR Setup(const char * label, chip::app::Clusters::EnergyCalendar: static void Finalize(chip::app::Clusters::EnergyCalendar::Structs::TransitionStruct::Type & request); -static CHIP_ERROR Setup(const char * label, chip::app::Clusters::EnergyCalendar::Structs::Date::Type & request, - Json::Value & value); - -static void Finalize(chip::app::Clusters::EnergyCalendar::Structs::Date::Type & request); - static CHIP_ERROR Setup(const char * label, chip::app::Clusters::EnergyCalendar::Structs::DayStruct::Type & request, Json::Value & value); static void Finalize(chip::app::Clusters::EnergyCalendar::Structs::DayStruct::Type & request); -static CHIP_ERROR Setup(const char * label, chip::app::Clusters::EnergyCalendar::Structs::CalendarPeriod::Type & request, +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::EnergyCalendar::Structs::CalendarPeriodStruct::Type & request, Json::Value & value); -static void Finalize(chip::app::Clusters::EnergyCalendar::Structs::CalendarPeriod::Type & request); +static void Finalize(chip::app::Clusters::EnergyCalendar::Structs::CalendarPeriodStruct::Type & request); static CHIP_ERROR Setup(const char * label, chip::app::Clusters::EnergyCalendar::Structs::PeakPeriodStruct::Type & request, Json::Value & value); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index 37009ec76324a7..964583dea1310c 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -3569,47 +3569,6 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } -CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, - const chip::app::Clusters::EnergyCalendar::Structs::Date::DecodableType & value) -{ - DataModelLogger::LogString(label, indent, "{"); - { - CHIP_ERROR err = LogValue("Year", indent + 1, value.year); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Year'"); - return err; - } - } - { - CHIP_ERROR err = LogValue("Month", indent + 1, value.month); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Month'"); - return err; - } - } - { - CHIP_ERROR err = LogValue("Day", indent + 1, value.day); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Day'"); - return err; - } - } - { - CHIP_ERROR err = LogValue("DayOfWeek", indent + 1, value.dayOfWeek); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'DayOfWeek'"); - return err; - } - } - DataModelLogger::LogString(indent, "}"); - - return CHIP_NO_ERROR; -} - CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::EnergyCalendar::Structs::DayStruct::DecodableType & value) { @@ -3651,8 +3610,9 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } -CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, - const chip::app::Clusters::EnergyCalendar::Structs::CalendarPeriod::DecodableType & value) +CHIP_ERROR +DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::EnergyCalendar::Structs::CalendarPeriodStruct::DecodableType & value) { DataModelLogger::LogString(label, indent, "{"); { @@ -14122,12 +14082,16 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP return DataModelLogger::LogValue("StartDate", 1, value); } case EnergyCalendar::Attributes::CalendarPeriods::Id: { - chip::app::DataModel::DecodableList value; + chip::app::DataModel::Nullable> + value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("CalendarPeriods", 1, value); } case EnergyCalendar::Attributes::SpecialDays::Id: { - chip::app::DataModel::DecodableList value; + chip::app::DataModel::Nullable< + chip::app::DataModel::DecodableList> + value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("SpecialDays", 1, value); } diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h index 6de62acc04bbaf..5072bfb4e4d843 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h @@ -287,14 +287,11 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::EnergyCalendar::Structs::TransitionStruct::DecodableType & value); -static CHIP_ERROR LogValue(const char * label, size_t indent, - const chip::app::Clusters::EnergyCalendar::Structs::Date::DecodableType & value); - static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::EnergyCalendar::Structs::DayStruct::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, - const chip::app::Clusters::EnergyCalendar::Structs::CalendarPeriod::DecodableType & value); + const chip::app::Clusters::EnergyCalendar::Structs::CalendarPeriodStruct::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::EnergyCalendar::Structs::PeakPeriodStruct::DecodableType & value); From b6e5b475c33db407721319a55773e499a790d3e0 Mon Sep 17 00:00:00 2001 From: Mikhail Antropov Date: Tue, 25 Jun 2024 16:34:46 +0300 Subject: [PATCH 05/16] Remove wrong generated files --- src/app/common/templates/config-data.yaml | 1 - .../EnergyCalendarClusterCalendarPeriod.kt | 71 --------- .../structs/EnergyCalendarClusterDate.kt | 138 ------------------ .../EnergyCalendarClusterCalendarPeriod.kt | 71 --------- .../structs/EnergyCalendarClusterDate.kt | 138 ------------------ 5 files changed, 419 deletions(-) delete mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterCalendarPeriod.kt delete mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDate.kt delete mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterCalendarPeriod.kt delete mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDate.kt diff --git a/src/app/common/templates/config-data.yaml b/src/app/common/templates/config-data.yaml index 1ee9f9756e5b33..61e7c45582268a 100644 --- a/src/app/common/templates/config-data.yaml +++ b/src/app/common/templates/config-data.yaml @@ -38,7 +38,6 @@ CommandHandlerInterfaceOnlyClusters: - Microwave Oven Control - Energy EVSE - Energy EVSE Mode - - Energy Calendar - Device Energy Management - Device Energy Management Mode - Electrical Power Measurement diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterCalendarPeriod.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterCalendarPeriod.kt deleted file mode 100644 index f2964f0d0089b7..00000000000000 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterCalendarPeriod.kt +++ /dev/null @@ -1,71 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * - * 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. - */ -package chip.devicecontroller.cluster.structs - -import chip.devicecontroller.cluster.* -import matter.tlv.AnonymousTag -import matter.tlv.ContextSpecificTag -import matter.tlv.Tag -import matter.tlv.TlvReader -import matter.tlv.TlvWriter - -class EnergyCalendarClusterCalendarPeriod( - val startDate: ULong, - val days: List -) { - override fun toString(): String = buildString { - append("EnergyCalendarClusterCalendarPeriod {\n") - append("\tstartDate : $startDate\n") - append("\tdays : $days\n") - append("}\n") - } - - fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { - tlvWriter.apply { - startStructure(tlvTag) - put(ContextSpecificTag(TAG_START_DATE), startDate) - startArray(ContextSpecificTag(TAG_DAYS)) - for (item in days.iterator()) { - item.toTlv(AnonymousTag, this) - } - endArray() - endStructure() - } - } - - companion object { - private const val TAG_START_DATE = 0 - private const val TAG_DAYS = 1 - - fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyCalendarClusterCalendarPeriod { - tlvReader.enterStructure(tlvTag) - val startDate = tlvReader.getULong(ContextSpecificTag(TAG_START_DATE)) - val days = - buildList { - tlvReader.enterArray(ContextSpecificTag(TAG_DAYS)) - while (!tlvReader.isEndOfContainer()) { - add(EnergyCalendarClusterDayStruct.fromTlv(AnonymousTag, tlvReader)) - } - tlvReader.exitContainer() - } - - tlvReader.exitContainer() - - return EnergyCalendarClusterCalendarPeriod(startDate, days) - } - } -} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDate.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDate.kt deleted file mode 100644 index 3cdea415955521..00000000000000 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDate.kt +++ /dev/null @@ -1,138 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * - * 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. - */ -package chip.devicecontroller.cluster.structs - -import chip.devicecontroller.cluster.* -import java.util.Optional -import matter.tlv.ContextSpecificTag -import matter.tlv.Tag -import matter.tlv.TlvReader -import matter.tlv.TlvWriter - -class EnergyCalendarClusterDate( - val year: Optional?, - val month: Optional?, - val day: Optional?, - val dayOfWeek: Optional? -) { - override fun toString(): String = buildString { - append("EnergyCalendarClusterDate {\n") - append("\tyear : $year\n") - append("\tmonth : $month\n") - append("\tday : $day\n") - append("\tdayOfWeek : $dayOfWeek\n") - append("}\n") - } - - fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { - tlvWriter.apply { - startStructure(tlvTag) - if (year != null) { - if (year.isPresent) { - val optyear = year.get() - put(ContextSpecificTag(TAG_YEAR), optyear) - } - } else { - putNull(ContextSpecificTag(TAG_YEAR)) - } - if (month != null) { - if (month.isPresent) { - val optmonth = month.get() - put(ContextSpecificTag(TAG_MONTH), optmonth) - } - } else { - putNull(ContextSpecificTag(TAG_MONTH)) - } - if (day != null) { - if (day.isPresent) { - val optday = day.get() - put(ContextSpecificTag(TAG_DAY), optday) - } - } else { - putNull(ContextSpecificTag(TAG_DAY)) - } - if (dayOfWeek != null) { - if (dayOfWeek.isPresent) { - val optdayOfWeek = dayOfWeek.get() - put(ContextSpecificTag(TAG_DAY_OF_WEEK), optdayOfWeek) - } - } else { - putNull(ContextSpecificTag(TAG_DAY_OF_WEEK)) - } - endStructure() - } - } - - companion object { - private const val TAG_YEAR = 0 - private const val TAG_MONTH = 1 - private const val TAG_DAY = 2 - private const val TAG_DAY_OF_WEEK = 3 - - fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyCalendarClusterDate { - tlvReader.enterStructure(tlvTag) - val year = - if (!tlvReader.isNull()) { - if (tlvReader.isNextTag(ContextSpecificTag(TAG_YEAR))) { - Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_YEAR))) - } else { - Optional.empty() - } - } else { - tlvReader.getNull(ContextSpecificTag(TAG_YEAR)) - null - } - val month = - if (!tlvReader.isNull()) { - if (tlvReader.isNextTag(ContextSpecificTag(TAG_MONTH))) { - Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_MONTH))) - } else { - Optional.empty() - } - } else { - tlvReader.getNull(ContextSpecificTag(TAG_MONTH)) - null - } - val day = - if (!tlvReader.isNull()) { - if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY))) { - Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_DAY))) - } else { - Optional.empty() - } - } else { - tlvReader.getNull(ContextSpecificTag(TAG_DAY)) - null - } - val dayOfWeek = - if (!tlvReader.isNull()) { - if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY_OF_WEEK))) { - Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_DAY_OF_WEEK))) - } else { - Optional.empty() - } - } else { - tlvReader.getNull(ContextSpecificTag(TAG_DAY_OF_WEEK)) - null - } - - tlvReader.exitContainer() - - return EnergyCalendarClusterDate(year, month, day, dayOfWeek) - } - } -} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterCalendarPeriod.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterCalendarPeriod.kt deleted file mode 100644 index 1e4627775af23e..00000000000000 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterCalendarPeriod.kt +++ /dev/null @@ -1,71 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * - * 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. - */ -package matter.controller.cluster.structs - -import matter.controller.cluster.* -import matter.tlv.AnonymousTag -import matter.tlv.ContextSpecificTag -import matter.tlv.Tag -import matter.tlv.TlvReader -import matter.tlv.TlvWriter - -class EnergyCalendarClusterCalendarPeriod( - val startDate: UInt, - val days: List -) { - override fun toString(): String = buildString { - append("EnergyCalendarClusterCalendarPeriod {\n") - append("\tstartDate : $startDate\n") - append("\tdays : $days\n") - append("}\n") - } - - fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { - tlvWriter.apply { - startStructure(tlvTag) - put(ContextSpecificTag(TAG_START_DATE), startDate) - startArray(ContextSpecificTag(TAG_DAYS)) - for (item in days.iterator()) { - item.toTlv(AnonymousTag, this) - } - endArray() - endStructure() - } - } - - companion object { - private const val TAG_START_DATE = 0 - private const val TAG_DAYS = 1 - - fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyCalendarClusterCalendarPeriod { - tlvReader.enterStructure(tlvTag) - val startDate = tlvReader.getUInt(ContextSpecificTag(TAG_START_DATE)) - val days = - buildList { - tlvReader.enterArray(ContextSpecificTag(TAG_DAYS)) - while (!tlvReader.isEndOfContainer()) { - add(EnergyCalendarClusterDayStruct.fromTlv(AnonymousTag, tlvReader)) - } - tlvReader.exitContainer() - } - - tlvReader.exitContainer() - - return EnergyCalendarClusterCalendarPeriod(startDate, days) - } - } -} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDate.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDate.kt deleted file mode 100644 index 112517f1d0a879..00000000000000 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDate.kt +++ /dev/null @@ -1,138 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * - * 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. - */ -package matter.controller.cluster.structs - -import java.util.Optional -import matter.controller.cluster.* -import matter.tlv.ContextSpecificTag -import matter.tlv.Tag -import matter.tlv.TlvReader -import matter.tlv.TlvWriter - -class EnergyCalendarClusterDate( - val year: Optional?, - val month: Optional?, - val day: Optional?, - val dayOfWeek: Optional? -) { - override fun toString(): String = buildString { - append("EnergyCalendarClusterDate {\n") - append("\tyear : $year\n") - append("\tmonth : $month\n") - append("\tday : $day\n") - append("\tdayOfWeek : $dayOfWeek\n") - append("}\n") - } - - fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { - tlvWriter.apply { - startStructure(tlvTag) - if (year != null) { - if (year.isPresent) { - val optyear = year.get() - put(ContextSpecificTag(TAG_YEAR), optyear) - } - } else { - putNull(ContextSpecificTag(TAG_YEAR)) - } - if (month != null) { - if (month.isPresent) { - val optmonth = month.get() - put(ContextSpecificTag(TAG_MONTH), optmonth) - } - } else { - putNull(ContextSpecificTag(TAG_MONTH)) - } - if (day != null) { - if (day.isPresent) { - val optday = day.get() - put(ContextSpecificTag(TAG_DAY), optday) - } - } else { - putNull(ContextSpecificTag(TAG_DAY)) - } - if (dayOfWeek != null) { - if (dayOfWeek.isPresent) { - val optdayOfWeek = dayOfWeek.get() - put(ContextSpecificTag(TAG_DAY_OF_WEEK), optdayOfWeek) - } - } else { - putNull(ContextSpecificTag(TAG_DAY_OF_WEEK)) - } - endStructure() - } - } - - companion object { - private const val TAG_YEAR = 0 - private const val TAG_MONTH = 1 - private const val TAG_DAY = 2 - private const val TAG_DAY_OF_WEEK = 3 - - fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyCalendarClusterDate { - tlvReader.enterStructure(tlvTag) - val year = - if (!tlvReader.isNull()) { - if (tlvReader.isNextTag(ContextSpecificTag(TAG_YEAR))) { - Optional.of(tlvReader.getUShort(ContextSpecificTag(TAG_YEAR))) - } else { - Optional.empty() - } - } else { - tlvReader.getNull(ContextSpecificTag(TAG_YEAR)) - null - } - val month = - if (!tlvReader.isNull()) { - if (tlvReader.isNextTag(ContextSpecificTag(TAG_MONTH))) { - Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_MONTH))) - } else { - Optional.empty() - } - } else { - tlvReader.getNull(ContextSpecificTag(TAG_MONTH)) - null - } - val day = - if (!tlvReader.isNull()) { - if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY))) { - Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_DAY))) - } else { - Optional.empty() - } - } else { - tlvReader.getNull(ContextSpecificTag(TAG_DAY)) - null - } - val dayOfWeek = - if (!tlvReader.isNull()) { - if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY_OF_WEEK))) { - Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_DAY_OF_WEEK))) - } else { - Optional.empty() - } - } else { - tlvReader.getNull(ContextSpecificTag(TAG_DAY_OF_WEEK)) - null - } - - tlvReader.exitContainer() - - return EnergyCalendarClusterDate(year, month, day, dayOfWeek) - } - } -} From 813fb11b796525e0ca7defd7973d681bd4a86336 Mon Sep 17 00:00:00 2001 From: Mikhail Antropov Date: Tue, 25 Jun 2024 18:57:04 +0300 Subject: [PATCH 06/16] Rebase on master --- ...ergyCalendarClusterCalendarPeriodStruct.kt | 2 +- .../structs/EnergyCalendarClusterDayStruct.kt | 2 +- .../EnergyCalendarClusterPeakPeriodStruct.kt | 2 +- .../EnergyCalendarClusterTransitionStruct.kt | 4 +- .../cluster/clusters/EnergyCalendarCluster.kt | 74 +++++++++---------- ...ergyCalendarClusterCalendarPeriodStruct.kt | 2 +- .../structs/EnergyCalendarClusterDayStruct.kt | 2 +- .../EnergyCalendarClusterPeakPeriodStruct.kt | 2 +- .../EnergyCalendarClusterTransitionStruct.kt | 4 +- 9 files changed, 47 insertions(+), 47 deletions(-) diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterCalendarPeriodStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterCalendarPeriodStruct.kt index ea44538217a6ce..33496767f70b5f 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterCalendarPeriodStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterCalendarPeriodStruct.kt @@ -25,7 +25,7 @@ import matter.tlv.TlvWriter class EnergyCalendarClusterCalendarPeriodStruct( val startDate: ULong?, - val days: List + val days: List, ) { override fun toString(): String = buildString { append("EnergyCalendarClusterCalendarPeriodStruct {\n") diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt index a2386cbcc12957..0520e76669c8ea 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt @@ -28,7 +28,7 @@ class EnergyCalendarClusterDayStruct( val date: Optional, val daysOfWeek: Optional, val transitions: List, - val calendarID: Optional + val calendarID: Optional, ) { override fun toString(): String = buildString { append("EnergyCalendarClusterDayStruct {\n") diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt index 962a0bb1e1a46c..c14d78bf9cff5b 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt @@ -26,7 +26,7 @@ class EnergyCalendarClusterPeakPeriodStruct( val severity: UInt, val peakPeriod: UInt, val startTime: ULong?, - val endTime: ULong? + val endTime: ULong?, ) { override fun toString(): String = buildString { append("EnergyCalendarClusterPeakPeriodStruct {\n") diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterTransitionStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterTransitionStruct.kt index 638158cc7f2b01..42cb66acd89939 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterTransitionStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterTransitionStruct.kt @@ -27,7 +27,7 @@ class EnergyCalendarClusterTransitionStruct( val transitionTime: UInt, val priceTier: Optional, val friendlyCredit: Optional, - val auxiliaryLoad: Optional + val auxiliaryLoad: Optional, ) { override fun toString(): String = buildString { append("EnergyCalendarClusterTransitionStruct {\n") @@ -92,7 +92,7 @@ class EnergyCalendarClusterTransitionStruct( transitionTime, priceTier, friendlyCredit, - auxiliaryLoad + auxiliaryLoad, ) } } diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyCalendarCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyCalendarCluster.kt index 242d4aa724f180..182eafbb889c9e 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyCalendarCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyCalendarCluster.kt @@ -36,7 +36,7 @@ import matter.tlv.TlvReader class EnergyCalendarCluster( private val controller: MatterController, - private val endpointId: UShort + private val endpointId: UShort, ) { class CalendarIDAttribute(val value: UInt?) @@ -244,7 +244,7 @@ class EnergyCalendarCluster( suspend fun subscribeCalendarIDAttribute( minInterval: Int, - maxInterval: Int + maxInterval: Int, ): Flow { val ATTRIBUTE_ID: UInt = 0u val attributePaths = @@ -257,7 +257,7 @@ class EnergyCalendarCluster( eventPaths = emptyList(), attributePaths = attributePaths, minInterval = Duration.ofSeconds(minInterval.toLong()), - maxInterval = Duration.ofSeconds(maxInterval.toLong()) + maxInterval = Duration.ofSeconds(maxInterval.toLong()), ) return controller.subscribe(subscribeRequest).transform { subscriptionState -> @@ -337,7 +337,7 @@ class EnergyCalendarCluster( suspend fun subscribeNameAttribute( minInterval: Int, - maxInterval: Int + maxInterval: Int, ): Flow { val ATTRIBUTE_ID: UInt = 1u val attributePaths = @@ -350,7 +350,7 @@ class EnergyCalendarCluster( eventPaths = emptyList(), attributePaths = attributePaths, minInterval = Duration.ofSeconds(minInterval.toLong()), - maxInterval = Duration.ofSeconds(maxInterval.toLong()) + maxInterval = Duration.ofSeconds(maxInterval.toLong()), ) return controller.subscribe(subscribeRequest).transform { subscriptionState -> @@ -430,7 +430,7 @@ class EnergyCalendarCluster( suspend fun subscribeProviderIDAttribute( minInterval: Int, - maxInterval: Int + maxInterval: Int, ): Flow { val ATTRIBUTE_ID: UInt = 2u val attributePaths = @@ -443,7 +443,7 @@ class EnergyCalendarCluster( eventPaths = emptyList(), attributePaths = attributePaths, minInterval = Duration.ofSeconds(minInterval.toLong()), - maxInterval = Duration.ofSeconds(maxInterval.toLong()) + maxInterval = Duration.ofSeconds(maxInterval.toLong()), ) return controller.subscribe(subscribeRequest).transform { subscriptionState -> @@ -523,7 +523,7 @@ class EnergyCalendarCluster( suspend fun subscribeEventIDAttribute( minInterval: Int, - maxInterval: Int + maxInterval: Int, ): Flow { val ATTRIBUTE_ID: UInt = 3u val attributePaths = @@ -536,7 +536,7 @@ class EnergyCalendarCluster( eventPaths = emptyList(), attributePaths = attributePaths, minInterval = Duration.ofSeconds(minInterval.toLong()), - maxInterval = Duration.ofSeconds(maxInterval.toLong()) + maxInterval = Duration.ofSeconds(maxInterval.toLong()), ) return controller.subscribe(subscribeRequest).transform { subscriptionState -> @@ -616,7 +616,7 @@ class EnergyCalendarCluster( suspend fun subscribeStartDateAttribute( minInterval: Int, - maxInterval: Int + maxInterval: Int, ): Flow { val ATTRIBUTE_ID: UInt = 4u val attributePaths = @@ -629,7 +629,7 @@ class EnergyCalendarCluster( eventPaths = emptyList(), attributePaths = attributePaths, minInterval = Duration.ofSeconds(minInterval.toLong()), - maxInterval = Duration.ofSeconds(maxInterval.toLong()) + maxInterval = Duration.ofSeconds(maxInterval.toLong()), ) return controller.subscribe(subscribeRequest).transform { subscriptionState -> @@ -715,7 +715,7 @@ class EnergyCalendarCluster( suspend fun subscribeCalendarPeriodsAttribute( minInterval: Int, - maxInterval: Int + maxInterval: Int, ): Flow { val ATTRIBUTE_ID: UInt = 5u val attributePaths = @@ -728,7 +728,7 @@ class EnergyCalendarCluster( eventPaths = emptyList(), attributePaths = attributePaths, minInterval = Duration.ofSeconds(minInterval.toLong()), - maxInterval = Duration.ofSeconds(maxInterval.toLong()) + maxInterval = Duration.ofSeconds(maxInterval.toLong()), ) return controller.subscribe(subscribeRequest).transform { subscriptionState -> @@ -822,7 +822,7 @@ class EnergyCalendarCluster( suspend fun subscribeSpecialDaysAttribute( minInterval: Int, - maxInterval: Int + maxInterval: Int, ): Flow { val ATTRIBUTE_ID: UInt = 6u val attributePaths = @@ -835,7 +835,7 @@ class EnergyCalendarCluster( eventPaths = emptyList(), attributePaths = attributePaths, minInterval = Duration.ofSeconds(minInterval.toLong()), - maxInterval = Duration.ofSeconds(maxInterval.toLong()) + maxInterval = Duration.ofSeconds(maxInterval.toLong()), ) return controller.subscribe(subscribeRequest).transform { subscriptionState -> @@ -921,7 +921,7 @@ class EnergyCalendarCluster( suspend fun subscribeCurrentDayAttribute( minInterval: Int, - maxInterval: Int + maxInterval: Int, ): Flow { val ATTRIBUTE_ID: UInt = 7u val attributePaths = @@ -934,7 +934,7 @@ class EnergyCalendarCluster( eventPaths = emptyList(), attributePaths = attributePaths, minInterval = Duration.ofSeconds(minInterval.toLong()), - maxInterval = Duration.ofSeconds(maxInterval.toLong()) + maxInterval = Duration.ofSeconds(maxInterval.toLong()), ) return controller.subscribe(subscribeRequest).transform { subscriptionState -> @@ -1014,7 +1014,7 @@ class EnergyCalendarCluster( suspend fun subscribeNextDayAttribute( minInterval: Int, - maxInterval: Int + maxInterval: Int, ): Flow { val ATTRIBUTE_ID: UInt = 8u val attributePaths = @@ -1027,7 +1027,7 @@ class EnergyCalendarCluster( eventPaths = emptyList(), attributePaths = attributePaths, minInterval = Duration.ofSeconds(minInterval.toLong()), - maxInterval = Duration.ofSeconds(maxInterval.toLong()) + maxInterval = Duration.ofSeconds(maxInterval.toLong()), ) return controller.subscribe(subscribeRequest).transform { subscriptionState -> @@ -1107,7 +1107,7 @@ class EnergyCalendarCluster( suspend fun subscribeCurrentTransitionAttribute( minInterval: Int, - maxInterval: Int + maxInterval: Int, ): Flow { val ATTRIBUTE_ID: UInt = 9u val attributePaths = @@ -1120,7 +1120,7 @@ class EnergyCalendarCluster( eventPaths = emptyList(), attributePaths = attributePaths, minInterval = Duration.ofSeconds(minInterval.toLong()), - maxInterval = Duration.ofSeconds(maxInterval.toLong()) + maxInterval = Duration.ofSeconds(maxInterval.toLong()), ) return controller.subscribe(subscribeRequest).transform { subscriptionState -> @@ -1206,7 +1206,7 @@ class EnergyCalendarCluster( suspend fun subscribeCurrentPeakPeriodAttribute( minInterval: Int, - maxInterval: Int + maxInterval: Int, ): Flow { val ATTRIBUTE_ID: UInt = 10u val attributePaths = @@ -1219,7 +1219,7 @@ class EnergyCalendarCluster( eventPaths = emptyList(), attributePaths = attributePaths, minInterval = Duration.ofSeconds(minInterval.toLong()), - maxInterval = Duration.ofSeconds(maxInterval.toLong()) + maxInterval = Duration.ofSeconds(maxInterval.toLong()), ) return controller.subscribe(subscribeRequest).transform { subscriptionState -> @@ -1309,7 +1309,7 @@ class EnergyCalendarCluster( suspend fun subscribeNextPeakPeriodAttribute( minInterval: Int, - maxInterval: Int + maxInterval: Int, ): Flow { val ATTRIBUTE_ID: UInt = 11u val attributePaths = @@ -1322,7 +1322,7 @@ class EnergyCalendarCluster( eventPaths = emptyList(), attributePaths = attributePaths, minInterval = Duration.ofSeconds(minInterval.toLong()), - maxInterval = Duration.ofSeconds(maxInterval.toLong()) + maxInterval = Duration.ofSeconds(maxInterval.toLong()), ) return controller.subscribe(subscribeRequest).transform { subscriptionState -> @@ -1409,7 +1409,7 @@ class EnergyCalendarCluster( suspend fun subscribeGeneratedCommandListAttribute( minInterval: Int, - maxInterval: Int + maxInterval: Int, ): Flow { val ATTRIBUTE_ID: UInt = 65528u val attributePaths = @@ -1422,7 +1422,7 @@ class EnergyCalendarCluster( eventPaths = emptyList(), attributePaths = attributePaths, minInterval = Duration.ofSeconds(minInterval.toLong()), - maxInterval = Duration.ofSeconds(maxInterval.toLong()) + maxInterval = Duration.ofSeconds(maxInterval.toLong()), ) return controller.subscribe(subscribeRequest).transform { subscriptionState -> @@ -1506,7 +1506,7 @@ class EnergyCalendarCluster( suspend fun subscribeAcceptedCommandListAttribute( minInterval: Int, - maxInterval: Int + maxInterval: Int, ): Flow { val ATTRIBUTE_ID: UInt = 65529u val attributePaths = @@ -1519,7 +1519,7 @@ class EnergyCalendarCluster( eventPaths = emptyList(), attributePaths = attributePaths, minInterval = Duration.ofSeconds(minInterval.toLong()), - maxInterval = Duration.ofSeconds(maxInterval.toLong()) + maxInterval = Duration.ofSeconds(maxInterval.toLong()), ) return controller.subscribe(subscribeRequest).transform { subscriptionState -> @@ -1603,7 +1603,7 @@ class EnergyCalendarCluster( suspend fun subscribeEventListAttribute( minInterval: Int, - maxInterval: Int + maxInterval: Int, ): Flow { val ATTRIBUTE_ID: UInt = 65530u val attributePaths = @@ -1616,7 +1616,7 @@ class EnergyCalendarCluster( eventPaths = emptyList(), attributePaths = attributePaths, minInterval = Duration.ofSeconds(minInterval.toLong()), - maxInterval = Duration.ofSeconds(maxInterval.toLong()) + maxInterval = Duration.ofSeconds(maxInterval.toLong()), ) return controller.subscribe(subscribeRequest).transform { subscriptionState -> @@ -1698,7 +1698,7 @@ class EnergyCalendarCluster( suspend fun subscribeAttributeListAttribute( minInterval: Int, - maxInterval: Int + maxInterval: Int, ): Flow { val ATTRIBUTE_ID: UInt = 65531u val attributePaths = @@ -1711,7 +1711,7 @@ class EnergyCalendarCluster( eventPaths = emptyList(), attributePaths = attributePaths, minInterval = Duration.ofSeconds(minInterval.toLong()), - maxInterval = Duration.ofSeconds(maxInterval.toLong()) + maxInterval = Duration.ofSeconds(maxInterval.toLong()), ) return controller.subscribe(subscribeRequest).transform { subscriptionState -> @@ -1786,7 +1786,7 @@ class EnergyCalendarCluster( suspend fun subscribeFeatureMapAttribute( minInterval: Int, - maxInterval: Int + maxInterval: Int, ): Flow { val ATTRIBUTE_ID: UInt = 65532u val attributePaths = @@ -1799,7 +1799,7 @@ class EnergyCalendarCluster( eventPaths = emptyList(), attributePaths = attributePaths, minInterval = Duration.ofSeconds(minInterval.toLong()), - maxInterval = Duration.ofSeconds(maxInterval.toLong()) + maxInterval = Duration.ofSeconds(maxInterval.toLong()), ) return controller.subscribe(subscribeRequest).transform { subscriptionState -> @@ -1867,7 +1867,7 @@ class EnergyCalendarCluster( suspend fun subscribeClusterRevisionAttribute( minInterval: Int, - maxInterval: Int + maxInterval: Int, ): Flow { val ATTRIBUTE_ID: UInt = 65533u val attributePaths = @@ -1880,7 +1880,7 @@ class EnergyCalendarCluster( eventPaths = emptyList(), attributePaths = attributePaths, minInterval = Duration.ofSeconds(minInterval.toLong()), - maxInterval = Duration.ofSeconds(maxInterval.toLong()) + maxInterval = Duration.ofSeconds(maxInterval.toLong()), ) return controller.subscribe(subscribeRequest).transform { subscriptionState -> diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterCalendarPeriodStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterCalendarPeriodStruct.kt index e32c8bdc7d8094..a18bcbe8891118 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterCalendarPeriodStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterCalendarPeriodStruct.kt @@ -25,7 +25,7 @@ import matter.tlv.TlvWriter class EnergyCalendarClusterCalendarPeriodStruct( val startDate: UInt?, - val days: List + val days: List, ) { override fun toString(): String = buildString { append("EnergyCalendarClusterCalendarPeriodStruct {\n") diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt index 7efced98109f2c..a45936a14060d9 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt @@ -28,7 +28,7 @@ class EnergyCalendarClusterDayStruct( val date: Optional, val daysOfWeek: Optional, val transitions: List, - val calendarID: Optional + val calendarID: Optional, ) { override fun toString(): String = buildString { append("EnergyCalendarClusterDayStruct {\n") diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt index 51cd331853ae98..b12465d88c55f4 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt @@ -26,7 +26,7 @@ class EnergyCalendarClusterPeakPeriodStruct( val severity: UByte, val peakPeriod: UShort, val startTime: UInt?, - val endTime: UInt? + val endTime: UInt?, ) { override fun toString(): String = buildString { append("EnergyCalendarClusterPeakPeriodStruct {\n") diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterTransitionStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterTransitionStruct.kt index 48dc3ed1946e1e..57a0db6559ee93 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterTransitionStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterTransitionStruct.kt @@ -27,7 +27,7 @@ class EnergyCalendarClusterTransitionStruct( val transitionTime: UShort, val priceTier: Optional, val friendlyCredit: Optional, - val auxiliaryLoad: Optional + val auxiliaryLoad: Optional, ) { override fun toString(): String = buildString { append("EnergyCalendarClusterTransitionStruct {\n") @@ -92,7 +92,7 @@ class EnergyCalendarClusterTransitionStruct( transitionTime, priceTier, friendlyCredit, - auxiliaryLoad + auxiliaryLoad, ) } } From d2283eddab377fae9f304befe8f7b441fb5129ef Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Tue, 25 Jun 2024 15:57:30 +0000 Subject: [PATCH 07/16] Restyled by whitespace --- src/app/zap_cluster_list.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/zap_cluster_list.json b/src/app/zap_cluster_list.json index 5104d072787be4..1b8da2e47a63f4 100644 --- a/src/app/zap_cluster_list.json +++ b/src/app/zap_cluster_list.json @@ -397,4 +397,4 @@ "ENERGY_CALENDAR_CLUSTER": ["energy-calendar-server"], "ZLL_COMMISSIONING_CLUSTER": [] } -} \ No newline at end of file +} From 39a0a22876e0e7c5e9c0fa6436251b5917915f4b Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Tue, 25 Jun 2024 15:57:31 +0000 Subject: [PATCH 08/16] Restyled by prettier-json --- src/app/zap_cluster_list.json | 160 +++++++++------------------------- 1 file changed, 40 insertions(+), 120 deletions(-) diff --git a/src/app/zap_cluster_list.json b/src/app/zap_cluster_list.json index 1b8da2e47a63f4..7e6c8103a4ff25 100644 --- a/src/app/zap_cluster_list.json +++ b/src/app/zap_cluster_list.json @@ -110,9 +110,7 @@ "TARGET_NAVIGATOR_CLUSTER": [], "TEMPERATURE_CONTROL_CLUSTER": [], "TEMPERATURE_MEASUREMENT_CLUSTER": [], - "THERMOSTAT_CLUSTER": [ - "thermostat-client" - ], + "THERMOSTAT_CLUSTER": ["thermostat-client"], "THERMOSTAT_USER_INTERFACE_CONFIGURATION_CLUSTER": [], "THREAD_BORDER_ROUTER_MANAGEMENT_CLUSTER": [], "THREAD_NETWORK_DIAGNOSTICS_CLUSTER": [], @@ -137,12 +135,8 @@ "ENERGY_CALENDAR_CLUSTER": [], }, "ServerDirectories": { - "ACCESS_CONTROL_CLUSTER": [ - "access-control-server" - ], - "ACCOUNT_LOGIN_CLUSTER": [ - "account-login-server" - ], + "ACCESS_CONTROL_CLUSTER": ["access-control-server"], + "ACCOUNT_LOGIN_CLUSTER": ["account-login-server"], "ACTIONS_CLUSTER": [], "ACTIVATED_CARBON_FILTER_MONITORING_CLUSTER": [ "resource-monitoring-server" @@ -150,19 +144,11 @@ "ADMINISTRATOR_COMMISSIONING_CLUSTER": [ "administrator-commissioning-server" ], - "AIR_QUALITY_CLUSTER": [ - "air-quality-server" - ], + "AIR_QUALITY_CLUSTER": ["air-quality-server"], "ALARM_CLUSTER": [], - "APPLICATION_BASIC_CLUSTER": [ - "application-basic-server" - ], - "APPLICATION_LAUNCHER_CLUSTER": [ - "application-launcher-server" - ], - "AUDIO_OUTPUT_CLUSTER": [ - "audio-output-server" - ], + "APPLICATION_BASIC_CLUSTER": ["application-basic-server"], + "APPLICATION_LAUNCHER_CLUSTER": ["application-launcher-server"], + "AUDIO_OUTPUT_CLUSTER": ["audio-output-server"], "BALLAST_CONFIGURATION_CLUSTER": [], "BASIC_INFORMATION_CLUSTER": ["basic-information"], "BINDING_CLUSTER": ["bindings"], @@ -183,24 +169,12 @@ "COLOR_CONTROL_CLUSTER": ["color-control-server"], "COMMISSIONER_CONTROL_CLUSTER": ["commissioner-control-server"], "COMMISSIONING_CLUSTER": [], - "CONTENT_LAUNCHER_CLUSTER": [ - "content-launch-server" - ], - "CONTENT_CONTROL_CLUSTER": [ - "content-control-server" - ], - "CONTENT_APP_OBSERVER_CLUSTER": [ - "content-app-observer" - ], - "DESCRIPTOR_CLUSTER": [ - "descriptor" - ], - "DEVICE_ENERGY_MANAGEMENT_CLUSTER": [ - "device-energy-management-server" - ], - "DEVICE_ENERGY_MANAGEMENT_MODE_CLUSTER": [ - "mode-base-server" - ], + "CONTENT_LAUNCHER_CLUSTER": ["content-launch-server"], + "CONTENT_CONTROL_CLUSTER": ["content-control-server"], + "CONTENT_APP_OBSERVER_CLUSTER": ["content-app-observer"], + "DESCRIPTOR_CLUSTER": ["descriptor"], + "DEVICE_ENERGY_MANAGEMENT_CLUSTER": ["device-energy-management-server"], + "DEVICE_ENERGY_MANAGEMENT_MODE_CLUSTER": ["mode-base-server"], "DEVICE_TEMP_CLUSTER": [], "DIAGNOSTIC_LOGS_CLUSTER": ["diagnostic-logs-server"], "DISHWASHER_ALARM_CLUSTER": ["dishwasher-alarm-server"], @@ -214,27 +188,15 @@ "ELECTRICAL_POWER_MEASUREMENT_CLUSTER": [ "electrical-power-measurement-server" ], - "ENERGY_EVSE_CLUSTER": [ - "energy-evse-server" - ], - "ENERGY_EVSE_MODE_CLUSTER": [ - "mode-base-server" - ], + "ENERGY_EVSE_CLUSTER": ["energy-evse-server"], + "ENERGY_EVSE_MODE_CLUSTER": ["mode-base-server"], "ETHERNET_NETWORK_DIAGNOSTICS_CLUSTER": [ "ethernet-network-diagnostics-server" ], - "ENERGY_PREFERENCE_CLUSTER": [ - "energy-preference-server" - ], - "FAN_CONTROL_CLUSTER": [ - "fan-control-server" - ], - "FAULT_INJECTION_CLUSTER": [ - "fault-injection-server" - ], - "FIXED_LABEL_CLUSTER": [ - "fixed-label-server" - ], + "ENERGY_PREFERENCE_CLUSTER": ["energy-preference-server"], + "FAN_CONTROL_CLUSTER": ["fan-control-server"], + "FAULT_INJECTION_CLUSTER": ["fault-injection-server"], + "FIXED_LABEL_CLUSTER": ["fixed-label-server"], "FLOW_MEASUREMENT_CLUSTER": [], "FORMALDEHYDE_CONCENTRATION_MEASUREMENT_CLUSTER": [ "concentration-measurement-server" @@ -247,39 +209,19 @@ "ICD_MANAGEMENT_CLUSTER": ["icd-management-server"], "IDENTIFY_CLUSTER": ["identify-server"], "ILLUMINANCE_MEASUREMENT_CLUSTER": [], - "KEYPAD_INPUT_CLUSTER": [ - "keypad-input-server" - ], - "LAUNDRY_WASHER_MODE_CLUSTER": [ - "mode-base-server" - ], - "LEVEL_CONTROL_CLUSTER": [ - "level-control" - ], + "KEYPAD_INPUT_CLUSTER": ["keypad-input-server"], + "LAUNDRY_WASHER_MODE_CLUSTER": ["mode-base-server"], + "LEVEL_CONTROL_CLUSTER": ["level-control"], "LOCALIZATION_CONFIGURATION_CLUSTER": [ "localization-configuration-server" ], - "LOW_POWER_CLUSTER": [ - "low-power-server" - ], - "MEDIA_INPUT_CLUSTER": [ - "media-input-server" - ], - "MEDIA_PLAYBACK_CLUSTER": [ - "media-playback-server" - ], - "MICROWAVE_OVEN_CONTROL_CLUSTER": [ - "microwave-oven-control-server" - ], - "MESSAGES_CLUSTER": [ - "messages-server" - ], - "MODE_SELECT_CLUSTER": [ - "mode-select-server" - ], - "NETWORK_COMMISSIONING_CLUSTER": [ - "network-commissioning" - ], + "LOW_POWER_CLUSTER": ["low-power-server"], + "MEDIA_INPUT_CLUSTER": ["media-input-server"], + "MEDIA_PLAYBACK_CLUSTER": ["media-playback-server"], + "MICROWAVE_OVEN_CONTROL_CLUSTER": ["microwave-oven-control-server"], + "MESSAGES_CLUSTER": ["messages-server"], + "MODE_SELECT_CLUSTER": ["mode-select-server"], + "NETWORK_COMMISSIONING_CLUSTER": ["network-commissioning"], "NITROGEN_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER": [ "concentration-measurement-server" ], @@ -292,15 +234,9 @@ "OPERATIONAL_STATE_OVEN_CLUSTER": ["operational-state-server"], "OPERATIONAL_STATE_RVC_CLUSTER": ["operational-state-server"], "OTA_BOOTLOAD_CLUSTER": [], - "OTA_SOFTWARE_UPDATE_PROVIDER_CLUSTER": [ - "ota-provider" - ], - "OTA_SOFTWARE_UPDATE_REQUESTOR_CLUSTER": [ - "ota-requestor" - ], - "OVEN_MODE_CLUSTER": [ - "mode-base-server" - ], + "OTA_SOFTWARE_UPDATE_PROVIDER_CLUSTER": ["ota-provider"], + "OTA_SOFTWARE_UPDATE_REQUESTOR_CLUSTER": ["ota-requestor"], + "OVEN_MODE_CLUSTER": ["mode-base-server"], "OZONE_CONCENTRATION_MEASUREMENT_CLUSTER": [ "concentration-measurement-server" ], @@ -316,9 +252,7 @@ "POLL_CONTROL_CLUSTER": [], "POWER_CONFIG_CLUSTER": [], "POWER_PROFILE_CLUSTER": [], - "POWER_SOURCE_CLUSTER": [ - "power-source-server" - ], + "POWER_SOURCE_CLUSTER": ["power-source-server"], "POWER_SOURCE_CONFIGURATION_CLUSTER": [ "power-source-configuration-server" ], @@ -333,9 +267,7 @@ "RADON_CONCENTRATION_MEASUREMENT_CLUSTER": [ "concentration-measurement-server" ], - "REFRIGERATOR_ALARM_CLUSTER": [ - "refrigerator-alarm-server" - ], + "REFRIGERATOR_ALARM_CLUSTER": ["refrigerator-alarm-server"], "REFRIGERATOR_AND_TEMPERATURE_CONTROLLED_CABINET_MODE_CLUSTER": [ "mode-base-server" ], @@ -350,9 +282,7 @@ "TARGET_NAVIGATOR_CLUSTER": ["target-navigator-server"], "TEMPERATURE_CONTROL_CLUSTER": ["temperature-control-server"], "TEMPERATURE_MEASUREMENT_CLUSTER": [], - "THERMOSTAT_CLUSTER": [ - "thermostat-server" - ], + "THERMOSTAT_CLUSTER": ["thermostat-server"], "THERMOSTAT_USER_INTERFACE_CONFIGURATION_CLUSTER": [ "thermostat-user-interface-configuration-server" ], @@ -364,25 +294,15 @@ ], "THREAD_NETWORK_DIRECTORY_CLUSTER": ["thread-network-directory-server"], "TIME_CLUSTER": [], - "TIME_FORMAT_LOCALIZATION_CLUSTER": [ - "time-format-localization-server" - ], - "TIME_SYNCHRONIZATION_CLUSTER": [ - "time-synchronization-server" - ], - "TIMER_CLUSTER": [ - "timer-server" - ], + "TIME_FORMAT_LOCALIZATION_CLUSTER": ["time-format-localization-server"], + "TIME_SYNCHRONIZATION_CLUSTER": ["time-synchronization-server"], + "TIMER_CLUSTER": ["timer-server"], "TVOC_CONCENTRATION_MEASUREMENT_CLUSTER": [ "concentration-measurement-server" ], "UNIT_LOCALIZATION_CLUSTER": [], - "UNIT_TESTING_CLUSTER": [ - "test-cluster-server" - ], - "USER_LABEL_CLUSTER": [ - "user-label-server" - ], + "UNIT_TESTING_CLUSTER": ["test-cluster-server"], + "USER_LABEL_CLUSTER": ["user-label-server"], "VALVE_CONFIGURATION_AND_CONTROL_CLUSTER": [ "valve-configuration-and-control-server" ], From b611b2a3e416a1a191e4d5ceb75689130d551809 Mon Sep 17 00:00:00 2001 From: Mikhail Antropov Date: Fri, 28 Jun 2024 17:43:55 +0300 Subject: [PATCH 09/16] Do XML struct as in the adoc file --- data_model/1.3/clusters/EnergyCalendar.xml | 194 +++++++++--------- .../chip/energy-calendar-cluster.xml | 40 ++-- 2 files changed, 117 insertions(+), 117 deletions(-) diff --git a/data_model/1.3/clusters/EnergyCalendar.xml b/data_model/1.3/clusters/EnergyCalendar.xml index 75db315f49fcf0..ce4028ac6ba7e0 100644 --- a/data_model/1.3/clusters/EnergyCalendar.xml +++ b/data_model/1.3/clusters/EnergyCalendar.xml @@ -1,61 +1,61 @@ - @@ -82,20 +82,6 @@ Davis, CA 95616, USA - - - - - - - - - - - - - - @@ -145,35 +131,20 @@ Davis, CA 95616, USA - - - + + - - - - + + - - - - - - - - - - - - - + + - - - - - - + + + + + @@ -211,6 +182,35 @@ Davis, CA 95616, USA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml index c5219ccb625c43..9114f051424602 100644 --- a/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml @@ -13,14 +13,6 @@ limitations under the License. --> - - - - - - - - @@ -44,19 +36,13 @@ limitations under the License. - - - - - - - + - - - - - + + + + + @@ -74,6 +60,20 @@ limitations under the License. + + + + + + + + + + + + + + Energy Calendar Energy Management From c046238ec7b723178a5bcb6ce7e084501c7a0fa3 Mon Sep 17 00:00:00 2001 From: Mikhail Antropov Date: Sun, 21 Jul 2024 18:39:21 +0300 Subject: [PATCH 10/16] Add complex type Date and using it in DayStruct --- .../zcl/data-model/chip/chip-types.xml | 2 +- .../chip/energy-calendar-cluster.xml | 18 +- .../zcl/data-model/chip/global-structs.xml | 10 + .../data_model/controller-clusters.matter | 9 +- .../chip/devicecontroller/ChipStructs.java | 105 ++++- .../chip/devicecontroller/cluster/files.gni | 1 + .../EnergyCalendarClusterDateStruct.kt | 109 ++++++ .../structs/EnergyCalendarClusterDayStruct.kt | 8 +- .../java/matter/controller/cluster/files.gni | 1 + .../EnergyCalendarClusterDateStruct.kt | 109 ++++++ .../structs/EnergyCalendarClusterDayStruct.kt | 8 +- .../CHIPAttributeTLVValueDecoder.cpp | 360 ++++++++++++++++-- .../python/chip/clusters/Objects.py | 21 +- .../MTRAttributeTLVValueDecoder.mm | 88 ++++- .../CHIP/zap-generated/MTRStructsObjc.h | 10 +- .../CHIP/zap-generated/MTRStructsObjc.mm | 36 ++ .../app-common/zap-generated/attribute-type.h | 1 - .../zap-generated/cluster-objects.cpp | 51 +++ .../zap-generated/cluster-objects.h | 35 +- .../cluster/ComplexArgumentParser.cpp | 42 ++ .../cluster/ComplexArgumentParser.h | 4 + .../cluster/logging/DataModelLogger.cpp | 41 ++ .../cluster/logging/DataModelLogger.h | 3 + 23 files changed, 1013 insertions(+), 59 deletions(-) create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDateStruct.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDateStruct.kt diff --git a/src/app/zap-templates/zcl/data-model/chip/chip-types.xml b/src/app/zap-templates/zcl/data-model/chip/chip-types.xml index 77fcb4df6b4fe1..8ef7ced67251a9 100644 --- a/src/app/zap-templates/zcl/data-model/chip/chip-types.xml +++ b/src/app/zap-templates/zcl/data-model/chip/chip-types.xml @@ -64,7 +64,7 @@ limitations under the License. - + diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml index 9114f051424602..4223d37cf34cf8 100644 --- a/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml @@ -44,7 +44,7 @@ limitations under the License. - + @@ -52,7 +52,7 @@ limitations under the License. - + @@ -60,15 +60,15 @@ limitations under the License. - + - + - + @@ -84,16 +84,16 @@ limitations under the License. The Energy Calendar Cluster provides a mechanism for communicating schedules associated with various forms of energy consumption. - + - + - + - + diff --git a/src/app/zap-templates/zcl/data-model/chip/global-structs.xml b/src/app/zap-templates/zcl/data-model/chip/global-structs.xml index 743fdf366b724b..454a7380f78937 100644 --- a/src/app/zap-templates/zcl/data-model/chip/global-structs.xml +++ b/src/app/zap-templates/zcl/data-model/chip/global-structs.xml @@ -39,4 +39,14 @@ limitations under the License. + + + + + + + + + + diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 4d96357eff344e..c30a15331182de 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -5483,8 +5483,15 @@ cluster EnergyCalendar = 154 { optional AuxiliaryLoadBitmap auxiliaryLoad = 3; } + struct DateStruct { + nullable int8u year = 0; + nullable int8u month = 1; + nullable int8u day = 2; + nullable int8u dayOfWeek = 3; + } + struct DayStruct { - optional date date = 0; + optional DateStruct date = 0; optional TransitionDayOfWeekBitmap daysOfWeek = 1; TransitionStruct transitions[] = 2; optional int32u calendarID = 3; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index 4cbe6c8e2daeb1..1e4ef007396d3e 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -8850,8 +8850,99 @@ public String toString() { return output.toString(); } } +public static class EnergyCalendarClusterDateStruct { + public @Nullable Integer year; + public @Nullable Integer month; + public @Nullable Integer day; + public @Nullable Integer dayOfWeek; + private static final long YEAR_ID = 0L; + private static final long MONTH_ID = 1L; + private static final long DAY_ID = 2L; + private static final long DAY_OF_WEEK_ID = 3L; + + public EnergyCalendarClusterDateStruct( + @Nullable Integer year, + @Nullable Integer month, + @Nullable Integer day, + @Nullable Integer dayOfWeek + ) { + this.year = year; + this.month = month; + this.day = day; + this.dayOfWeek = dayOfWeek; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(YEAR_ID, year != null ? new UIntType(year) : new NullType())); + values.add(new StructElement(MONTH_ID, month != null ? new UIntType(month) : new NullType())); + values.add(new StructElement(DAY_ID, day != null ? new UIntType(day) : new NullType())); + values.add(new StructElement(DAY_OF_WEEK_ID, dayOfWeek != null ? new UIntType(dayOfWeek) : new NullType())); + + return new StructType(values); + } + + public static EnergyCalendarClusterDateStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + @Nullable Integer year = null; + @Nullable Integer month = null; + @Nullable Integer day = null; + @Nullable Integer dayOfWeek = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == YEAR_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + year = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == MONTH_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + month = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == DAY_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + day = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == DAY_OF_WEEK_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + dayOfWeek = castingValue.value(Integer.class); + } + } + } + return new EnergyCalendarClusterDateStruct( + year, + month, + day, + dayOfWeek + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("EnergyCalendarClusterDateStruct {\n"); + output.append("\tyear: "); + output.append(year); + output.append("\n"); + output.append("\tmonth: "); + output.append(month); + output.append("\n"); + output.append("\tday: "); + output.append(day); + output.append("\n"); + output.append("\tdayOfWeek: "); + output.append(dayOfWeek); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} public static class EnergyCalendarClusterDayStruct { - public Optional date; + public Optional date; public Optional daysOfWeek; public ArrayList transitions; public Optional calendarID; @@ -8861,7 +8952,7 @@ public static class EnergyCalendarClusterDayStruct { private static final long CALENDAR_I_D_ID = 3L; public EnergyCalendarClusterDayStruct( - Optional date, + Optional date, Optional daysOfWeek, ArrayList transitions, Optional calendarID @@ -8874,7 +8965,7 @@ public EnergyCalendarClusterDayStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(DATE_ID, date.map((nonOptionaldate) -> new UIntType(nonOptionaldate)).orElse(new EmptyType()))); + values.add(new StructElement(DATE_ID, date.map((nonOptionaldate) -> nonOptionaldate.encodeTlv()).orElse(new EmptyType()))); values.add(new StructElement(DAYS_OF_WEEK_ID, daysOfWeek.map((nonOptionaldaysOfWeek) -> new UIntType(nonOptionaldaysOfWeek)).orElse(new EmptyType()))); values.add(new StructElement(TRANSITIONS_ID, ArrayType.generateArrayType(transitions, (elementtransitions) -> elementtransitions.encodeTlv()))); values.add(new StructElement(CALENDAR_I_D_ID, calendarID.map((nonOptionalcalendarID) -> new UIntType(nonOptionalcalendarID)).orElse(new EmptyType()))); @@ -8886,15 +8977,15 @@ public static EnergyCalendarClusterDayStruct decodeTlv(BaseTLVType tlvValue) { if (tlvValue == null || tlvValue.type() != TLVType.Struct) { return null; } - Optional date = Optional.empty(); + Optional date = Optional.empty(); Optional daysOfWeek = Optional.empty(); ArrayList transitions = null; Optional calendarID = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { if (element.contextTagNum() == DATE_ID) { - if (element.value(BaseTLVType.class).type() == TLVType.UInt) { - UIntType castingValue = element.value(UIntType.class); - date = Optional.of(castingValue.value(Long.class)); + if (element.value(BaseTLVType.class).type() == TLVType.Struct) { + StructType castingValue = element.value(StructType.class); + date = Optional.of(ChipStructs.EnergyCalendarClusterDateStruct.decodeTlv(castingValue)); } } else if (element.contextTagNum() == DAYS_OF_WEEK_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni index cdb840b563f936..bac6e44d468801 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni @@ -72,6 +72,7 @@ structs_sources = [ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementAccuracyStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementRangeStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterCalendarPeriodStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDateStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterTransitionStruct.kt", diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDateStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDateStruct.kt new file mode 100644 index 00000000000000..98ddfc3fd2482f --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDateStruct.kt @@ -0,0 +1,109 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * 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. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class EnergyCalendarClusterDateStruct( + val year: UInt?, + val month: UInt?, + val day: UInt?, + val dayOfWeek: UInt?, +) { + override fun toString(): String = buildString { + append("EnergyCalendarClusterDateStruct {\n") + append("\tyear : $year\n") + append("\tmonth : $month\n") + append("\tday : $day\n") + append("\tdayOfWeek : $dayOfWeek\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (year != null) { + put(ContextSpecificTag(TAG_YEAR), year) + } else { + putNull(ContextSpecificTag(TAG_YEAR)) + } + if (month != null) { + put(ContextSpecificTag(TAG_MONTH), month) + } else { + putNull(ContextSpecificTag(TAG_MONTH)) + } + if (day != null) { + put(ContextSpecificTag(TAG_DAY), day) + } else { + putNull(ContextSpecificTag(TAG_DAY)) + } + if (dayOfWeek != null) { + put(ContextSpecificTag(TAG_DAY_OF_WEEK), dayOfWeek) + } else { + putNull(ContextSpecificTag(TAG_DAY_OF_WEEK)) + } + endStructure() + } + } + + companion object { + private const val TAG_YEAR = 0 + private const val TAG_MONTH = 1 + private const val TAG_DAY = 2 + private const val TAG_DAY_OF_WEEK = 3 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyCalendarClusterDateStruct { + tlvReader.enterStructure(tlvTag) + val year = + if (!tlvReader.isNull()) { + tlvReader.getUInt(ContextSpecificTag(TAG_YEAR)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_YEAR)) + null + } + val month = + if (!tlvReader.isNull()) { + tlvReader.getUInt(ContextSpecificTag(TAG_MONTH)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_MONTH)) + null + } + val day = + if (!tlvReader.isNull()) { + tlvReader.getUInt(ContextSpecificTag(TAG_DAY)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_DAY)) + null + } + val dayOfWeek = + if (!tlvReader.isNull()) { + tlvReader.getUInt(ContextSpecificTag(TAG_DAY_OF_WEEK)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_DAY_OF_WEEK)) + null + } + + tlvReader.exitContainer() + + return EnergyCalendarClusterDateStruct(year, month, day, dayOfWeek) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt index 0520e76669c8ea..bf883bb287b1f8 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt @@ -25,7 +25,7 @@ import matter.tlv.TlvReader import matter.tlv.TlvWriter class EnergyCalendarClusterDayStruct( - val date: Optional, + val date: Optional, val daysOfWeek: Optional, val transitions: List, val calendarID: Optional, @@ -44,7 +44,7 @@ class EnergyCalendarClusterDayStruct( startStructure(tlvTag) if (date.isPresent) { val optdate = date.get() - put(ContextSpecificTag(TAG_DATE), optdate) + optdate.toTlv(ContextSpecificTag(TAG_DATE), this) } if (daysOfWeek.isPresent) { val optdaysOfWeek = daysOfWeek.get() @@ -73,7 +73,9 @@ class EnergyCalendarClusterDayStruct( tlvReader.enterStructure(tlvTag) val date = if (tlvReader.isNextTag(ContextSpecificTag(TAG_DATE))) { - Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_DATE))) + Optional.of( + EnergyCalendarClusterDateStruct.fromTlv(ContextSpecificTag(TAG_DATE), tlvReader) + ) } else { Optional.empty() } diff --git a/src/controller/java/generated/java/matter/controller/cluster/files.gni b/src/controller/java/generated/java/matter/controller/cluster/files.gni index 3e99c3837fa529..9f794491c9e97f 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/files.gni +++ b/src/controller/java/generated/java/matter/controller/cluster/files.gni @@ -72,6 +72,7 @@ matter_structs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementAccuracyStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementRangeStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterCalendarPeriodStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDateStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterTransitionStruct.kt", diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDateStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDateStruct.kt new file mode 100644 index 00000000000000..128428ee076f86 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDateStruct.kt @@ -0,0 +1,109 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * 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. + */ +package matter.controller.cluster.structs + +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class EnergyCalendarClusterDateStruct( + val year: UByte?, + val month: UByte?, + val day: UByte?, + val dayOfWeek: UByte?, +) { + override fun toString(): String = buildString { + append("EnergyCalendarClusterDateStruct {\n") + append("\tyear : $year\n") + append("\tmonth : $month\n") + append("\tday : $day\n") + append("\tdayOfWeek : $dayOfWeek\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (year != null) { + put(ContextSpecificTag(TAG_YEAR), year) + } else { + putNull(ContextSpecificTag(TAG_YEAR)) + } + if (month != null) { + put(ContextSpecificTag(TAG_MONTH), month) + } else { + putNull(ContextSpecificTag(TAG_MONTH)) + } + if (day != null) { + put(ContextSpecificTag(TAG_DAY), day) + } else { + putNull(ContextSpecificTag(TAG_DAY)) + } + if (dayOfWeek != null) { + put(ContextSpecificTag(TAG_DAY_OF_WEEK), dayOfWeek) + } else { + putNull(ContextSpecificTag(TAG_DAY_OF_WEEK)) + } + endStructure() + } + } + + companion object { + private const val TAG_YEAR = 0 + private const val TAG_MONTH = 1 + private const val TAG_DAY = 2 + private const val TAG_DAY_OF_WEEK = 3 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyCalendarClusterDateStruct { + tlvReader.enterStructure(tlvTag) + val year = + if (!tlvReader.isNull()) { + tlvReader.getUByte(ContextSpecificTag(TAG_YEAR)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_YEAR)) + null + } + val month = + if (!tlvReader.isNull()) { + tlvReader.getUByte(ContextSpecificTag(TAG_MONTH)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_MONTH)) + null + } + val day = + if (!tlvReader.isNull()) { + tlvReader.getUByte(ContextSpecificTag(TAG_DAY)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_DAY)) + null + } + val dayOfWeek = + if (!tlvReader.isNull()) { + tlvReader.getUByte(ContextSpecificTag(TAG_DAY_OF_WEEK)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_DAY_OF_WEEK)) + null + } + + tlvReader.exitContainer() + + return EnergyCalendarClusterDateStruct(year, month, day, dayOfWeek) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt index a45936a14060d9..e5dd66bb585107 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt @@ -25,7 +25,7 @@ import matter.tlv.TlvReader import matter.tlv.TlvWriter class EnergyCalendarClusterDayStruct( - val date: Optional, + val date: Optional, val daysOfWeek: Optional, val transitions: List, val calendarID: Optional, @@ -44,7 +44,7 @@ class EnergyCalendarClusterDayStruct( startStructure(tlvTag) if (date.isPresent) { val optdate = date.get() - put(ContextSpecificTag(TAG_DATE), optdate) + optdate.toTlv(ContextSpecificTag(TAG_DATE), this) } if (daysOfWeek.isPresent) { val optdaysOfWeek = daysOfWeek.get() @@ -73,7 +73,9 @@ class EnergyCalendarClusterDayStruct( tlvReader.enterStructure(tlvTag) val date = if (tlvReader.isNextTag(ContextSpecificTag(TAG_DATE))) { - Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_DATE))) + Optional.of( + EnergyCalendarClusterDateStruct.fromTlv(ContextSpecificTag(TAG_DATE), tlvReader) + ) } else { Optional.empty() } diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index 5aa0af60b4a9bb..e99bb80e56205b 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -25120,13 +25120,93 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR else { jobject newElement_3_dateInsideOptional; - std::string newElement_3_dateInsideOptionalClassName = "java/lang/Long"; - std::string newElement_3_dateInsideOptionalCtorSignature = "(J)V"; - jlong jninewElement_3_dateInsideOptional = static_cast(entry_3.date.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_3_dateInsideOptionalClassName.c_str(), - newElement_3_dateInsideOptionalCtorSignature.c_str(), jninewElement_3_dateInsideOptional, - newElement_3_dateInsideOptional); + jobject newElement_3_dateInsideOptional_year; + if (entry_3.date.Value().year.IsNull()) + { + newElement_3_dateInsideOptional_year = nullptr; + } + else + { + std::string newElement_3_dateInsideOptional_yearClassName = "java/lang/Integer"; + std::string newElement_3_dateInsideOptional_yearCtorSignature = "(I)V"; + jint jninewElement_3_dateInsideOptional_year = static_cast(entry_3.date.Value().year.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_3_dateInsideOptional_yearClassName.c_str(), + newElement_3_dateInsideOptional_yearCtorSignature.c_str(), + jninewElement_3_dateInsideOptional_year, newElement_3_dateInsideOptional_year); + } + jobject newElement_3_dateInsideOptional_month; + if (entry_3.date.Value().month.IsNull()) + { + newElement_3_dateInsideOptional_month = nullptr; + } + else + { + std::string newElement_3_dateInsideOptional_monthClassName = "java/lang/Integer"; + std::string newElement_3_dateInsideOptional_monthCtorSignature = "(I)V"; + jint jninewElement_3_dateInsideOptional_month = + static_cast(entry_3.date.Value().month.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_3_dateInsideOptional_monthClassName.c_str(), + newElement_3_dateInsideOptional_monthCtorSignature.c_str(), + jninewElement_3_dateInsideOptional_month, newElement_3_dateInsideOptional_month); + } + jobject newElement_3_dateInsideOptional_day; + if (entry_3.date.Value().day.IsNull()) + { + newElement_3_dateInsideOptional_day = nullptr; + } + else + { + std::string newElement_3_dateInsideOptional_dayClassName = "java/lang/Integer"; + std::string newElement_3_dateInsideOptional_dayCtorSignature = "(I)V"; + jint jninewElement_3_dateInsideOptional_day = static_cast(entry_3.date.Value().day.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_3_dateInsideOptional_dayClassName.c_str(), + newElement_3_dateInsideOptional_dayCtorSignature.c_str(), + jninewElement_3_dateInsideOptional_day, newElement_3_dateInsideOptional_day); + } + jobject newElement_3_dateInsideOptional_dayOfWeek; + if (entry_3.date.Value().dayOfWeek.IsNull()) + { + newElement_3_dateInsideOptional_dayOfWeek = nullptr; + } + else + { + std::string newElement_3_dateInsideOptional_dayOfWeekClassName = "java/lang/Integer"; + std::string newElement_3_dateInsideOptional_dayOfWeekCtorSignature = "(I)V"; + jint jninewElement_3_dateInsideOptional_dayOfWeek = + static_cast(entry_3.date.Value().dayOfWeek.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_3_dateInsideOptional_dayOfWeekClassName.c_str(), + newElement_3_dateInsideOptional_dayOfWeekCtorSignature.c_str(), + jninewElement_3_dateInsideOptional_dayOfWeek, newElement_3_dateInsideOptional_dayOfWeek); + } + + jclass dateStructStructClass_6; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterDateStruct", dateStructStructClass_6); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterDateStruct"); + return nullptr; + } + + jmethodID dateStructStructCtor_6; + err = chip::JniReferences::GetInstance().FindMethod( + env, dateStructStructClass_6, "", + "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V", + &dateStructStructCtor_6); + if (err != CHIP_NO_ERROR || dateStructStructCtor_6 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterDateStruct constructor"); + return nullptr; + } + + newElement_3_dateInsideOptional = + env->NewObject(dateStructStructClass_6, dateStructStructCtor_6, + newElement_3_dateInsideOptional_year, newElement_3_dateInsideOptional_month, + newElement_3_dateInsideOptional_day, newElement_3_dateInsideOptional_dayOfWeek); chip::JniReferences::GetInstance().CreateOptional(newElement_3_dateInsideOptional, newElement_3_date); } jobject newElement_3_daysOfWeek; @@ -25346,12 +25426,92 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR else { jobject newElement_1_dateInsideOptional; - std::string newElement_1_dateInsideOptionalClassName = "java/lang/Long"; - std::string newElement_1_dateInsideOptionalCtorSignature = "(J)V"; - jlong jninewElement_1_dateInsideOptional = static_cast(entry_1.date.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_1_dateInsideOptionalClassName.c_str(), newElement_1_dateInsideOptionalCtorSignature.c_str(), - jninewElement_1_dateInsideOptional, newElement_1_dateInsideOptional); + jobject newElement_1_dateInsideOptional_year; + if (entry_1.date.Value().year.IsNull()) + { + newElement_1_dateInsideOptional_year = nullptr; + } + else + { + std::string newElement_1_dateInsideOptional_yearClassName = "java/lang/Integer"; + std::string newElement_1_dateInsideOptional_yearCtorSignature = "(I)V"; + jint jninewElement_1_dateInsideOptional_year = static_cast(entry_1.date.Value().year.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_1_dateInsideOptional_yearClassName.c_str(), + newElement_1_dateInsideOptional_yearCtorSignature.c_str(), jninewElement_1_dateInsideOptional_year, + newElement_1_dateInsideOptional_year); + } + jobject newElement_1_dateInsideOptional_month; + if (entry_1.date.Value().month.IsNull()) + { + newElement_1_dateInsideOptional_month = nullptr; + } + else + { + std::string newElement_1_dateInsideOptional_monthClassName = "java/lang/Integer"; + std::string newElement_1_dateInsideOptional_monthCtorSignature = "(I)V"; + jint jninewElement_1_dateInsideOptional_month = static_cast(entry_1.date.Value().month.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_1_dateInsideOptional_monthClassName.c_str(), + newElement_1_dateInsideOptional_monthCtorSignature.c_str(), + jninewElement_1_dateInsideOptional_month, newElement_1_dateInsideOptional_month); + } + jobject newElement_1_dateInsideOptional_day; + if (entry_1.date.Value().day.IsNull()) + { + newElement_1_dateInsideOptional_day = nullptr; + } + else + { + std::string newElement_1_dateInsideOptional_dayClassName = "java/lang/Integer"; + std::string newElement_1_dateInsideOptional_dayCtorSignature = "(I)V"; + jint jninewElement_1_dateInsideOptional_day = static_cast(entry_1.date.Value().day.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_1_dateInsideOptional_dayClassName.c_str(), + newElement_1_dateInsideOptional_dayCtorSignature.c_str(), jninewElement_1_dateInsideOptional_day, + newElement_1_dateInsideOptional_day); + } + jobject newElement_1_dateInsideOptional_dayOfWeek; + if (entry_1.date.Value().dayOfWeek.IsNull()) + { + newElement_1_dateInsideOptional_dayOfWeek = nullptr; + } + else + { + std::string newElement_1_dateInsideOptional_dayOfWeekClassName = "java/lang/Integer"; + std::string newElement_1_dateInsideOptional_dayOfWeekCtorSignature = "(I)V"; + jint jninewElement_1_dateInsideOptional_dayOfWeek = + static_cast(entry_1.date.Value().dayOfWeek.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_1_dateInsideOptional_dayOfWeekClassName.c_str(), + newElement_1_dateInsideOptional_dayOfWeekCtorSignature.c_str(), + jninewElement_1_dateInsideOptional_dayOfWeek, newElement_1_dateInsideOptional_dayOfWeek); + } + + jclass dateStructStructClass_4; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterDateStruct", dateStructStructClass_4); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterDateStruct"); + return nullptr; + } + + jmethodID dateStructStructCtor_4; + err = chip::JniReferences::GetInstance().FindMethod( + env, dateStructStructClass_4, "", + "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V", + &dateStructStructCtor_4); + if (err != CHIP_NO_ERROR || dateStructStructCtor_4 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterDateStruct constructor"); + return nullptr; + } + + newElement_1_dateInsideOptional = + env->NewObject(dateStructStructClass_4, dateStructStructCtor_4, newElement_1_dateInsideOptional_year, + newElement_1_dateInsideOptional_month, newElement_1_dateInsideOptional_day, + newElement_1_dateInsideOptional_dayOfWeek); chip::JniReferences::GetInstance().CreateOptional(newElement_1_dateInsideOptional, newElement_1_date); } jobject newElement_1_daysOfWeek; @@ -25539,12 +25699,87 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR else { jobject value_dateInsideOptional; - std::string value_dateInsideOptionalClassName = "java/lang/Long"; - std::string value_dateInsideOptionalCtorSignature = "(J)V"; - jlong jnivalue_dateInsideOptional = static_cast(cppValue.Value().date.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptionalClassName.c_str(), value_dateInsideOptionalCtorSignature.c_str(), - jnivalue_dateInsideOptional, value_dateInsideOptional); + jobject value_dateInsideOptional_year; + if (cppValue.Value().date.Value().year.IsNull()) + { + value_dateInsideOptional_year = nullptr; + } + else + { + std::string value_dateInsideOptional_yearClassName = "java/lang/Integer"; + std::string value_dateInsideOptional_yearCtorSignature = "(I)V"; + jint jnivalue_dateInsideOptional_year = static_cast(cppValue.Value().date.Value().year.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dateInsideOptional_yearClassName.c_str(), value_dateInsideOptional_yearCtorSignature.c_str(), + jnivalue_dateInsideOptional_year, value_dateInsideOptional_year); + } + jobject value_dateInsideOptional_month; + if (cppValue.Value().date.Value().month.IsNull()) + { + value_dateInsideOptional_month = nullptr; + } + else + { + std::string value_dateInsideOptional_monthClassName = "java/lang/Integer"; + std::string value_dateInsideOptional_monthCtorSignature = "(I)V"; + jint jnivalue_dateInsideOptional_month = static_cast(cppValue.Value().date.Value().month.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dateInsideOptional_monthClassName.c_str(), value_dateInsideOptional_monthCtorSignature.c_str(), + jnivalue_dateInsideOptional_month, value_dateInsideOptional_month); + } + jobject value_dateInsideOptional_day; + if (cppValue.Value().date.Value().day.IsNull()) + { + value_dateInsideOptional_day = nullptr; + } + else + { + std::string value_dateInsideOptional_dayClassName = "java/lang/Integer"; + std::string value_dateInsideOptional_dayCtorSignature = "(I)V"; + jint jnivalue_dateInsideOptional_day = static_cast(cppValue.Value().date.Value().day.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dateInsideOptional_dayClassName.c_str(), value_dateInsideOptional_dayCtorSignature.c_str(), + jnivalue_dateInsideOptional_day, value_dateInsideOptional_day); + } + jobject value_dateInsideOptional_dayOfWeek; + if (cppValue.Value().date.Value().dayOfWeek.IsNull()) + { + value_dateInsideOptional_dayOfWeek = nullptr; + } + else + { + std::string value_dateInsideOptional_dayOfWeekClassName = "java/lang/Integer"; + std::string value_dateInsideOptional_dayOfWeekCtorSignature = "(I)V"; + jint jnivalue_dateInsideOptional_dayOfWeek = + static_cast(cppValue.Value().date.Value().dayOfWeek.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dateInsideOptional_dayOfWeekClassName.c_str(), + value_dateInsideOptional_dayOfWeekCtorSignature.c_str(), jnivalue_dateInsideOptional_dayOfWeek, + value_dateInsideOptional_dayOfWeek); + } + + jclass dateStructStructClass_3; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterDateStruct", dateStructStructClass_3); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterDateStruct"); + return nullptr; + } + + jmethodID dateStructStructCtor_3; + err = chip::JniReferences::GetInstance().FindMethod( + env, dateStructStructClass_3, "", + "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V", &dateStructStructCtor_3); + if (err != CHIP_NO_ERROR || dateStructStructCtor_3 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterDateStruct constructor"); + return nullptr; + } + + value_dateInsideOptional = env->NewObject(dateStructStructClass_3, dateStructStructCtor_3, + value_dateInsideOptional_year, value_dateInsideOptional_month, + value_dateInsideOptional_day, value_dateInsideOptional_dayOfWeek); chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional, value_date); } jobject value_daysOfWeek; @@ -25724,12 +25959,87 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR else { jobject value_dateInsideOptional; - std::string value_dateInsideOptionalClassName = "java/lang/Long"; - std::string value_dateInsideOptionalCtorSignature = "(J)V"; - jlong jnivalue_dateInsideOptional = static_cast(cppValue.Value().date.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptionalClassName.c_str(), value_dateInsideOptionalCtorSignature.c_str(), - jnivalue_dateInsideOptional, value_dateInsideOptional); + jobject value_dateInsideOptional_year; + if (cppValue.Value().date.Value().year.IsNull()) + { + value_dateInsideOptional_year = nullptr; + } + else + { + std::string value_dateInsideOptional_yearClassName = "java/lang/Integer"; + std::string value_dateInsideOptional_yearCtorSignature = "(I)V"; + jint jnivalue_dateInsideOptional_year = static_cast(cppValue.Value().date.Value().year.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dateInsideOptional_yearClassName.c_str(), value_dateInsideOptional_yearCtorSignature.c_str(), + jnivalue_dateInsideOptional_year, value_dateInsideOptional_year); + } + jobject value_dateInsideOptional_month; + if (cppValue.Value().date.Value().month.IsNull()) + { + value_dateInsideOptional_month = nullptr; + } + else + { + std::string value_dateInsideOptional_monthClassName = "java/lang/Integer"; + std::string value_dateInsideOptional_monthCtorSignature = "(I)V"; + jint jnivalue_dateInsideOptional_month = static_cast(cppValue.Value().date.Value().month.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dateInsideOptional_monthClassName.c_str(), value_dateInsideOptional_monthCtorSignature.c_str(), + jnivalue_dateInsideOptional_month, value_dateInsideOptional_month); + } + jobject value_dateInsideOptional_day; + if (cppValue.Value().date.Value().day.IsNull()) + { + value_dateInsideOptional_day = nullptr; + } + else + { + std::string value_dateInsideOptional_dayClassName = "java/lang/Integer"; + std::string value_dateInsideOptional_dayCtorSignature = "(I)V"; + jint jnivalue_dateInsideOptional_day = static_cast(cppValue.Value().date.Value().day.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dateInsideOptional_dayClassName.c_str(), value_dateInsideOptional_dayCtorSignature.c_str(), + jnivalue_dateInsideOptional_day, value_dateInsideOptional_day); + } + jobject value_dateInsideOptional_dayOfWeek; + if (cppValue.Value().date.Value().dayOfWeek.IsNull()) + { + value_dateInsideOptional_dayOfWeek = nullptr; + } + else + { + std::string value_dateInsideOptional_dayOfWeekClassName = "java/lang/Integer"; + std::string value_dateInsideOptional_dayOfWeekCtorSignature = "(I)V"; + jint jnivalue_dateInsideOptional_dayOfWeek = + static_cast(cppValue.Value().date.Value().dayOfWeek.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dateInsideOptional_dayOfWeekClassName.c_str(), + value_dateInsideOptional_dayOfWeekCtorSignature.c_str(), jnivalue_dateInsideOptional_dayOfWeek, + value_dateInsideOptional_dayOfWeek); + } + + jclass dateStructStructClass_3; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterDateStruct", dateStructStructClass_3); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterDateStruct"); + return nullptr; + } + + jmethodID dateStructStructCtor_3; + err = chip::JniReferences::GetInstance().FindMethod( + env, dateStructStructClass_3, "", + "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V", &dateStructStructCtor_3); + if (err != CHIP_NO_ERROR || dateStructStructCtor_3 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterDateStruct constructor"); + return nullptr; + } + + value_dateInsideOptional = env->NewObject(dateStructStructClass_3, dateStructStructCtor_3, + value_dateInsideOptional_year, value_dateInsideOptional_month, + value_dateInsideOptional_day, value_dateInsideOptional_dayOfWeek); chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional, value_date); } jobject value_daysOfWeek; diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 9c2aca3786b8d2..fd5adcbb530e1e 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -26672,19 +26672,36 @@ def descriptor(cls) -> ClusterObjectDescriptor: friendlyCredit: 'typing.Optional[bool]' = None auxiliaryLoad: 'typing.Optional[uint]' = None + @dataclass + class DateStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="year", Tag=0, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="month", Tag=1, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="day", Tag=2, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="dayOfWeek", Tag=3, Type=typing.Union[Nullable, uint]), + ]) + + year: 'typing.Union[Nullable, uint]' = NullValue + month: 'typing.Union[Nullable, uint]' = NullValue + day: 'typing.Union[Nullable, uint]' = NullValue + dayOfWeek: 'typing.Union[Nullable, uint]' = NullValue + @dataclass class DayStruct(ClusterObject): @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="date", Tag=0, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="date", Tag=0, Type=typing.Optional[EnergyCalendar.Structs.DateStruct]), ClusterObjectFieldDescriptor(Label="daysOfWeek", Tag=1, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="transitions", Tag=2, Type=typing.List[EnergyCalendar.Structs.TransitionStruct]), ClusterObjectFieldDescriptor(Label="calendarID", Tag=3, Type=typing.Optional[uint]), ]) - date: 'typing.Optional[uint]' = None + date: 'typing.Optional[EnergyCalendar.Structs.DateStruct]' = None daysOfWeek: 'typing.Optional[uint]' = None transitions: 'typing.List[EnergyCalendar.Structs.TransitionStruct]' = field(default_factory=lambda: []) calendarID: 'typing.Optional[uint]' = None diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index 207d6edd3d0ae7..7dc832b0fb5776 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -9635,7 +9635,27 @@ static id _Nullable DecodeAttributeValueForEnergyCalendarCluster(AttributeId aAt MTREnergyCalendarClusterDayStruct * newElement_3; newElement_3 = [MTREnergyCalendarClusterDayStruct new]; if (entry_3.date.HasValue()) { - newElement_3.date = [NSNumber numberWithUnsignedInt:entry_3.date.Value()]; + newElement_3.date = [MTREnergyCalendarClusterDateStruct new]; + if (entry_3.date.Value().year.IsNull()) { + newElement_3.date.year = nil; + } else { + newElement_3.date.year = [NSNumber numberWithUnsignedChar:entry_3.date.Value().year.Value()]; + } + if (entry_3.date.Value().month.IsNull()) { + newElement_3.date.month = nil; + } else { + newElement_3.date.month = [NSNumber numberWithUnsignedChar:entry_3.date.Value().month.Value()]; + } + if (entry_3.date.Value().day.IsNull()) { + newElement_3.date.day = nil; + } else { + newElement_3.date.day = [NSNumber numberWithUnsignedChar:entry_3.date.Value().day.Value()]; + } + if (entry_3.date.Value().dayOfWeek.IsNull()) { + newElement_3.date.dayOfWeek = nil; + } else { + newElement_3.date.dayOfWeek = [NSNumber numberWithUnsignedChar:entry_3.date.Value().dayOfWeek.Value()]; + } } else { newElement_3.date = nil; } @@ -9721,7 +9741,27 @@ static id _Nullable DecodeAttributeValueForEnergyCalendarCluster(AttributeId aAt MTREnergyCalendarClusterDayStruct * newElement_1; newElement_1 = [MTREnergyCalendarClusterDayStruct new]; if (entry_1.date.HasValue()) { - newElement_1.date = [NSNumber numberWithUnsignedInt:entry_1.date.Value()]; + newElement_1.date = [MTREnergyCalendarClusterDateStruct new]; + if (entry_1.date.Value().year.IsNull()) { + newElement_1.date.year = nil; + } else { + newElement_1.date.year = [NSNumber numberWithUnsignedChar:entry_1.date.Value().year.Value()]; + } + if (entry_1.date.Value().month.IsNull()) { + newElement_1.date.month = nil; + } else { + newElement_1.date.month = [NSNumber numberWithUnsignedChar:entry_1.date.Value().month.Value()]; + } + if (entry_1.date.Value().day.IsNull()) { + newElement_1.date.day = nil; + } else { + newElement_1.date.day = [NSNumber numberWithUnsignedChar:entry_1.date.Value().day.Value()]; + } + if (entry_1.date.Value().dayOfWeek.IsNull()) { + newElement_1.date.dayOfWeek = nil; + } else { + newElement_1.date.dayOfWeek = [NSNumber numberWithUnsignedChar:entry_1.date.Value().dayOfWeek.Value()]; + } } else { newElement_1.date = nil; } @@ -9792,7 +9832,27 @@ static id _Nullable DecodeAttributeValueForEnergyCalendarCluster(AttributeId aAt } else { value = [MTREnergyCalendarClusterDayStruct new]; if (cppValue.Value().date.HasValue()) { - value.date = [NSNumber numberWithUnsignedInt:cppValue.Value().date.Value()]; + value.date = [MTREnergyCalendarClusterDateStruct new]; + if (cppValue.Value().date.Value().year.IsNull()) { + value.date.year = nil; + } else { + value.date.year = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().year.Value()]; + } + if (cppValue.Value().date.Value().month.IsNull()) { + value.date.month = nil; + } else { + value.date.month = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().month.Value()]; + } + if (cppValue.Value().date.Value().day.IsNull()) { + value.date.day = nil; + } else { + value.date.day = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().day.Value()]; + } + if (cppValue.Value().date.Value().dayOfWeek.IsNull()) { + value.date.dayOfWeek = nil; + } else { + value.date.dayOfWeek = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().dayOfWeek.Value()]; + } } else { value.date = nil; } @@ -9854,7 +9914,27 @@ static id _Nullable DecodeAttributeValueForEnergyCalendarCluster(AttributeId aAt } else { value = [MTREnergyCalendarClusterDayStruct new]; if (cppValue.Value().date.HasValue()) { - value.date = [NSNumber numberWithUnsignedInt:cppValue.Value().date.Value()]; + value.date = [MTREnergyCalendarClusterDateStruct new]; + if (cppValue.Value().date.Value().year.IsNull()) { + value.date.year = nil; + } else { + value.date.year = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().year.Value()]; + } + if (cppValue.Value().date.Value().month.IsNull()) { + value.date.month = nil; + } else { + value.date.month = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().month.Value()]; + } + if (cppValue.Value().date.Value().day.IsNull()) { + value.date.day = nil; + } else { + value.date.day = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().day.Value()]; + } + if (cppValue.Value().date.Value().dayOfWeek.IsNull()) { + value.date.dayOfWeek = nil; + } else { + value.date.dayOfWeek = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().dayOfWeek.Value()]; + } } else { value.date = nil; } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index 9b3e921582549d..a8fb18709f7208 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -1516,9 +1516,17 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy) NSNumber * _Nullable auxiliaryLoad MTR_PROVISIONALLY_AVAILABLE; @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTREnergyCalendarClusterDateStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nullable year MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable month MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable day MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable dayOfWeek MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_PROVISIONALLY_AVAILABLE @interface MTREnergyCalendarClusterDayStruct : NSObject -@property (nonatomic, copy) NSNumber * _Nullable date MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) MTREnergyCalendarClusterDateStruct * _Nullable date MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nullable daysOfWeek MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSArray * _Nonnull transitions MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nullable calendarID MTR_PROVISIONALLY_AVAILABLE; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index 8a1a54c6113a12..5bf96c9052cf12 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -6301,6 +6301,42 @@ - (NSString *)description @end +@implementation MTREnergyCalendarClusterDateStruct +- (instancetype)init +{ + if (self = [super init]) { + + _year = nil; + + _month = nil; + + _day = nil; + + _dayOfWeek = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTREnergyCalendarClusterDateStruct alloc] init]; + + other.year = self.year; + other.month = self.month; + other.day = self.day; + other.dayOfWeek = self.dayOfWeek; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: year:%@; month:%@; day:%@; dayOfWeek:%@; >", NSStringFromClass([self class]), _year, _month, _day, _dayOfWeek]; + return descriptionString; +} + +@end + @implementation MTREnergyCalendarClusterDayStruct - (instancetype)init { diff --git a/zzz_generated/app-common/app-common/zap-generated/attribute-type.h b/zzz_generated/app-common/app-common/zap-generated/attribute-type.h index ae493673fc03f2..d70efb382d9acf 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attribute-type.h +++ b/zzz_generated/app-common/app-common/zap-generated/attribute-type.h @@ -80,7 +80,6 @@ enum ZCL_VOLTAGE_MV_ATTRIBUTE_TYPE = 0xDB, // Voltage millivolts ZCL_ENERGY_MWH_ATTRIBUTE_TYPE = 0xDC, // Energy milliwatt-hours ZCL_TOD_ATTRIBUTE_TYPE = 0xE0, // Time of day - ZCL_DATE_ATTRIBUTE_TYPE = 0xE1, // Date ZCL_EPOCH_US_ATTRIBUTE_TYPE = 0xE3, // Epoch Microseconds ZCL_EPOCH_S_ATTRIBUTE_TYPE = 0xE4, // Epoch Seconds ZCL_POSIX_MS_ATTRIBUTE_TYPE = 0xE5, // Posix Time Milliseconds diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp index b1205acd619430..bcfa98501ef05d 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp @@ -335,6 +335,57 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } // namespace DeviceTypeStruct +namespace DateStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kYear), year); + encoder.Encode(to_underlying(Fields::kMonth), month); + encoder.Encode(to_underlying(Fields::kDay), day); + encoder.Encode(to_underlying(Fields::kDayOfWeek), dayOfWeek); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kYear)) + { + err = DataModel::Decode(reader, year); + } + else if (__context_tag == to_underlying(Fields::kMonth)) + { + err = DataModel::Decode(reader, month); + } + else if (__context_tag == to_underlying(Fields::kDay)) + { + err = DataModel::Decode(reader, day); + } + else if (__context_tag == to_underlying(Fields::kDayOfWeek)) + { + err = DataModel::Decode(reader, dayOfWeek); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace DateStruct + namespace ApplicationStruct { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { 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 559603845ae133..a26a7738086983 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 @@ -173,6 +173,7 @@ struct DecodableType }; } // namespace MeasurementAccuracyStruct + namespace DeviceTypeStruct { enum class Fields : uint8_t { @@ -196,6 +197,35 @@ struct Type using DecodableType = Type; } // namespace DeviceTypeStruct + +namespace DateStruct { +enum class Fields : uint8_t +{ + kYear = 0, + kMonth = 1, + kDay = 2, + kDayOfWeek = 3, +}; + +struct Type +{ +public: + DataModel::Nullable year; + DataModel::Nullable month; + DataModel::Nullable day; + DataModel::Nullable dayOfWeek; + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace DateStruct + namespace ApplicationStruct { enum class Fields : uint8_t { @@ -24350,6 +24380,7 @@ struct Type using DecodableType = Type; } // namespace TransitionStruct +namespace DateStruct = Clusters::detail::Structs::DateStruct; namespace DayStruct { enum class Fields : uint8_t { @@ -24362,7 +24393,7 @@ enum class Fields : uint8_t struct Type { public: - Optional date; + Optional date; Optional> daysOfWeek; DataModel::List transitions; Optional calendarID; @@ -24375,7 +24406,7 @@ struct Type struct DecodableType { public: - Optional date; + Optional date; Optional> daysOfWeek; DataModel::DecodableList transitions; Optional calendarID; diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index 91489bfd7fee76..b2197a26196aae 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -327,6 +327,48 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::detail::Structs::Devic ComplexArgumentParser::Finalize(request.revision); } +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::detail::Structs::DateStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("DateStruct.year", "year", value.isMember("year"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("DateStruct.month", "month", value.isMember("month"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("DateStruct.day", "day", value.isMember("day"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("DateStruct.dayOfWeek", "dayOfWeek", value.isMember("dayOfWeek"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "year"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.year, value["year"])); + valueCopy.removeMember("year"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "month"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.month, value["month"])); + valueCopy.removeMember("month"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "day"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.day, value["day"])); + valueCopy.removeMember("day"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "dayOfWeek"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.dayOfWeek, value["dayOfWeek"])); + valueCopy.removeMember("dayOfWeek"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::detail::Structs::DateStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.year); + ComplexArgumentParser::Finalize(request.month); + ComplexArgumentParser::Finalize(request.day); + ComplexArgumentParser::Finalize(request.dayOfWeek); +} + CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::detail::Structs::ApplicationStruct::Type & request, Json::Value & value) { diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h index 4d05bb09f58db8..f4cc3f6e33ef8a 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h @@ -57,6 +57,10 @@ static CHIP_ERROR Setup(const char * label, chip::app::Clusters::detail::Structs static void Finalize(chip::app::Clusters::detail::Structs::DeviceTypeStruct::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::detail::Structs::DateStruct::Type & request, Json::Value & value); + +static void Finalize(chip::app::Clusters::detail::Structs::DateStruct::Type & request); + static CHIP_ERROR Setup(const char * label, chip::app::Clusters::detail::Structs::ApplicationStruct::Type & request, Json::Value & value); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index 964583dea1310c..71c44431798382 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -290,6 +290,47 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::detail::Structs::DateStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("Year", indent + 1, value.year); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Year'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Month", indent + 1, value.month); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Month'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Day", indent + 1, value.day); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Day'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("DayOfWeek", indent + 1, value.dayOfWeek); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'DayOfWeek'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::detail::Structs::ApplicationStruct::DecodableType & value) { diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h index 5072bfb4e4d843..5a5eaa9f211ad1 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h @@ -41,6 +41,9 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::detail::Structs::DeviceTypeStruct::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::detail::Structs::DateStruct::DecodableType & value); + static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::detail::Structs::ApplicationStruct::DecodableType & value); From 7fa98d06cef72ca7bb0a5b43c4e4f7d35a6288ff Mon Sep 17 00:00:00 2001 From: Mikhail Antropov Date: Mon, 22 Jul 2024 08:00:39 +0300 Subject: [PATCH 11/16] Remove Date type from TestCodegenModelViaMocks.cpp --- .../tests/TestCodegenModelViaMocks.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/app/codegen-data-model-provider/tests/TestCodegenModelViaMocks.cpp b/src/app/codegen-data-model-provider/tests/TestCodegenModelViaMocks.cpp index 164d8856a9de62..84e6df3f1ee2d0 100644 --- a/src/app/codegen-data-model-provider/tests/TestCodegenModelViaMocks.cpp +++ b/src/app/codegen-data-model-provider/tests/TestCodegenModelViaMocks.cpp @@ -329,7 +329,6 @@ const MockNodeConfig gTestNodeConfig({ MOCK_ATTRIBUTE_CONFIG_NON_NULLABLE(ZCL_VOLTAGE_MV_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NON_NULLABLE(ZCL_ENERGY_MWH_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NON_NULLABLE(ZCL_TOD_ATTRIBUTE_TYPE), - MOCK_ATTRIBUTE_CONFIG_NON_NULLABLE(ZCL_DATE_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NON_NULLABLE(ZCL_EPOCH_US_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NON_NULLABLE(ZCL_EPOCH_S_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NON_NULLABLE(ZCL_POSIX_MS_ATTRIBUTE_TYPE), @@ -402,7 +401,6 @@ const MockNodeConfig gTestNodeConfig({ MOCK_ATTRIBUTE_CONFIG_NULLABLE(ZCL_VOLTAGE_MV_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NULLABLE(ZCL_ENERGY_MWH_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NULLABLE(ZCL_TOD_ATTRIBUTE_TYPE), - MOCK_ATTRIBUTE_CONFIG_NULLABLE(ZCL_DATE_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NULLABLE(ZCL_EPOCH_US_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NULLABLE(ZCL_EPOCH_S_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NULLABLE(ZCL_POSIX_MS_ATTRIBUTE_TYPE), From 9eef98a41e48ad6d9848bfcb21685cba14a0e8a6 Mon Sep 17 00:00:00 2001 From: Mikhail Antropov Date: Thu, 25 Jul 2024 18:22:11 +0300 Subject: [PATCH 12/16] Update XML by new version ADOC --- .../chip/energy-calendar-cluster.xml | 72 ++++++++++--------- .../data_model/controller-clusters.matter | 2 +- .../CHIP/zap-generated/MTRBaseClusters.h | 2 +- .../CHIP/zap-generated/MTRClusters.h | 2 +- 4 files changed, 40 insertions(+), 38 deletions(-) diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml index 4223d37cf34cf8..974c295a50ac4c 100644 --- a/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml @@ -1,10 +1,13 @@ - CalendarID - Name - ProviderID - EventID - StartDate - CalendarPeriods - SpecialDays - CurrentDay - NextDay - CurrentTransition - CurrentPeakPeriod - NextPeakPeriod + true + + CalendarID + Name + ProviderID + EventID + StartDate + CalendarPeriods + SpecialDays + CurrentDay + NextDay + CurrentTransition + CurrentPeakPeriod + NextPeakPeriod diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index c30a15331182de..f31d3cf973db1d 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -5437,7 +5437,7 @@ cluster EnergyEvse = 153 { timed command ClearTargets(): DefaultSuccess = 7; } -/** The Energy Calendar Cluster provides a mechanism for communicating schedules associated with various forms of energy consumption. */ +/** */ cluster EnergyCalendar = 154 { revision 3; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index eb4763a36244e5..4f616a4df4e248 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -8135,7 +8135,7 @@ MTR_PROVISIONALLY_AVAILABLE /** * Cluster Energy Calendar * - * The Energy Calendar Cluster provides a mechanism for communicating schedules associated with various forms of energy consumption. + * */ MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterEnergyCalendar : MTRGenericBaseCluster diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index f7e169ca2c4a36..82c1dcd3a985c0 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -3796,7 +3796,7 @@ MTR_PROVISIONALLY_AVAILABLE /** * Cluster Energy Calendar - * The Energy Calendar Cluster provides a mechanism for communicating schedules associated with various forms of energy consumption. + * */ MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterEnergyCalendar : MTRGenericCluster From daecb95792085b6de5592fe6a56706ccf43d7556 Mon Sep 17 00:00:00 2001 From: Mikhail Antropov Date: Fri, 26 Jul 2024 10:43:17 +0300 Subject: [PATCH 13/16] Revert type DayStruct.Date to epoch Revert implementing Date type as struct --- .../tests/TestCodegenModelViaMocks.cpp | 2 + .../zcl/data-model/chip/chip-types.xml | 2 +- .../chip/energy-calendar-cluster.xml | 2 +- .../data_model/controller-clusters.matter | 9 +- .../chip/devicecontroller/ChipStructs.java | 105 +---- .../chip/devicecontroller/cluster/files.gni | 1 - .../EnergyCalendarClusterDateStruct.kt | 109 ------ .../structs/EnergyCalendarClusterDayStruct.kt | 8 +- .../java/matter/controller/cluster/files.gni | 1 - .../EnergyCalendarClusterDateStruct.kt | 109 ------ .../structs/EnergyCalendarClusterDayStruct.kt | 8 +- .../CHIPAttributeTLVValueDecoder.cpp | 360 ++---------------- .../python/chip/clusters/Objects.py | 21 +- .../MTRAttributeTLVValueDecoder.mm | 88 +---- .../CHIP/zap-generated/MTRStructsObjc.h | 10 +- .../CHIP/zap-generated/MTRStructsObjc.mm | 36 -- .../app-common/zap-generated/attribute-type.h | 1 + .../zap-generated/cluster-objects.h | 5 +- 18 files changed, 53 insertions(+), 824 deletions(-) delete mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDateStruct.kt delete mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDateStruct.kt diff --git a/src/app/codegen-data-model-provider/tests/TestCodegenModelViaMocks.cpp b/src/app/codegen-data-model-provider/tests/TestCodegenModelViaMocks.cpp index 84e6df3f1ee2d0..164d8856a9de62 100644 --- a/src/app/codegen-data-model-provider/tests/TestCodegenModelViaMocks.cpp +++ b/src/app/codegen-data-model-provider/tests/TestCodegenModelViaMocks.cpp @@ -329,6 +329,7 @@ const MockNodeConfig gTestNodeConfig({ MOCK_ATTRIBUTE_CONFIG_NON_NULLABLE(ZCL_VOLTAGE_MV_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NON_NULLABLE(ZCL_ENERGY_MWH_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NON_NULLABLE(ZCL_TOD_ATTRIBUTE_TYPE), + MOCK_ATTRIBUTE_CONFIG_NON_NULLABLE(ZCL_DATE_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NON_NULLABLE(ZCL_EPOCH_US_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NON_NULLABLE(ZCL_EPOCH_S_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NON_NULLABLE(ZCL_POSIX_MS_ATTRIBUTE_TYPE), @@ -401,6 +402,7 @@ const MockNodeConfig gTestNodeConfig({ MOCK_ATTRIBUTE_CONFIG_NULLABLE(ZCL_VOLTAGE_MV_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NULLABLE(ZCL_ENERGY_MWH_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NULLABLE(ZCL_TOD_ATTRIBUTE_TYPE), + MOCK_ATTRIBUTE_CONFIG_NULLABLE(ZCL_DATE_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NULLABLE(ZCL_EPOCH_US_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NULLABLE(ZCL_EPOCH_S_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NULLABLE(ZCL_POSIX_MS_ATTRIBUTE_TYPE), diff --git a/src/app/zap-templates/zcl/data-model/chip/chip-types.xml b/src/app/zap-templates/zcl/data-model/chip/chip-types.xml index 8ef7ced67251a9..77fcb4df6b4fe1 100644 --- a/src/app/zap-templates/zcl/data-model/chip/chip-types.xml +++ b/src/app/zap-templates/zcl/data-model/chip/chip-types.xml @@ -64,7 +64,7 @@ limitations under the License. - + diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml index 974c295a50ac4c..f4cc7eae3a8d71 100644 --- a/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml @@ -55,7 +55,7 @@ limitations under the License. - + diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index f31d3cf973db1d..65c1de69b1a83f 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -5483,15 +5483,8 @@ cluster EnergyCalendar = 154 { optional AuxiliaryLoadBitmap auxiliaryLoad = 3; } - struct DateStruct { - nullable int8u year = 0; - nullable int8u month = 1; - nullable int8u day = 2; - nullable int8u dayOfWeek = 3; - } - struct DayStruct { - optional DateStruct date = 0; + optional epoch_s date = 0; optional TransitionDayOfWeekBitmap daysOfWeek = 1; TransitionStruct transitions[] = 2; optional int32u calendarID = 3; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index 1e4ef007396d3e..4cbe6c8e2daeb1 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -8850,99 +8850,8 @@ public String toString() { return output.toString(); } } -public static class EnergyCalendarClusterDateStruct { - public @Nullable Integer year; - public @Nullable Integer month; - public @Nullable Integer day; - public @Nullable Integer dayOfWeek; - private static final long YEAR_ID = 0L; - private static final long MONTH_ID = 1L; - private static final long DAY_ID = 2L; - private static final long DAY_OF_WEEK_ID = 3L; - - public EnergyCalendarClusterDateStruct( - @Nullable Integer year, - @Nullable Integer month, - @Nullable Integer day, - @Nullable Integer dayOfWeek - ) { - this.year = year; - this.month = month; - this.day = day; - this.dayOfWeek = dayOfWeek; - } - - public StructType encodeTlv() { - ArrayList values = new ArrayList<>(); - values.add(new StructElement(YEAR_ID, year != null ? new UIntType(year) : new NullType())); - values.add(new StructElement(MONTH_ID, month != null ? new UIntType(month) : new NullType())); - values.add(new StructElement(DAY_ID, day != null ? new UIntType(day) : new NullType())); - values.add(new StructElement(DAY_OF_WEEK_ID, dayOfWeek != null ? new UIntType(dayOfWeek) : new NullType())); - - return new StructType(values); - } - - public static EnergyCalendarClusterDateStruct decodeTlv(BaseTLVType tlvValue) { - if (tlvValue == null || tlvValue.type() != TLVType.Struct) { - return null; - } - @Nullable Integer year = null; - @Nullable Integer month = null; - @Nullable Integer day = null; - @Nullable Integer dayOfWeek = null; - for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == YEAR_ID) { - if (element.value(BaseTLVType.class).type() == TLVType.UInt) { - UIntType castingValue = element.value(UIntType.class); - year = castingValue.value(Integer.class); - } - } else if (element.contextTagNum() == MONTH_ID) { - if (element.value(BaseTLVType.class).type() == TLVType.UInt) { - UIntType castingValue = element.value(UIntType.class); - month = castingValue.value(Integer.class); - } - } else if (element.contextTagNum() == DAY_ID) { - if (element.value(BaseTLVType.class).type() == TLVType.UInt) { - UIntType castingValue = element.value(UIntType.class); - day = castingValue.value(Integer.class); - } - } else if (element.contextTagNum() == DAY_OF_WEEK_ID) { - if (element.value(BaseTLVType.class).type() == TLVType.UInt) { - UIntType castingValue = element.value(UIntType.class); - dayOfWeek = castingValue.value(Integer.class); - } - } - } - return new EnergyCalendarClusterDateStruct( - year, - month, - day, - dayOfWeek - ); - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(); - output.append("EnergyCalendarClusterDateStruct {\n"); - output.append("\tyear: "); - output.append(year); - output.append("\n"); - output.append("\tmonth: "); - output.append(month); - output.append("\n"); - output.append("\tday: "); - output.append(day); - output.append("\n"); - output.append("\tdayOfWeek: "); - output.append(dayOfWeek); - output.append("\n"); - output.append("}\n"); - return output.toString(); - } -} public static class EnergyCalendarClusterDayStruct { - public Optional date; + public Optional date; public Optional daysOfWeek; public ArrayList transitions; public Optional calendarID; @@ -8952,7 +8861,7 @@ public static class EnergyCalendarClusterDayStruct { private static final long CALENDAR_I_D_ID = 3L; public EnergyCalendarClusterDayStruct( - Optional date, + Optional date, Optional daysOfWeek, ArrayList transitions, Optional calendarID @@ -8965,7 +8874,7 @@ public EnergyCalendarClusterDayStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(DATE_ID, date.map((nonOptionaldate) -> nonOptionaldate.encodeTlv()).orElse(new EmptyType()))); + values.add(new StructElement(DATE_ID, date.map((nonOptionaldate) -> new UIntType(nonOptionaldate)).orElse(new EmptyType()))); values.add(new StructElement(DAYS_OF_WEEK_ID, daysOfWeek.map((nonOptionaldaysOfWeek) -> new UIntType(nonOptionaldaysOfWeek)).orElse(new EmptyType()))); values.add(new StructElement(TRANSITIONS_ID, ArrayType.generateArrayType(transitions, (elementtransitions) -> elementtransitions.encodeTlv()))); values.add(new StructElement(CALENDAR_I_D_ID, calendarID.map((nonOptionalcalendarID) -> new UIntType(nonOptionalcalendarID)).orElse(new EmptyType()))); @@ -8977,15 +8886,15 @@ public static EnergyCalendarClusterDayStruct decodeTlv(BaseTLVType tlvValue) { if (tlvValue == null || tlvValue.type() != TLVType.Struct) { return null; } - Optional date = Optional.empty(); + Optional date = Optional.empty(); Optional daysOfWeek = Optional.empty(); ArrayList transitions = null; Optional calendarID = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { if (element.contextTagNum() == DATE_ID) { - if (element.value(BaseTLVType.class).type() == TLVType.Struct) { - StructType castingValue = element.value(StructType.class); - date = Optional.of(ChipStructs.EnergyCalendarClusterDateStruct.decodeTlv(castingValue)); + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + date = Optional.of(castingValue.value(Long.class)); } } else if (element.contextTagNum() == DAYS_OF_WEEK_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni index bac6e44d468801..cdb840b563f936 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni @@ -72,7 +72,6 @@ structs_sources = [ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementAccuracyStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementRangeStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterCalendarPeriodStruct.kt", - "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDateStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterTransitionStruct.kt", diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDateStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDateStruct.kt deleted file mode 100644 index 98ddfc3fd2482f..00000000000000 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDateStruct.kt +++ /dev/null @@ -1,109 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * - * 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. - */ -package chip.devicecontroller.cluster.structs - -import chip.devicecontroller.cluster.* -import matter.tlv.ContextSpecificTag -import matter.tlv.Tag -import matter.tlv.TlvReader -import matter.tlv.TlvWriter - -class EnergyCalendarClusterDateStruct( - val year: UInt?, - val month: UInt?, - val day: UInt?, - val dayOfWeek: UInt?, -) { - override fun toString(): String = buildString { - append("EnergyCalendarClusterDateStruct {\n") - append("\tyear : $year\n") - append("\tmonth : $month\n") - append("\tday : $day\n") - append("\tdayOfWeek : $dayOfWeek\n") - append("}\n") - } - - fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { - tlvWriter.apply { - startStructure(tlvTag) - if (year != null) { - put(ContextSpecificTag(TAG_YEAR), year) - } else { - putNull(ContextSpecificTag(TAG_YEAR)) - } - if (month != null) { - put(ContextSpecificTag(TAG_MONTH), month) - } else { - putNull(ContextSpecificTag(TAG_MONTH)) - } - if (day != null) { - put(ContextSpecificTag(TAG_DAY), day) - } else { - putNull(ContextSpecificTag(TAG_DAY)) - } - if (dayOfWeek != null) { - put(ContextSpecificTag(TAG_DAY_OF_WEEK), dayOfWeek) - } else { - putNull(ContextSpecificTag(TAG_DAY_OF_WEEK)) - } - endStructure() - } - } - - companion object { - private const val TAG_YEAR = 0 - private const val TAG_MONTH = 1 - private const val TAG_DAY = 2 - private const val TAG_DAY_OF_WEEK = 3 - - fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyCalendarClusterDateStruct { - tlvReader.enterStructure(tlvTag) - val year = - if (!tlvReader.isNull()) { - tlvReader.getUInt(ContextSpecificTag(TAG_YEAR)) - } else { - tlvReader.getNull(ContextSpecificTag(TAG_YEAR)) - null - } - val month = - if (!tlvReader.isNull()) { - tlvReader.getUInt(ContextSpecificTag(TAG_MONTH)) - } else { - tlvReader.getNull(ContextSpecificTag(TAG_MONTH)) - null - } - val day = - if (!tlvReader.isNull()) { - tlvReader.getUInt(ContextSpecificTag(TAG_DAY)) - } else { - tlvReader.getNull(ContextSpecificTag(TAG_DAY)) - null - } - val dayOfWeek = - if (!tlvReader.isNull()) { - tlvReader.getUInt(ContextSpecificTag(TAG_DAY_OF_WEEK)) - } else { - tlvReader.getNull(ContextSpecificTag(TAG_DAY_OF_WEEK)) - null - } - - tlvReader.exitContainer() - - return EnergyCalendarClusterDateStruct(year, month, day, dayOfWeek) - } - } -} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt index bf883bb287b1f8..0520e76669c8ea 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt @@ -25,7 +25,7 @@ import matter.tlv.TlvReader import matter.tlv.TlvWriter class EnergyCalendarClusterDayStruct( - val date: Optional, + val date: Optional, val daysOfWeek: Optional, val transitions: List, val calendarID: Optional, @@ -44,7 +44,7 @@ class EnergyCalendarClusterDayStruct( startStructure(tlvTag) if (date.isPresent) { val optdate = date.get() - optdate.toTlv(ContextSpecificTag(TAG_DATE), this) + put(ContextSpecificTag(TAG_DATE), optdate) } if (daysOfWeek.isPresent) { val optdaysOfWeek = daysOfWeek.get() @@ -73,9 +73,7 @@ class EnergyCalendarClusterDayStruct( tlvReader.enterStructure(tlvTag) val date = if (tlvReader.isNextTag(ContextSpecificTag(TAG_DATE))) { - Optional.of( - EnergyCalendarClusterDateStruct.fromTlv(ContextSpecificTag(TAG_DATE), tlvReader) - ) + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_DATE))) } else { Optional.empty() } diff --git a/src/controller/java/generated/java/matter/controller/cluster/files.gni b/src/controller/java/generated/java/matter/controller/cluster/files.gni index 9f794491c9e97f..3e99c3837fa529 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/files.gni +++ b/src/controller/java/generated/java/matter/controller/cluster/files.gni @@ -72,7 +72,6 @@ matter_structs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementAccuracyStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementRangeStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterCalendarPeriodStruct.kt", - "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDateStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterTransitionStruct.kt", diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDateStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDateStruct.kt deleted file mode 100644 index 128428ee076f86..00000000000000 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDateStruct.kt +++ /dev/null @@ -1,109 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * - * 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. - */ -package matter.controller.cluster.structs - -import matter.controller.cluster.* -import matter.tlv.ContextSpecificTag -import matter.tlv.Tag -import matter.tlv.TlvReader -import matter.tlv.TlvWriter - -class EnergyCalendarClusterDateStruct( - val year: UByte?, - val month: UByte?, - val day: UByte?, - val dayOfWeek: UByte?, -) { - override fun toString(): String = buildString { - append("EnergyCalendarClusterDateStruct {\n") - append("\tyear : $year\n") - append("\tmonth : $month\n") - append("\tday : $day\n") - append("\tdayOfWeek : $dayOfWeek\n") - append("}\n") - } - - fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { - tlvWriter.apply { - startStructure(tlvTag) - if (year != null) { - put(ContextSpecificTag(TAG_YEAR), year) - } else { - putNull(ContextSpecificTag(TAG_YEAR)) - } - if (month != null) { - put(ContextSpecificTag(TAG_MONTH), month) - } else { - putNull(ContextSpecificTag(TAG_MONTH)) - } - if (day != null) { - put(ContextSpecificTag(TAG_DAY), day) - } else { - putNull(ContextSpecificTag(TAG_DAY)) - } - if (dayOfWeek != null) { - put(ContextSpecificTag(TAG_DAY_OF_WEEK), dayOfWeek) - } else { - putNull(ContextSpecificTag(TAG_DAY_OF_WEEK)) - } - endStructure() - } - } - - companion object { - private const val TAG_YEAR = 0 - private const val TAG_MONTH = 1 - private const val TAG_DAY = 2 - private const val TAG_DAY_OF_WEEK = 3 - - fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyCalendarClusterDateStruct { - tlvReader.enterStructure(tlvTag) - val year = - if (!tlvReader.isNull()) { - tlvReader.getUByte(ContextSpecificTag(TAG_YEAR)) - } else { - tlvReader.getNull(ContextSpecificTag(TAG_YEAR)) - null - } - val month = - if (!tlvReader.isNull()) { - tlvReader.getUByte(ContextSpecificTag(TAG_MONTH)) - } else { - tlvReader.getNull(ContextSpecificTag(TAG_MONTH)) - null - } - val day = - if (!tlvReader.isNull()) { - tlvReader.getUByte(ContextSpecificTag(TAG_DAY)) - } else { - tlvReader.getNull(ContextSpecificTag(TAG_DAY)) - null - } - val dayOfWeek = - if (!tlvReader.isNull()) { - tlvReader.getUByte(ContextSpecificTag(TAG_DAY_OF_WEEK)) - } else { - tlvReader.getNull(ContextSpecificTag(TAG_DAY_OF_WEEK)) - null - } - - tlvReader.exitContainer() - - return EnergyCalendarClusterDateStruct(year, month, day, dayOfWeek) - } - } -} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt index e5dd66bb585107..a45936a14060d9 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt @@ -25,7 +25,7 @@ import matter.tlv.TlvReader import matter.tlv.TlvWriter class EnergyCalendarClusterDayStruct( - val date: Optional, + val date: Optional, val daysOfWeek: Optional, val transitions: List, val calendarID: Optional, @@ -44,7 +44,7 @@ class EnergyCalendarClusterDayStruct( startStructure(tlvTag) if (date.isPresent) { val optdate = date.get() - optdate.toTlv(ContextSpecificTag(TAG_DATE), this) + put(ContextSpecificTag(TAG_DATE), optdate) } if (daysOfWeek.isPresent) { val optdaysOfWeek = daysOfWeek.get() @@ -73,9 +73,7 @@ class EnergyCalendarClusterDayStruct( tlvReader.enterStructure(tlvTag) val date = if (tlvReader.isNextTag(ContextSpecificTag(TAG_DATE))) { - Optional.of( - EnergyCalendarClusterDateStruct.fromTlv(ContextSpecificTag(TAG_DATE), tlvReader) - ) + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_DATE))) } else { Optional.empty() } diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index e99bb80e56205b..5aa0af60b4a9bb 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -25120,93 +25120,13 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR else { jobject newElement_3_dateInsideOptional; - jobject newElement_3_dateInsideOptional_year; - if (entry_3.date.Value().year.IsNull()) - { - newElement_3_dateInsideOptional_year = nullptr; - } - else - { - std::string newElement_3_dateInsideOptional_yearClassName = "java/lang/Integer"; - std::string newElement_3_dateInsideOptional_yearCtorSignature = "(I)V"; - jint jninewElement_3_dateInsideOptional_year = static_cast(entry_3.date.Value().year.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_3_dateInsideOptional_yearClassName.c_str(), - newElement_3_dateInsideOptional_yearCtorSignature.c_str(), - jninewElement_3_dateInsideOptional_year, newElement_3_dateInsideOptional_year); - } - jobject newElement_3_dateInsideOptional_month; - if (entry_3.date.Value().month.IsNull()) - { - newElement_3_dateInsideOptional_month = nullptr; - } - else - { - std::string newElement_3_dateInsideOptional_monthClassName = "java/lang/Integer"; - std::string newElement_3_dateInsideOptional_monthCtorSignature = "(I)V"; - jint jninewElement_3_dateInsideOptional_month = - static_cast(entry_3.date.Value().month.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_3_dateInsideOptional_monthClassName.c_str(), - newElement_3_dateInsideOptional_monthCtorSignature.c_str(), - jninewElement_3_dateInsideOptional_month, newElement_3_dateInsideOptional_month); - } - jobject newElement_3_dateInsideOptional_day; - if (entry_3.date.Value().day.IsNull()) - { - newElement_3_dateInsideOptional_day = nullptr; - } - else - { - std::string newElement_3_dateInsideOptional_dayClassName = "java/lang/Integer"; - std::string newElement_3_dateInsideOptional_dayCtorSignature = "(I)V"; - jint jninewElement_3_dateInsideOptional_day = static_cast(entry_3.date.Value().day.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_3_dateInsideOptional_dayClassName.c_str(), - newElement_3_dateInsideOptional_dayCtorSignature.c_str(), - jninewElement_3_dateInsideOptional_day, newElement_3_dateInsideOptional_day); - } - jobject newElement_3_dateInsideOptional_dayOfWeek; - if (entry_3.date.Value().dayOfWeek.IsNull()) - { - newElement_3_dateInsideOptional_dayOfWeek = nullptr; - } - else - { - std::string newElement_3_dateInsideOptional_dayOfWeekClassName = "java/lang/Integer"; - std::string newElement_3_dateInsideOptional_dayOfWeekCtorSignature = "(I)V"; - jint jninewElement_3_dateInsideOptional_dayOfWeek = - static_cast(entry_3.date.Value().dayOfWeek.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_3_dateInsideOptional_dayOfWeekClassName.c_str(), - newElement_3_dateInsideOptional_dayOfWeekCtorSignature.c_str(), - jninewElement_3_dateInsideOptional_dayOfWeek, newElement_3_dateInsideOptional_dayOfWeek); - } - - jclass dateStructStructClass_6; - err = chip::JniReferences::GetInstance().GetLocalClassRef( - env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterDateStruct", dateStructStructClass_6); - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterDateStruct"); - return nullptr; - } - - jmethodID dateStructStructCtor_6; - err = chip::JniReferences::GetInstance().FindMethod( - env, dateStructStructClass_6, "", - "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V", - &dateStructStructCtor_6); - if (err != CHIP_NO_ERROR || dateStructStructCtor_6 == nullptr) - { - ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterDateStruct constructor"); - return nullptr; - } - - newElement_3_dateInsideOptional = - env->NewObject(dateStructStructClass_6, dateStructStructCtor_6, - newElement_3_dateInsideOptional_year, newElement_3_dateInsideOptional_month, - newElement_3_dateInsideOptional_day, newElement_3_dateInsideOptional_dayOfWeek); + std::string newElement_3_dateInsideOptionalClassName = "java/lang/Long"; + std::string newElement_3_dateInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_3_dateInsideOptional = static_cast(entry_3.date.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_3_dateInsideOptionalClassName.c_str(), + newElement_3_dateInsideOptionalCtorSignature.c_str(), jninewElement_3_dateInsideOptional, + newElement_3_dateInsideOptional); chip::JniReferences::GetInstance().CreateOptional(newElement_3_dateInsideOptional, newElement_3_date); } jobject newElement_3_daysOfWeek; @@ -25426,92 +25346,12 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR else { jobject newElement_1_dateInsideOptional; - jobject newElement_1_dateInsideOptional_year; - if (entry_1.date.Value().year.IsNull()) - { - newElement_1_dateInsideOptional_year = nullptr; - } - else - { - std::string newElement_1_dateInsideOptional_yearClassName = "java/lang/Integer"; - std::string newElement_1_dateInsideOptional_yearCtorSignature = "(I)V"; - jint jninewElement_1_dateInsideOptional_year = static_cast(entry_1.date.Value().year.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_1_dateInsideOptional_yearClassName.c_str(), - newElement_1_dateInsideOptional_yearCtorSignature.c_str(), jninewElement_1_dateInsideOptional_year, - newElement_1_dateInsideOptional_year); - } - jobject newElement_1_dateInsideOptional_month; - if (entry_1.date.Value().month.IsNull()) - { - newElement_1_dateInsideOptional_month = nullptr; - } - else - { - std::string newElement_1_dateInsideOptional_monthClassName = "java/lang/Integer"; - std::string newElement_1_dateInsideOptional_monthCtorSignature = "(I)V"; - jint jninewElement_1_dateInsideOptional_month = static_cast(entry_1.date.Value().month.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_1_dateInsideOptional_monthClassName.c_str(), - newElement_1_dateInsideOptional_monthCtorSignature.c_str(), - jninewElement_1_dateInsideOptional_month, newElement_1_dateInsideOptional_month); - } - jobject newElement_1_dateInsideOptional_day; - if (entry_1.date.Value().day.IsNull()) - { - newElement_1_dateInsideOptional_day = nullptr; - } - else - { - std::string newElement_1_dateInsideOptional_dayClassName = "java/lang/Integer"; - std::string newElement_1_dateInsideOptional_dayCtorSignature = "(I)V"; - jint jninewElement_1_dateInsideOptional_day = static_cast(entry_1.date.Value().day.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_1_dateInsideOptional_dayClassName.c_str(), - newElement_1_dateInsideOptional_dayCtorSignature.c_str(), jninewElement_1_dateInsideOptional_day, - newElement_1_dateInsideOptional_day); - } - jobject newElement_1_dateInsideOptional_dayOfWeek; - if (entry_1.date.Value().dayOfWeek.IsNull()) - { - newElement_1_dateInsideOptional_dayOfWeek = nullptr; - } - else - { - std::string newElement_1_dateInsideOptional_dayOfWeekClassName = "java/lang/Integer"; - std::string newElement_1_dateInsideOptional_dayOfWeekCtorSignature = "(I)V"; - jint jninewElement_1_dateInsideOptional_dayOfWeek = - static_cast(entry_1.date.Value().dayOfWeek.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_1_dateInsideOptional_dayOfWeekClassName.c_str(), - newElement_1_dateInsideOptional_dayOfWeekCtorSignature.c_str(), - jninewElement_1_dateInsideOptional_dayOfWeek, newElement_1_dateInsideOptional_dayOfWeek); - } - - jclass dateStructStructClass_4; - err = chip::JniReferences::GetInstance().GetLocalClassRef( - env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterDateStruct", dateStructStructClass_4); - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterDateStruct"); - return nullptr; - } - - jmethodID dateStructStructCtor_4; - err = chip::JniReferences::GetInstance().FindMethod( - env, dateStructStructClass_4, "", - "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V", - &dateStructStructCtor_4); - if (err != CHIP_NO_ERROR || dateStructStructCtor_4 == nullptr) - { - ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterDateStruct constructor"); - return nullptr; - } - - newElement_1_dateInsideOptional = - env->NewObject(dateStructStructClass_4, dateStructStructCtor_4, newElement_1_dateInsideOptional_year, - newElement_1_dateInsideOptional_month, newElement_1_dateInsideOptional_day, - newElement_1_dateInsideOptional_dayOfWeek); + std::string newElement_1_dateInsideOptionalClassName = "java/lang/Long"; + std::string newElement_1_dateInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_1_dateInsideOptional = static_cast(entry_1.date.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_1_dateInsideOptionalClassName.c_str(), newElement_1_dateInsideOptionalCtorSignature.c_str(), + jninewElement_1_dateInsideOptional, newElement_1_dateInsideOptional); chip::JniReferences::GetInstance().CreateOptional(newElement_1_dateInsideOptional, newElement_1_date); } jobject newElement_1_daysOfWeek; @@ -25699,87 +25539,12 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR else { jobject value_dateInsideOptional; - jobject value_dateInsideOptional_year; - if (cppValue.Value().date.Value().year.IsNull()) - { - value_dateInsideOptional_year = nullptr; - } - else - { - std::string value_dateInsideOptional_yearClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_yearCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_year = static_cast(cppValue.Value().date.Value().year.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_yearClassName.c_str(), value_dateInsideOptional_yearCtorSignature.c_str(), - jnivalue_dateInsideOptional_year, value_dateInsideOptional_year); - } - jobject value_dateInsideOptional_month; - if (cppValue.Value().date.Value().month.IsNull()) - { - value_dateInsideOptional_month = nullptr; - } - else - { - std::string value_dateInsideOptional_monthClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_monthCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_month = static_cast(cppValue.Value().date.Value().month.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_monthClassName.c_str(), value_dateInsideOptional_monthCtorSignature.c_str(), - jnivalue_dateInsideOptional_month, value_dateInsideOptional_month); - } - jobject value_dateInsideOptional_day; - if (cppValue.Value().date.Value().day.IsNull()) - { - value_dateInsideOptional_day = nullptr; - } - else - { - std::string value_dateInsideOptional_dayClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_dayCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_day = static_cast(cppValue.Value().date.Value().day.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_dayClassName.c_str(), value_dateInsideOptional_dayCtorSignature.c_str(), - jnivalue_dateInsideOptional_day, value_dateInsideOptional_day); - } - jobject value_dateInsideOptional_dayOfWeek; - if (cppValue.Value().date.Value().dayOfWeek.IsNull()) - { - value_dateInsideOptional_dayOfWeek = nullptr; - } - else - { - std::string value_dateInsideOptional_dayOfWeekClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_dayOfWeekCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_dayOfWeek = - static_cast(cppValue.Value().date.Value().dayOfWeek.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_dayOfWeekClassName.c_str(), - value_dateInsideOptional_dayOfWeekCtorSignature.c_str(), jnivalue_dateInsideOptional_dayOfWeek, - value_dateInsideOptional_dayOfWeek); - } - - jclass dateStructStructClass_3; - err = chip::JniReferences::GetInstance().GetLocalClassRef( - env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterDateStruct", dateStructStructClass_3); - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterDateStruct"); - return nullptr; - } - - jmethodID dateStructStructCtor_3; - err = chip::JniReferences::GetInstance().FindMethod( - env, dateStructStructClass_3, "", - "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V", &dateStructStructCtor_3); - if (err != CHIP_NO_ERROR || dateStructStructCtor_3 == nullptr) - { - ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterDateStruct constructor"); - return nullptr; - } - - value_dateInsideOptional = env->NewObject(dateStructStructClass_3, dateStructStructCtor_3, - value_dateInsideOptional_year, value_dateInsideOptional_month, - value_dateInsideOptional_day, value_dateInsideOptional_dayOfWeek); + std::string value_dateInsideOptionalClassName = "java/lang/Long"; + std::string value_dateInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_dateInsideOptional = static_cast(cppValue.Value().date.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dateInsideOptionalClassName.c_str(), value_dateInsideOptionalCtorSignature.c_str(), + jnivalue_dateInsideOptional, value_dateInsideOptional); chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional, value_date); } jobject value_daysOfWeek; @@ -25959,87 +25724,12 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR else { jobject value_dateInsideOptional; - jobject value_dateInsideOptional_year; - if (cppValue.Value().date.Value().year.IsNull()) - { - value_dateInsideOptional_year = nullptr; - } - else - { - std::string value_dateInsideOptional_yearClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_yearCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_year = static_cast(cppValue.Value().date.Value().year.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_yearClassName.c_str(), value_dateInsideOptional_yearCtorSignature.c_str(), - jnivalue_dateInsideOptional_year, value_dateInsideOptional_year); - } - jobject value_dateInsideOptional_month; - if (cppValue.Value().date.Value().month.IsNull()) - { - value_dateInsideOptional_month = nullptr; - } - else - { - std::string value_dateInsideOptional_monthClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_monthCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_month = static_cast(cppValue.Value().date.Value().month.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_monthClassName.c_str(), value_dateInsideOptional_monthCtorSignature.c_str(), - jnivalue_dateInsideOptional_month, value_dateInsideOptional_month); - } - jobject value_dateInsideOptional_day; - if (cppValue.Value().date.Value().day.IsNull()) - { - value_dateInsideOptional_day = nullptr; - } - else - { - std::string value_dateInsideOptional_dayClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_dayCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_day = static_cast(cppValue.Value().date.Value().day.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_dayClassName.c_str(), value_dateInsideOptional_dayCtorSignature.c_str(), - jnivalue_dateInsideOptional_day, value_dateInsideOptional_day); - } - jobject value_dateInsideOptional_dayOfWeek; - if (cppValue.Value().date.Value().dayOfWeek.IsNull()) - { - value_dateInsideOptional_dayOfWeek = nullptr; - } - else - { - std::string value_dateInsideOptional_dayOfWeekClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_dayOfWeekCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_dayOfWeek = - static_cast(cppValue.Value().date.Value().dayOfWeek.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_dayOfWeekClassName.c_str(), - value_dateInsideOptional_dayOfWeekCtorSignature.c_str(), jnivalue_dateInsideOptional_dayOfWeek, - value_dateInsideOptional_dayOfWeek); - } - - jclass dateStructStructClass_3; - err = chip::JniReferences::GetInstance().GetLocalClassRef( - env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterDateStruct", dateStructStructClass_3); - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterDateStruct"); - return nullptr; - } - - jmethodID dateStructStructCtor_3; - err = chip::JniReferences::GetInstance().FindMethod( - env, dateStructStructClass_3, "", - "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V", &dateStructStructCtor_3); - if (err != CHIP_NO_ERROR || dateStructStructCtor_3 == nullptr) - { - ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterDateStruct constructor"); - return nullptr; - } - - value_dateInsideOptional = env->NewObject(dateStructStructClass_3, dateStructStructCtor_3, - value_dateInsideOptional_year, value_dateInsideOptional_month, - value_dateInsideOptional_day, value_dateInsideOptional_dayOfWeek); + std::string value_dateInsideOptionalClassName = "java/lang/Long"; + std::string value_dateInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_dateInsideOptional = static_cast(cppValue.Value().date.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dateInsideOptionalClassName.c_str(), value_dateInsideOptionalCtorSignature.c_str(), + jnivalue_dateInsideOptional, value_dateInsideOptional); chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional, value_date); } jobject value_daysOfWeek; diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index fd5adcbb530e1e..9c2aca3786b8d2 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -26672,36 +26672,19 @@ def descriptor(cls) -> ClusterObjectDescriptor: friendlyCredit: 'typing.Optional[bool]' = None auxiliaryLoad: 'typing.Optional[uint]' = None - @dataclass - class DateStruct(ClusterObject): - @ChipUtility.classproperty - def descriptor(cls) -> ClusterObjectDescriptor: - return ClusterObjectDescriptor( - Fields=[ - ClusterObjectFieldDescriptor(Label="year", Tag=0, Type=typing.Union[Nullable, uint]), - ClusterObjectFieldDescriptor(Label="month", Tag=1, Type=typing.Union[Nullable, uint]), - ClusterObjectFieldDescriptor(Label="day", Tag=2, Type=typing.Union[Nullable, uint]), - ClusterObjectFieldDescriptor(Label="dayOfWeek", Tag=3, Type=typing.Union[Nullable, uint]), - ]) - - year: 'typing.Union[Nullable, uint]' = NullValue - month: 'typing.Union[Nullable, uint]' = NullValue - day: 'typing.Union[Nullable, uint]' = NullValue - dayOfWeek: 'typing.Union[Nullable, uint]' = NullValue - @dataclass class DayStruct(ClusterObject): @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="date", Tag=0, Type=typing.Optional[EnergyCalendar.Structs.DateStruct]), + ClusterObjectFieldDescriptor(Label="date", Tag=0, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="daysOfWeek", Tag=1, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="transitions", Tag=2, Type=typing.List[EnergyCalendar.Structs.TransitionStruct]), ClusterObjectFieldDescriptor(Label="calendarID", Tag=3, Type=typing.Optional[uint]), ]) - date: 'typing.Optional[EnergyCalendar.Structs.DateStruct]' = None + date: 'typing.Optional[uint]' = None daysOfWeek: 'typing.Optional[uint]' = None transitions: 'typing.List[EnergyCalendar.Structs.TransitionStruct]' = field(default_factory=lambda: []) calendarID: 'typing.Optional[uint]' = None diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index 7dc832b0fb5776..207d6edd3d0ae7 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -9635,27 +9635,7 @@ static id _Nullable DecodeAttributeValueForEnergyCalendarCluster(AttributeId aAt MTREnergyCalendarClusterDayStruct * newElement_3; newElement_3 = [MTREnergyCalendarClusterDayStruct new]; if (entry_3.date.HasValue()) { - newElement_3.date = [MTREnergyCalendarClusterDateStruct new]; - if (entry_3.date.Value().year.IsNull()) { - newElement_3.date.year = nil; - } else { - newElement_3.date.year = [NSNumber numberWithUnsignedChar:entry_3.date.Value().year.Value()]; - } - if (entry_3.date.Value().month.IsNull()) { - newElement_3.date.month = nil; - } else { - newElement_3.date.month = [NSNumber numberWithUnsignedChar:entry_3.date.Value().month.Value()]; - } - if (entry_3.date.Value().day.IsNull()) { - newElement_3.date.day = nil; - } else { - newElement_3.date.day = [NSNumber numberWithUnsignedChar:entry_3.date.Value().day.Value()]; - } - if (entry_3.date.Value().dayOfWeek.IsNull()) { - newElement_3.date.dayOfWeek = nil; - } else { - newElement_3.date.dayOfWeek = [NSNumber numberWithUnsignedChar:entry_3.date.Value().dayOfWeek.Value()]; - } + newElement_3.date = [NSNumber numberWithUnsignedInt:entry_3.date.Value()]; } else { newElement_3.date = nil; } @@ -9741,27 +9721,7 @@ static id _Nullable DecodeAttributeValueForEnergyCalendarCluster(AttributeId aAt MTREnergyCalendarClusterDayStruct * newElement_1; newElement_1 = [MTREnergyCalendarClusterDayStruct new]; if (entry_1.date.HasValue()) { - newElement_1.date = [MTREnergyCalendarClusterDateStruct new]; - if (entry_1.date.Value().year.IsNull()) { - newElement_1.date.year = nil; - } else { - newElement_1.date.year = [NSNumber numberWithUnsignedChar:entry_1.date.Value().year.Value()]; - } - if (entry_1.date.Value().month.IsNull()) { - newElement_1.date.month = nil; - } else { - newElement_1.date.month = [NSNumber numberWithUnsignedChar:entry_1.date.Value().month.Value()]; - } - if (entry_1.date.Value().day.IsNull()) { - newElement_1.date.day = nil; - } else { - newElement_1.date.day = [NSNumber numberWithUnsignedChar:entry_1.date.Value().day.Value()]; - } - if (entry_1.date.Value().dayOfWeek.IsNull()) { - newElement_1.date.dayOfWeek = nil; - } else { - newElement_1.date.dayOfWeek = [NSNumber numberWithUnsignedChar:entry_1.date.Value().dayOfWeek.Value()]; - } + newElement_1.date = [NSNumber numberWithUnsignedInt:entry_1.date.Value()]; } else { newElement_1.date = nil; } @@ -9832,27 +9792,7 @@ static id _Nullable DecodeAttributeValueForEnergyCalendarCluster(AttributeId aAt } else { value = [MTREnergyCalendarClusterDayStruct new]; if (cppValue.Value().date.HasValue()) { - value.date = [MTREnergyCalendarClusterDateStruct new]; - if (cppValue.Value().date.Value().year.IsNull()) { - value.date.year = nil; - } else { - value.date.year = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().year.Value()]; - } - if (cppValue.Value().date.Value().month.IsNull()) { - value.date.month = nil; - } else { - value.date.month = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().month.Value()]; - } - if (cppValue.Value().date.Value().day.IsNull()) { - value.date.day = nil; - } else { - value.date.day = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().day.Value()]; - } - if (cppValue.Value().date.Value().dayOfWeek.IsNull()) { - value.date.dayOfWeek = nil; - } else { - value.date.dayOfWeek = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().dayOfWeek.Value()]; - } + value.date = [NSNumber numberWithUnsignedInt:cppValue.Value().date.Value()]; } else { value.date = nil; } @@ -9914,27 +9854,7 @@ static id _Nullable DecodeAttributeValueForEnergyCalendarCluster(AttributeId aAt } else { value = [MTREnergyCalendarClusterDayStruct new]; if (cppValue.Value().date.HasValue()) { - value.date = [MTREnergyCalendarClusterDateStruct new]; - if (cppValue.Value().date.Value().year.IsNull()) { - value.date.year = nil; - } else { - value.date.year = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().year.Value()]; - } - if (cppValue.Value().date.Value().month.IsNull()) { - value.date.month = nil; - } else { - value.date.month = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().month.Value()]; - } - if (cppValue.Value().date.Value().day.IsNull()) { - value.date.day = nil; - } else { - value.date.day = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().day.Value()]; - } - if (cppValue.Value().date.Value().dayOfWeek.IsNull()) { - value.date.dayOfWeek = nil; - } else { - value.date.dayOfWeek = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().dayOfWeek.Value()]; - } + value.date = [NSNumber numberWithUnsignedInt:cppValue.Value().date.Value()]; } else { value.date = nil; } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index a8fb18709f7208..9b3e921582549d 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -1516,17 +1516,9 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy) NSNumber * _Nullable auxiliaryLoad MTR_PROVISIONALLY_AVAILABLE; @end -MTR_PROVISIONALLY_AVAILABLE -@interface MTREnergyCalendarClusterDateStruct : NSObject -@property (nonatomic, copy) NSNumber * _Nullable year MTR_PROVISIONALLY_AVAILABLE; -@property (nonatomic, copy) NSNumber * _Nullable month MTR_PROVISIONALLY_AVAILABLE; -@property (nonatomic, copy) NSNumber * _Nullable day MTR_PROVISIONALLY_AVAILABLE; -@property (nonatomic, copy) NSNumber * _Nullable dayOfWeek MTR_PROVISIONALLY_AVAILABLE; -@end - MTR_PROVISIONALLY_AVAILABLE @interface MTREnergyCalendarClusterDayStruct : NSObject -@property (nonatomic, copy) MTREnergyCalendarClusterDateStruct * _Nullable date MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable date MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nullable daysOfWeek MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSArray * _Nonnull transitions MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nullable calendarID MTR_PROVISIONALLY_AVAILABLE; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index 5bf96c9052cf12..8a1a54c6113a12 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -6301,42 +6301,6 @@ - (NSString *)description @end -@implementation MTREnergyCalendarClusterDateStruct -- (instancetype)init -{ - if (self = [super init]) { - - _year = nil; - - _month = nil; - - _day = nil; - - _dayOfWeek = nil; - } - return self; -} - -- (id)copyWithZone:(NSZone * _Nullable)zone -{ - auto other = [[MTREnergyCalendarClusterDateStruct alloc] init]; - - other.year = self.year; - other.month = self.month; - other.day = self.day; - other.dayOfWeek = self.dayOfWeek; - - return other; -} - -- (NSString *)description -{ - NSString * descriptionString = [NSString stringWithFormat:@"<%@: year:%@; month:%@; day:%@; dayOfWeek:%@; >", NSStringFromClass([self class]), _year, _month, _day, _dayOfWeek]; - return descriptionString; -} - -@end - @implementation MTREnergyCalendarClusterDayStruct - (instancetype)init { diff --git a/zzz_generated/app-common/app-common/zap-generated/attribute-type.h b/zzz_generated/app-common/app-common/zap-generated/attribute-type.h index d70efb382d9acf..ae493673fc03f2 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attribute-type.h +++ b/zzz_generated/app-common/app-common/zap-generated/attribute-type.h @@ -80,6 +80,7 @@ enum ZCL_VOLTAGE_MV_ATTRIBUTE_TYPE = 0xDB, // Voltage millivolts ZCL_ENERGY_MWH_ATTRIBUTE_TYPE = 0xDC, // Energy milliwatt-hours ZCL_TOD_ATTRIBUTE_TYPE = 0xE0, // Time of day + ZCL_DATE_ATTRIBUTE_TYPE = 0xE1, // Date ZCL_EPOCH_US_ATTRIBUTE_TYPE = 0xE3, // Epoch Microseconds ZCL_EPOCH_S_ATTRIBUTE_TYPE = 0xE4, // Epoch Seconds ZCL_POSIX_MS_ATTRIBUTE_TYPE = 0xE5, // Posix Time Milliseconds 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 a26a7738086983..af08033af67f69 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 @@ -24380,7 +24380,6 @@ struct Type using DecodableType = Type; } // namespace TransitionStruct -namespace DateStruct = Clusters::detail::Structs::DateStruct; namespace DayStruct { enum class Fields : uint8_t { @@ -24393,7 +24392,7 @@ enum class Fields : uint8_t struct Type { public: - Optional date; + Optional date; Optional> daysOfWeek; DataModel::List transitions; Optional calendarID; @@ -24406,7 +24405,7 @@ struct Type struct DecodableType { public: - Optional date; + Optional date; Optional> daysOfWeek; DataModel::DecodableList transitions; Optional calendarID; From e6e050b7423fae778e45ca08f210bbe0397c622c Mon Sep 17 00:00:00 2001 From: Mikhail Antropov Date: Tue, 13 Aug 2024 21:00:10 +0300 Subject: [PATCH 14/16] Rebase on latest master --- .../zcl/data-model/chip/global-structs.xml | 10 ---- .../zcl/zcl-with-test-extensions.json | 22 ++++---- src/app/zap-templates/zcl/zcl.json | 22 ++++---- src/app/zap_cluster_list.json | 2 + .../python/chip/clusters/Objects.py | 4 +- .../CHIP/zap-generated/MTRClusterNames.mm | 11 ++++ .../zap-generated/cluster-objects.cpp | 51 ------------------- .../zap-generated/cluster-objects.h | 30 ----------- .../cluster/ComplexArgumentParser.cpp | 42 --------------- .../cluster/ComplexArgumentParser.h | 4 -- .../cluster/logging/DataModelLogger.cpp | 41 --------------- .../cluster/logging/DataModelLogger.h | 3 -- 12 files changed, 37 insertions(+), 205 deletions(-) diff --git a/src/app/zap-templates/zcl/data-model/chip/global-structs.xml b/src/app/zap-templates/zcl/data-model/chip/global-structs.xml index 454a7380f78937..743fdf366b724b 100644 --- a/src/app/zap-templates/zcl/data-model/chip/global-structs.xml +++ b/src/app/zap-templates/zcl/data-model/chip/global-structs.xml @@ -39,14 +39,4 @@ limitations under the License. - - - - - - - - - - diff --git a/src/app/zap-templates/zcl/zcl-with-test-extensions.json b/src/app/zap-templates/zcl/zcl-with-test-extensions.json index f9065ffa7eb8c0..c34e11d60742ce 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -47,6 +47,7 @@ "microwave-oven-control-cluster.xml", "door-lock-cluster.xml", "ecosystem-information-cluster.xml", + "energy-calendar-cluster.xml", "energy-preference-cluster.xml", "electrical-energy-measurement-cluster.xml", "electrical-power-measurement-cluster.xml", @@ -135,7 +136,6 @@ "window-covering.xml", "matter-devices.xml", "sample-mei-cluster.xml", - "energy-calendar-cluster.xml", "types/door-lock.xml", "types/occupancy-sensing.xml", "types/thermostat-user-interface-configuration.xml" @@ -660,6 +660,16 @@ "NeutralCurrent", "FeatureMap" ], + "Energy Calendar": [ + "CalendarPeriods", + "SpecialDays", + "CurrentDay", + "NextDay", + "CurrentTransition", + "CurrentPeakPeriod", + "NextPeakPeriod", + "FeatureMap" + ], "Power Topology": ["FeatureMap"], "Valve Configuration and Control": ["RemainingDuration"], "Boolean State Configuration": ["CurrentSensitivityLevel"], @@ -681,16 +691,6 @@ "ThreadNetworkTableSize" ], "Service Area": ["CurrentArea", "EstimatedEndTime", "FeatureMap"] - "Energy Calendar": [ - "CalendarPeriods", - "SpecialDays", - "CurrentDay", - "NextDay", - "CurrentTransition", - "CurrentPeakPeriod", - "NextPeakPeriod", - "FeatureMap" - ] }, "defaultReportingPolicy": "mandatory", "ZCLDataTypes": ["ARRAY", "BITMAP", "ENUM", "NUMBER", "STRING", "STRUCT"], diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index fd7db744719149..bed533e61b0cc7 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -43,6 +43,7 @@ "ecosystem-information-cluster.xml", "electrical-energy-measurement-cluster.xml", "electrical-power-measurement-cluster.xml", + "energy-calendar-cluster.xml", "energy-evse-cluster.xml", "energy-evse-mode-cluster.xml", "energy-preference-cluster.xml", @@ -129,7 +130,6 @@ "window-covering.xml", "matter-devices.xml", "sample-mei-cluster.xml", - "energy-calendar-cluster.xml", "types/door-lock.xml", "types/occupancy-sensing.xml", "types/thermostat-user-interface-configuration.xml" @@ -654,6 +654,16 @@ "NeutralCurrent", "FeatureMap" ], + "Energy Calendar": [ + "CalendarPeriods", + "SpecialDays", + "CurrentDay", + "NextDay", + "CurrentTransition", + "CurrentPeakPeriod", + "NextPeakPeriod", + "FeatureMap" + ], "Power Topology": ["FeatureMap"], "Valve Configuration and Control": ["RemainingDuration"], "Boolean State Configuration": ["CurrentSensitivityLevel"], @@ -675,16 +685,6 @@ "ThreadNetworkTableSize" ], "Service Area": ["CurrentArea", "EstimatedEndTime", "FeatureMap"] - "Energy Calendar": [ - "CalendarPeriods", - "SpecialDays", - "CurrentDay", - "NextDay", - "CurrentTransition", - "CurrentPeakPeriod", - "NextPeakPeriod", - "FeatureMap" - ] }, "defaultReportingPolicy": "mandatory", "ZCLDataTypes": ["ARRAY", "BITMAP", "ENUM", "NUMBER", "STRING", "STRUCT"], diff --git a/src/app/zap_cluster_list.json b/src/app/zap_cluster_list.json index 7e6c8103a4ff25..053afb7adbdec3 100644 --- a/src/app/zap_cluster_list.json +++ b/src/app/zap_cluster_list.json @@ -33,6 +33,7 @@ "DIAGNOSTIC_LOGS_CLUSTER": [], "DISHWASHER_ALARM_CLUSTER": [], "DISHWASHER_MODE_CLUSTER": [], + "ENERGY_CALENDAR_CLUSTER": [], "MICROWAVE_OVEN_MODE_CLUSTER": [], "DOOR_LOCK_CLUSTER": [], "ECOSYSTEM_INFORMATION_CLUSTER": [], @@ -179,6 +180,7 @@ "DIAGNOSTIC_LOGS_CLUSTER": ["diagnostic-logs-server"], "DISHWASHER_ALARM_CLUSTER": ["dishwasher-alarm-server"], "DISHWASHER_MODE_CLUSTER": ["mode-base-server"], + "ENERGY_CALENDAR_CLUSTER": [], "MICROWAVE_OVEN_MODE_CLUSTER": ["mode-base-server"], "DOOR_LOCK_CLUSTER": ["door-lock-server"], "ECOSYSTEM_INFORMATION_CLUSTER": ["ecosystem-information-server"], diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 9c2aca3786b8d2..600b81c938d93e 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -26624,8 +26624,8 @@ class PeakPeriodSeverityEnum(MatterIntEnum): kHigh = 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. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class Bitmaps: diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm index 090b4bac77d69c..93e5e4f50e93a8 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm @@ -4739,6 +4739,7 @@ result = [NSString stringWithFormat:@"", attributeID]; break; } + break; case MTRClusterIDTypeEnergyPreferenceID: @@ -9787,6 +9788,16 @@ } break; + case MTRClusterIDTypeEnergyCalendarID: + + switch (eventID) { + + default: + result = [NSString stringWithFormat:@"", eventID]; + break; + } + break; + case MTRClusterIDTypeEnergyPreferenceID: switch (eventID) { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp index bcfa98501ef05d..b1205acd619430 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp @@ -335,57 +335,6 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } // namespace DeviceTypeStruct -namespace DateStruct { -CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const -{ - DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kYear), year); - encoder.Encode(to_underlying(Fields::kMonth), month); - encoder.Encode(to_underlying(Fields::kDay), day); - encoder.Encode(to_underlying(Fields::kDayOfWeek), dayOfWeek); - return encoder.Finalize(); -} - -CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) -{ - detail::StructDecodeIterator __iterator(reader); - while (true) - { - auto __element = __iterator.Next(); - if (std::holds_alternative(__element)) - { - return std::get(__element); - } - - CHIP_ERROR err = CHIP_NO_ERROR; - const uint8_t __context_tag = std::get(__element); - - if (__context_tag == to_underlying(Fields::kYear)) - { - err = DataModel::Decode(reader, year); - } - else if (__context_tag == to_underlying(Fields::kMonth)) - { - err = DataModel::Decode(reader, month); - } - else if (__context_tag == to_underlying(Fields::kDay)) - { - err = DataModel::Decode(reader, day); - } - else if (__context_tag == to_underlying(Fields::kDayOfWeek)) - { - err = DataModel::Decode(reader, dayOfWeek); - } - else - { - } - - ReturnErrorOnFailure(err); - } -} - -} // namespace DateStruct - namespace ApplicationStruct { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { 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 af08033af67f69..559603845ae133 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 @@ -173,7 +173,6 @@ struct DecodableType }; } // namespace MeasurementAccuracyStruct - namespace DeviceTypeStruct { enum class Fields : uint8_t { @@ -197,35 +196,6 @@ struct Type using DecodableType = Type; } // namespace DeviceTypeStruct - -namespace DateStruct { -enum class Fields : uint8_t -{ - kYear = 0, - kMonth = 1, - kDay = 2, - kDayOfWeek = 3, -}; - -struct Type -{ -public: - DataModel::Nullable year; - DataModel::Nullable month; - DataModel::Nullable day; - DataModel::Nullable dayOfWeek; - - CHIP_ERROR Decode(TLV::TLVReader & reader); - - static constexpr bool kIsFabricScoped = false; - - CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; -}; - -using DecodableType = Type; - -} // namespace DateStruct - namespace ApplicationStruct { enum class Fields : uint8_t { diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index b2197a26196aae..91489bfd7fee76 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -327,48 +327,6 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::detail::Structs::Devic ComplexArgumentParser::Finalize(request.revision); } -CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::detail::Structs::DateStruct::Type & request, - Json::Value & value) -{ - VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); - - // Copy to track which members we already processed. - Json::Value valueCopy(value); - - ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("DateStruct.year", "year", value.isMember("year"))); - ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("DateStruct.month", "month", value.isMember("month"))); - ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("DateStruct.day", "day", value.isMember("day"))); - ReturnErrorOnFailure( - ComplexArgumentParser::EnsureMemberExist("DateStruct.dayOfWeek", "dayOfWeek", value.isMember("dayOfWeek"))); - - char labelWithMember[kMaxLabelLength]; - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "year"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.year, value["year"])); - valueCopy.removeMember("year"); - - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "month"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.month, value["month"])); - valueCopy.removeMember("month"); - - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "day"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.day, value["day"])); - valueCopy.removeMember("day"); - - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "dayOfWeek"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.dayOfWeek, value["dayOfWeek"])); - valueCopy.removeMember("dayOfWeek"); - - return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); -} - -void ComplexArgumentParser::Finalize(chip::app::Clusters::detail::Structs::DateStruct::Type & request) -{ - ComplexArgumentParser::Finalize(request.year); - ComplexArgumentParser::Finalize(request.month); - ComplexArgumentParser::Finalize(request.day); - ComplexArgumentParser::Finalize(request.dayOfWeek); -} - CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::detail::Structs::ApplicationStruct::Type & request, Json::Value & value) { diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h index f4cc3f6e33ef8a..4d05bb09f58db8 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h @@ -57,10 +57,6 @@ static CHIP_ERROR Setup(const char * label, chip::app::Clusters::detail::Structs static void Finalize(chip::app::Clusters::detail::Structs::DeviceTypeStruct::Type & request); -static CHIP_ERROR Setup(const char * label, chip::app::Clusters::detail::Structs::DateStruct::Type & request, Json::Value & value); - -static void Finalize(chip::app::Clusters::detail::Structs::DateStruct::Type & request); - static CHIP_ERROR Setup(const char * label, chip::app::Clusters::detail::Structs::ApplicationStruct::Type & request, Json::Value & value); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index 71c44431798382..964583dea1310c 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -290,47 +290,6 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } -CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, - const chip::app::Clusters::detail::Structs::DateStruct::DecodableType & value) -{ - DataModelLogger::LogString(label, indent, "{"); - { - CHIP_ERROR err = LogValue("Year", indent + 1, value.year); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Year'"); - return err; - } - } - { - CHIP_ERROR err = LogValue("Month", indent + 1, value.month); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Month'"); - return err; - } - } - { - CHIP_ERROR err = LogValue("Day", indent + 1, value.day); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Day'"); - return err; - } - } - { - CHIP_ERROR err = LogValue("DayOfWeek", indent + 1, value.dayOfWeek); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'DayOfWeek'"); - return err; - } - } - DataModelLogger::LogString(indent, "}"); - - return CHIP_NO_ERROR; -} - CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::detail::Structs::ApplicationStruct::DecodableType & value) { diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h index 5a5eaa9f211ad1..5072bfb4e4d843 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h @@ -41,9 +41,6 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::detail::Structs::DeviceTypeStruct::DecodableType & value); -static CHIP_ERROR LogValue(const char * label, size_t indent, - const chip::app::Clusters::detail::Structs::DateStruct::DecodableType & value); - static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::detail::Structs::ApplicationStruct::DecodableType & value); From c78883482d1f370000fe10a2fc028f300c319128 Mon Sep 17 00:00:00 2001 From: Mikhail Antropov Date: Mon, 16 Sep 2024 13:19:07 +0300 Subject: [PATCH 15/16] Rebase on master --- data_model/1.3/clusters/EnergyCalendar.xml | 287 ------------------ .../chip/energy-calendar-cluster.xml | 2 +- .../data_model/controller-clusters.matter | 2 +- .../chip/devicecontroller/ChipClusters.java | 30 +- .../chip/devicecontroller/ChipStructs.java | 6 +- .../structs/EnergyCalendarClusterDayStruct.kt | 8 +- .../structs/EnergyCalendarClusterDayStruct.kt | 8 +- .../python/chip/clusters/Objects.py | 1 + .../CHIP/zap-generated/MTRBaseClusters.h | 2 +- .../CHIP/zap-generated/MTRClusters.h | 2 +- .../zap-generated/attributes/Accessors.cpp | 109 ++++--- .../zap-generated/attributes/Accessors.h | 77 +++-- .../cluster/logging/DataModelLogger.cpp | 6 +- .../cluster/logging/EntryToText.cpp | 45 +++ 14 files changed, 177 insertions(+), 408 deletions(-) delete mode 100644 data_model/1.3/clusters/EnergyCalendar.xml diff --git a/data_model/1.3/clusters/EnergyCalendar.xml b/data_model/1.3/clusters/EnergyCalendar.xml deleted file mode 100644 index ce4028ac6ba7e0..00000000000000 --- a/data_model/1.3/clusters/EnergyCalendar.xml +++ /dev/null @@ -1,287 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml index f4cc7eae3a8d71..d9e0d53d99d22b 100644 --- a/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml @@ -82,7 +82,7 @@ limitations under the License. Energy Calendar 0x009A ENERGY_CALENDAR_CLUSTER - + The Energy Calendar Cluster provides a mechanism for communicating schedules associated with various forms of energy consumption true diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 65c1de69b1a83f..288c2d6af457fd 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -5437,7 +5437,7 @@ cluster EnergyEvse = 153 { timed command ClearTargets(): DefaultSuccess = 7; } -/** */ +/** The Energy Calendar Cluster provides a mechanism for communicating schedules associated with various forms of energy consumption */ cluster EnergyCalendar = 154 { revision 3; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index c0d433e67a0d90..be757382e3e212 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -32662,10 +32662,10 @@ public void onSuccess(byte[] tlv) { public static class EnergyCalendarCluster extends BaseChipCluster { public static final long CLUSTER_ID = 154L; - private static final long CALENDAR_I_D_ATTRIBUTE_ID = 0L; + private static final long CALENDAR_ID_ATTRIBUTE_ID = 0L; private static final long NAME_ATTRIBUTE_ID = 1L; - private static final long PROVIDER_I_D_ATTRIBUTE_ID = 2L; - private static final long EVENT_I_D_ATTRIBUTE_ID = 3L; + private static final long PROVIDER_ID_ATTRIBUTE_ID = 2L; + private static final long EVENT_ID_ATTRIBUTE_ID = 3L; private static final long START_DATE_ATTRIBUTE_ID = 4L; private static final long CALENDAR_PERIODS_ATTRIBUTE_ID = 5L; private static final long SPECIAL_DAYS_ATTRIBUTE_ID = 6L; @@ -32757,7 +32757,7 @@ public interface AttributeListAttributeCallback extends BaseAttributeCallback { public void readCalendarIDAttribute( CalendarIDAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CALENDAR_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CALENDAR_ID_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -32765,12 +32765,12 @@ public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, CALENDAR_I_D_ATTRIBUTE_ID, true); + }, CALENDAR_ID_ATTRIBUTE_ID, true); } public void subscribeCalendarIDAttribute( CalendarIDAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CALENDAR_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CALENDAR_ID_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -32778,7 +32778,7 @@ public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, CALENDAR_I_D_ATTRIBUTE_ID, minInterval, maxInterval); + }, CALENDAR_ID_ATTRIBUTE_ID, minInterval, maxInterval); } public void readNameAttribute( @@ -32809,7 +32809,7 @@ public void onSuccess(byte[] tlv) { public void readProviderIDAttribute( ProviderIDAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PROVIDER_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PROVIDER_ID_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -32817,12 +32817,12 @@ public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, PROVIDER_I_D_ATTRIBUTE_ID, true); + }, PROVIDER_ID_ATTRIBUTE_ID, true); } public void subscribeProviderIDAttribute( ProviderIDAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PROVIDER_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PROVIDER_ID_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -32830,12 +32830,12 @@ public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, PROVIDER_I_D_ATTRIBUTE_ID, minInterval, maxInterval); + }, PROVIDER_ID_ATTRIBUTE_ID, minInterval, maxInterval); } public void readEventIDAttribute( EventIDAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_ID_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -32843,12 +32843,12 @@ public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, EVENT_I_D_ATTRIBUTE_ID, true); + }, EVENT_ID_ATTRIBUTE_ID, true); } public void subscribeEventIDAttribute( EventIDAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_ID_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -32856,7 +32856,7 @@ public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, EVENT_I_D_ATTRIBUTE_ID, minInterval, maxInterval); + }, EVENT_ID_ATTRIBUTE_ID, minInterval, maxInterval); } public void readStartDateAttribute( diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index 4cbe6c8e2daeb1..2b0fbeaa76fe5c 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -8858,7 +8858,7 @@ public static class EnergyCalendarClusterDayStruct { private static final long DATE_ID = 0L; private static final long DAYS_OF_WEEK_ID = 1L; private static final long TRANSITIONS_ID = 2L; - private static final long CALENDAR_I_D_ID = 3L; + private static final long CALENDAR_ID_ID = 3L; public EnergyCalendarClusterDayStruct( Optional date, @@ -8877,7 +8877,7 @@ public StructType encodeTlv() { values.add(new StructElement(DATE_ID, date.map((nonOptionaldate) -> new UIntType(nonOptionaldate)).orElse(new EmptyType()))); values.add(new StructElement(DAYS_OF_WEEK_ID, daysOfWeek.map((nonOptionaldaysOfWeek) -> new UIntType(nonOptionaldaysOfWeek)).orElse(new EmptyType()))); values.add(new StructElement(TRANSITIONS_ID, ArrayType.generateArrayType(transitions, (elementtransitions) -> elementtransitions.encodeTlv()))); - values.add(new StructElement(CALENDAR_I_D_ID, calendarID.map((nonOptionalcalendarID) -> new UIntType(nonOptionalcalendarID)).orElse(new EmptyType()))); + values.add(new StructElement(CALENDAR_ID_ID, calendarID.map((nonOptionalcalendarID) -> new UIntType(nonOptionalcalendarID)).orElse(new EmptyType()))); return new StructType(values); } @@ -8906,7 +8906,7 @@ public static EnergyCalendarClusterDayStruct decodeTlv(BaseTLVType tlvValue) { ArrayType castingValue = element.value(ArrayType.class); transitions = castingValue.map((elementcastingValue) -> ChipStructs.EnergyCalendarClusterTransitionStruct.decodeTlv(elementcastingValue)); } - } else if (element.contextTagNum() == CALENDAR_I_D_ID) { + } else if (element.contextTagNum() == CALENDAR_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); calendarID = Optional.of(castingValue.value(Long.class)); diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt index 0520e76669c8ea..12b7b7be6cb234 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt @@ -57,7 +57,7 @@ class EnergyCalendarClusterDayStruct( endArray() if (calendarID.isPresent) { val optcalendarID = calendarID.get() - put(ContextSpecificTag(TAG_CALENDAR_I_D), optcalendarID) + put(ContextSpecificTag(TAG_CALENDAR_ID), optcalendarID) } endStructure() } @@ -67,7 +67,7 @@ class EnergyCalendarClusterDayStruct( private const val TAG_DATE = 0 private const val TAG_DAYS_OF_WEEK = 1 private const val TAG_TRANSITIONS = 2 - private const val TAG_CALENDAR_I_D = 3 + private const val TAG_CALENDAR_ID = 3 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyCalendarClusterDayStruct { tlvReader.enterStructure(tlvTag) @@ -92,8 +92,8 @@ class EnergyCalendarClusterDayStruct( tlvReader.exitContainer() } val calendarID = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_CALENDAR_I_D))) { - Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_CALENDAR_I_D))) + if (tlvReader.isNextTag(ContextSpecificTag(TAG_CALENDAR_ID))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_CALENDAR_ID))) } else { Optional.empty() } diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt index a45936a14060d9..18e420a49c5e98 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt @@ -57,7 +57,7 @@ class EnergyCalendarClusterDayStruct( endArray() if (calendarID.isPresent) { val optcalendarID = calendarID.get() - put(ContextSpecificTag(TAG_CALENDAR_I_D), optcalendarID) + put(ContextSpecificTag(TAG_CALENDAR_ID), optcalendarID) } endStructure() } @@ -67,7 +67,7 @@ class EnergyCalendarClusterDayStruct( private const val TAG_DATE = 0 private const val TAG_DAYS_OF_WEEK = 1 private const val TAG_TRANSITIONS = 2 - private const val TAG_CALENDAR_I_D = 3 + private const val TAG_CALENDAR_ID = 3 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyCalendarClusterDayStruct { tlvReader.enterStructure(tlvTag) @@ -92,8 +92,8 @@ class EnergyCalendarClusterDayStruct( tlvReader.exitContainer() } val calendarID = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_CALENDAR_I_D))) { - Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_CALENDAR_I_D))) + if (tlvReader.isNextTag(ContextSpecificTag(TAG_CALENDAR_ID))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_CALENDAR_ID))) } else { Optional.empty() } diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 600b81c938d93e..6fda1bbbc1b87b 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -109,6 +109,7 @@ "Messages", "DeviceEnergyManagement", "EnergyEvse", + "EnergyCalendar", "EnergyPreference", "PowerTopology", "EnergyEvseMode", diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index 4f616a4df4e248..fb0e7d077c381c 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -8135,7 +8135,7 @@ MTR_PROVISIONALLY_AVAILABLE /** * Cluster Energy Calendar * - * + * The Energy Calendar Cluster provides a mechanism for communicating schedules associated with various forms of energy consumption */ MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterEnergyCalendar : MTRGenericBaseCluster diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index 82c1dcd3a985c0..0c863856f25e7f 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -3796,7 +3796,7 @@ MTR_PROVISIONALLY_AVAILABLE /** * Cluster Energy Calendar - * + * The Energy Calendar Cluster provides a mechanism for communicating schedules associated with various forms of energy consumption */ MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterEnergyCalendar : MTRGenericCluster diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp index 0bc56ae52cc1f7..154708267e253a 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp @@ -15258,7 +15258,7 @@ namespace Attributes { namespace CalendarID { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value) +Protocols::InteractionModel::Status Get(EndpointId endpoint, DataModel::Nullable & value) { using Traits = NumericAttributeTraits; Traits::StorageType temp; @@ -15277,7 +15277,7 @@ Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nu return status; } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty) +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty) { using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) @@ -15287,10 +15287,11 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t valu Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_INT32U_ATTRIBUTE_TYPE, markDirty); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::EnergyCalendar::Id, Id), + EmberAfWriteDataInput(writable, ZCL_INT32U_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value) +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value) { using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) @@ -15303,16 +15304,17 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t valu return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_INT32U_ATTRIBUTE_TYPE); } -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty) +Protocols::InteractionModel::Status SetNull(EndpointId endpoint, MarkAttributeDirty markDirty) { using Traits = NumericAttributeTraits; Traits::StorageType value; Traits::SetNull(value); uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_INT32U_ATTRIBUTE_TYPE, markDirty); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::EnergyCalendar::Id, Id), + EmberAfWriteDataInput(writable, ZCL_INT32U_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); } -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) +Protocols::InteractionModel::Status SetNull(EndpointId endpoint) { using Traits = NumericAttributeTraits; Traits::StorageType value; @@ -15321,7 +15323,7 @@ Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_INT32U_ATTRIBUTE_TYPE); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, +Protocols::InteractionModel::Status Set(EndpointId endpoint, const chip::app::DataModel::Nullable & value, MarkAttributeDirty markDirty) { if (value.IsNull()) @@ -15332,7 +15334,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::a return Set(endpoint, value.Value(), markDirty); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) +Protocols::InteractionModel::Status Set(EndpointId endpoint, const chip::app::DataModel::Nullable & value) { if (value.IsNull()) { @@ -15346,7 +15348,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::a namespace Name { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value) +Protocols::InteractionModel::Status Get(EndpointId endpoint, DataModel::Nullable & value) { if (value.IsNull()) { @@ -15372,7 +15374,7 @@ Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nu return status; } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::CharSpan value, MarkAttributeDirty markDirty) +Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::CharSpan value, MarkAttributeDirty markDirty) { static_assert(12 < NumericAttributeTraits::kNullValue, "value.size() might be too big"); @@ -15381,10 +15383,11 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::CharSpa auto length = static_cast(value.size()); Encoding::Put8(zclString, length); memcpy(&zclString[1], value.data(), value.size()); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE, markDirty); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::EnergyCalendar::Id, Id), + EmberAfWriteDataInput(zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::CharSpan value) +Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::CharSpan value) { static_assert(12 < NumericAttributeTraits::kNullValue, "value.size() might be too big"); @@ -15396,19 +15399,20 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::CharSpa return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE); } -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty) +Protocols::InteractionModel::Status SetNull(EndpointId endpoint, MarkAttributeDirty markDirty) { uint8_t zclString[1] = { 0xFF }; - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE, markDirty); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::EnergyCalendar::Id, Id), + EmberAfWriteDataInput(zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); } -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) +Protocols::InteractionModel::Status SetNull(EndpointId endpoint) { uint8_t zclString[1] = { 0xFF }; return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, +Protocols::InteractionModel::Status Set(EndpointId endpoint, const chip::app::DataModel::Nullable & value, MarkAttributeDirty markDirty) { if (value.IsNull()) @@ -15419,7 +15423,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::a return Set(endpoint, value.Value(), markDirty); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) +Protocols::InteractionModel::Status Set(EndpointId endpoint, const chip::app::DataModel::Nullable & value) { if (value.IsNull()) { @@ -15433,7 +15437,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::a namespace ProviderID { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value) +Protocols::InteractionModel::Status Get(EndpointId endpoint, DataModel::Nullable & value) { using Traits = NumericAttributeTraits; Traits::StorageType temp; @@ -15452,7 +15456,7 @@ Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nu return status; } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty) +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty) { using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) @@ -15462,10 +15466,11 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t valu Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_INT32U_ATTRIBUTE_TYPE, markDirty); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::EnergyCalendar::Id, Id), + EmberAfWriteDataInput(writable, ZCL_INT32U_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value) +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value) { using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) @@ -15478,16 +15483,17 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t valu return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_INT32U_ATTRIBUTE_TYPE); } -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty) +Protocols::InteractionModel::Status SetNull(EndpointId endpoint, MarkAttributeDirty markDirty) { using Traits = NumericAttributeTraits; Traits::StorageType value; Traits::SetNull(value); uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_INT32U_ATTRIBUTE_TYPE, markDirty); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::EnergyCalendar::Id, Id), + EmberAfWriteDataInput(writable, ZCL_INT32U_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); } -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) +Protocols::InteractionModel::Status SetNull(EndpointId endpoint) { using Traits = NumericAttributeTraits; Traits::StorageType value; @@ -15496,7 +15502,7 @@ Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_INT32U_ATTRIBUTE_TYPE); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, +Protocols::InteractionModel::Status Set(EndpointId endpoint, const chip::app::DataModel::Nullable & value, MarkAttributeDirty markDirty) { if (value.IsNull()) @@ -15507,7 +15513,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::a return Set(endpoint, value.Value(), markDirty); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) +Protocols::InteractionModel::Status Set(EndpointId endpoint, const chip::app::DataModel::Nullable & value) { if (value.IsNull()) { @@ -15521,7 +15527,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::a namespace EventID { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value) +Protocols::InteractionModel::Status Get(EndpointId endpoint, DataModel::Nullable & value) { using Traits = NumericAttributeTraits; Traits::StorageType temp; @@ -15540,7 +15546,7 @@ Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nu return status; } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty) +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty) { using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) @@ -15550,10 +15556,11 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t valu Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_INT32U_ATTRIBUTE_TYPE, markDirty); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::EnergyCalendar::Id, Id), + EmberAfWriteDataInput(writable, ZCL_INT32U_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value) +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value) { using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) @@ -15566,16 +15573,17 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t valu return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_INT32U_ATTRIBUTE_TYPE); } -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty) +Protocols::InteractionModel::Status SetNull(EndpointId endpoint, MarkAttributeDirty markDirty) { using Traits = NumericAttributeTraits; Traits::StorageType value; Traits::SetNull(value); uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_INT32U_ATTRIBUTE_TYPE, markDirty); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::EnergyCalendar::Id, Id), + EmberAfWriteDataInput(writable, ZCL_INT32U_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); } -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) +Protocols::InteractionModel::Status SetNull(EndpointId endpoint) { using Traits = NumericAttributeTraits; Traits::StorageType value; @@ -15584,7 +15592,7 @@ Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_INT32U_ATTRIBUTE_TYPE); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, +Protocols::InteractionModel::Status Set(EndpointId endpoint, const chip::app::DataModel::Nullable & value, MarkAttributeDirty markDirty) { if (value.IsNull()) @@ -15595,7 +15603,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::a return Set(endpoint, value.Value(), markDirty); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) +Protocols::InteractionModel::Status Set(EndpointId endpoint, const chip::app::DataModel::Nullable & value) { if (value.IsNull()) { @@ -15609,7 +15617,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::a namespace StartDate { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value) +Protocols::InteractionModel::Status Get(EndpointId endpoint, DataModel::Nullable & value) { using Traits = NumericAttributeTraits; Traits::StorageType temp; @@ -15628,7 +15636,7 @@ Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nu return status; } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty) +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty) { using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) @@ -15638,10 +15646,11 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t valu Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_EPOCH_S_ATTRIBUTE_TYPE, markDirty); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::EnergyCalendar::Id, Id), + EmberAfWriteDataInput(writable, ZCL_EPOCH_S_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value) +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value) { using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) @@ -15654,16 +15663,17 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t valu return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_EPOCH_S_ATTRIBUTE_TYPE); } -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty) +Protocols::InteractionModel::Status SetNull(EndpointId endpoint, MarkAttributeDirty markDirty) { using Traits = NumericAttributeTraits; Traits::StorageType value; Traits::SetNull(value); uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_EPOCH_S_ATTRIBUTE_TYPE, markDirty); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::EnergyCalendar::Id, Id), + EmberAfWriteDataInput(writable, ZCL_EPOCH_S_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); } -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) +Protocols::InteractionModel::Status SetNull(EndpointId endpoint) { using Traits = NumericAttributeTraits; Traits::StorageType value; @@ -15672,7 +15682,7 @@ Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_EPOCH_S_ATTRIBUTE_TYPE); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, +Protocols::InteractionModel::Status Set(EndpointId endpoint, const chip::app::DataModel::Nullable & value, MarkAttributeDirty markDirty) { if (value.IsNull()) @@ -15683,7 +15693,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::a return Set(endpoint, value.Value(), markDirty); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) +Protocols::InteractionModel::Status Set(EndpointId endpoint, const chip::app::DataModel::Nullable & value) { if (value.IsNull()) { @@ -15697,7 +15707,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::a namespace ClusterRevision { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * value) +Protocols::InteractionModel::Status Get(EndpointId endpoint, uint16_t * value) { using Traits = NumericAttributeTraits; Traits::StorageType temp; @@ -15713,7 +15723,7 @@ Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * va return status; } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty) +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty) { using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) @@ -15723,10 +15733,11 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t valu Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyCalendar::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE, markDirty); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::EnergyCalendar::Id, Id), + EmberAfWriteDataInput(writable, ZCL_INT16U_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value) +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value) { using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h index 81b51b4e4f6f38..bf2f94e505a94d 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h @@ -2467,65 +2467,64 @@ namespace EnergyCalendar { namespace Attributes { namespace CalendarID { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value); // int32u -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty); -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint); -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, +Protocols::InteractionModel::Status Get(EndpointId endpoint, DataModel::Nullable & value); // int32u +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value); +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status SetNull(EndpointId endpoint); +Protocols::InteractionModel::Status SetNull(EndpointId endpoint, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status Set(EndpointId endpoint, const chip::app::DataModel::Nullable & value); +Protocols::InteractionModel::Status Set(EndpointId endpoint, const chip::app::DataModel::Nullable & value, MarkAttributeDirty markDirty); } // namespace CalendarID namespace Name { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, - DataModel::Nullable & value); // char_string -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::CharSpan value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::CharSpan value, MarkAttributeDirty markDirty); -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint); -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, +Protocols::InteractionModel::Status Get(EndpointId endpoint, DataModel::Nullable & value); // char_string +Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::CharSpan value); +Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::CharSpan value, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status SetNull(EndpointId endpoint); +Protocols::InteractionModel::Status SetNull(EndpointId endpoint, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status Set(EndpointId endpoint, const chip::app::DataModel::Nullable & value); +Protocols::InteractionModel::Status Set(EndpointId endpoint, const chip::app::DataModel::Nullable & value, MarkAttributeDirty markDirty); } // namespace Name namespace ProviderID { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value); // int32u -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty); -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint); -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, +Protocols::InteractionModel::Status Get(EndpointId endpoint, DataModel::Nullable & value); // int32u +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value); +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status SetNull(EndpointId endpoint); +Protocols::InteractionModel::Status SetNull(EndpointId endpoint, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status Set(EndpointId endpoint, const chip::app::DataModel::Nullable & value); +Protocols::InteractionModel::Status Set(EndpointId endpoint, const chip::app::DataModel::Nullable & value, MarkAttributeDirty markDirty); } // namespace ProviderID namespace EventID { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value); // int32u -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty); -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint); -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, +Protocols::InteractionModel::Status Get(EndpointId endpoint, DataModel::Nullable & value); // int32u +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value); +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status SetNull(EndpointId endpoint); +Protocols::InteractionModel::Status SetNull(EndpointId endpoint, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status Set(EndpointId endpoint, const chip::app::DataModel::Nullable & value); +Protocols::InteractionModel::Status Set(EndpointId endpoint, const chip::app::DataModel::Nullable & value, MarkAttributeDirty markDirty); } // namespace EventID namespace StartDate { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value); // epoch_s -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty); -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint); -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, +Protocols::InteractionModel::Status Get(EndpointId endpoint, DataModel::Nullable & value); // epoch_s +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value); +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status SetNull(EndpointId endpoint); +Protocols::InteractionModel::Status SetNull(EndpointId endpoint, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status Set(EndpointId endpoint, const chip::app::DataModel::Nullable & value); +Protocols::InteractionModel::Status Set(EndpointId endpoint, const chip::app::DataModel::Nullable & value, MarkAttributeDirty markDirty); } // namespace StartDate namespace ClusterRevision { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * value); // int16u -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status Get(EndpointId endpoint, uint16_t * value); // int16u +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value); +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty); } // namespace ClusterRevision } // namespace Attributes diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index 964583dea1310c..e769b297b36668 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -14123,12 +14123,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case EnergyCalendar::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, EnergyCalendar::Id); } case EnergyCalendar::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, EnergyCalendar::Id); } case EnergyCalendar::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -14138,7 +14138,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case EnergyCalendar::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, EnergyCalendar::Id); } case EnergyCalendar::Attributes::FeatureMap::Id: { uint32_t value; diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp index 73c5f1ef371fa5..ff3796e5b85758 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp @@ -165,6 +165,8 @@ char const * ClusterIdToText(chip::ClusterId id) return "DeviceEnergyManagement"; case chip::app::Clusters::EnergyEvse::Id: return "EnergyEvse"; + case chip::app::Clusters::EnergyCalendar::Id: + return "EnergyCalendar"; case chip::app::Clusters::EnergyPreference::Id: return "EnergyPreference"; case chip::app::Clusters::PowerTopology::Id: @@ -2564,6 +2566,49 @@ char const * AttributeIdToText(chip::ClusterId cluster, chip::AttributeId id) return "Unknown"; } } + case chip::app::Clusters::EnergyCalendar::Id: { + switch (id) + { + case chip::app::Clusters::EnergyCalendar::Attributes::CalendarID::Id: + return "CalendarID"; + case chip::app::Clusters::EnergyCalendar::Attributes::Name::Id: + return "Name"; + case chip::app::Clusters::EnergyCalendar::Attributes::ProviderID::Id: + return "ProviderID"; + case chip::app::Clusters::EnergyCalendar::Attributes::EventID::Id: + return "EventID"; + case chip::app::Clusters::EnergyCalendar::Attributes::StartDate::Id: + return "StartDate"; + case chip::app::Clusters::EnergyCalendar::Attributes::CalendarPeriods::Id: + return "CalendarPeriods"; + case chip::app::Clusters::EnergyCalendar::Attributes::SpecialDays::Id: + return "SpecialDays"; + case chip::app::Clusters::EnergyCalendar::Attributes::CurrentDay::Id: + return "CurrentDay"; + case chip::app::Clusters::EnergyCalendar::Attributes::NextDay::Id: + return "NextDay"; + case chip::app::Clusters::EnergyCalendar::Attributes::CurrentTransition::Id: + return "CurrentTransition"; + case chip::app::Clusters::EnergyCalendar::Attributes::CurrentPeakPeriod::Id: + return "CurrentPeakPeriod"; + case chip::app::Clusters::EnergyCalendar::Attributes::NextPeakPeriod::Id: + return "NextPeakPeriod"; + case chip::app::Clusters::EnergyCalendar::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::EnergyCalendar::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::EnergyCalendar::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::EnergyCalendar::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::EnergyCalendar::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::EnergyCalendar::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } case chip::app::Clusters::EnergyPreference::Id: { switch (id) { From 6814438bd6e0ee880f10c9c732d975ddac8326ae Mon Sep 17 00:00:00 2001 From: Mikhail Antropov Date: Fri, 20 Sep 2024 16:15:37 +0300 Subject: [PATCH 16/16] Rebase on master --- src/app/zap_cluster_list.json | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/app/zap_cluster_list.json b/src/app/zap_cluster_list.json index 053afb7adbdec3..0beffd37128c37 100644 --- a/src/app/zap_cluster_list.json +++ b/src/app/zap_cluster_list.json @@ -132,8 +132,7 @@ "WATER_HEATER_MANAGEMENT_CLUSTER": [], "WATER_HEATER_MODE_CLUSTER": [], "WIFI_NETWORK_DIAGNOSTICS_CLUSTER": [], - "WINDOW_COVERING_CLUSTER": [], - "ENERGY_CALENDAR_CLUSTER": [], + "WINDOW_COVERING_CLUSTER": [] }, "ServerDirectories": { "ACCESS_CONTROL_CLUSTER": ["access-control-server"], @@ -180,7 +179,7 @@ "DIAGNOSTIC_LOGS_CLUSTER": ["diagnostic-logs-server"], "DISHWASHER_ALARM_CLUSTER": ["dishwasher-alarm-server"], "DISHWASHER_MODE_CLUSTER": ["mode-base-server"], - "ENERGY_CALENDAR_CLUSTER": [], + "ENERGY_CALENDAR_CLUSTER": ["energy-calendar-server"], "MICROWAVE_OVEN_MODE_CLUSTER": ["mode-base-server"], "DOOR_LOCK_CLUSTER": ["door-lock-server"], "ECOSYSTEM_INFORMATION_CLUSTER": ["ecosystem-information-server"], @@ -316,7 +315,5 @@ "WINDOW_COVERING_CLUSTER": ["window-covering-server"], "WATER_HEATER_MANAGEMENT_CLUSTER": ["water-heater-management-server"], "WATER_HEATER_MODE_CLUSTER": ["mode-base-server"] - "ENERGY_CALENDAR_CLUSTER": ["energy-calendar-server"], - "ZLL_COMMISSIONING_CLUSTER": [] } }