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/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/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/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..d9e0d53d99d22b --- /dev/null +++ b/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Energy Management + Energy Calendar + 0x009A + ENERGY_CALENDAR_CLUSTER + The Energy Calendar Cluster provides a mechanism for communicating schedules associated with various forms of energy consumption + true + + + + + + + + + + + + + + + true + + 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..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", @@ -659,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"], diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index db4526e39cbbde..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", @@ -653,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"], diff --git a/src/app/zap_cluster_list.json b/src/app/zap_cluster_list.json index a047340147ece5..0beffd37128c37 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": [], @@ -178,6 +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-server"], "MICROWAVE_OVEN_MODE_CLUSTER": ["mode-base-server"], "DOOR_LOCK_CLUSTER": ["door-lock-server"], "ECOSYSTEM_INFORMATION_CLUSTER": ["ecosystem-information-server"], diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 1ba56719ab4549..288c2d6af457fd 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -5437,6 +5437,91 @@ 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; + + 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 DayStruct { + optional epoch_s date = 0; + optional TransitionDayOfWeekBitmap daysOfWeek = 1; + TransitionStruct transitions[] = 2; + optional int32u calendarID = 3; + } + + struct CalendarPeriodStruct { + nullable epoch_s startDate = 0; + DayStruct days[] = 1; + } + + struct PeakPeriodStruct { + PeakPeriodSeverityEnum severity = 0; + int16u peakPeriod = 1; + nullable epoch_s startTime = 2; + nullable 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 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; + 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; + 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/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index 2ce04c328ded6f..be757382e3e212 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_ID_ATTRIBUTE_ID = 0L; + private static final long NAME_ATTRIBUTE_ID = 1L; + 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; + 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(@Nullable List value); + } + + public interface SpecialDaysAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable 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_ID_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CALENDAR_ID_ATTRIBUTE_ID, true); + } + + public void subscribeCalendarIDAttribute( + CalendarIDAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CALENDAR_ID_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CALENDAR_ID_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_ID_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, PROVIDER_ID_ATTRIBUTE_ID, true); + } + + public void subscribeProviderIDAttribute( + ProviderIDAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PROVIDER_ID_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, PROVIDER_ID_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readEventIDAttribute( + EventIDAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_ID_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, EVENT_ID_ATTRIBUTE_ID, true); + } + + public void subscribeEventIDAttribute( + EventIDAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_ID_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, EVENT_ID_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) { + @Nullable 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) { + @Nullable 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) { + @Nullable 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) { + @Nullable 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..2b0fbeaa76fe5c 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -8759,6 +8759,340 @@ 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 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_ID_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) -> 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_ID_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.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) { + 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_ID_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 EnergyCalendarClusterCalendarPeriodStruct { + public @Nullable Long startDate; + public ArrayList days; + private static final long START_DATE_ID = 0L; + private static final long DAYS_ID = 1L; + + public EnergyCalendarClusterCalendarPeriodStruct( + @Nullable Long startDate, + ArrayList days + ) { + this.startDate = startDate; + this.days = days; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + 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 EnergyCalendarClusterCalendarPeriodStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + @Nullable 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 EnergyCalendarClusterCalendarPeriodStruct( + startDate, + days + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("EnergyCalendarClusterCalendarPeriodStruct {\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 @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; + private static final long END_TIME_ID = 3L; + + public EnergyCalendarClusterPeakPeriodStruct( + Integer severity, + Integer peakPeriod, + @Nullable Long startTime, + @Nullable 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, 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); + } + + public static EnergyCalendarClusterPeakPeriodStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Integer severity = null; + Integer peakPeriod = 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) { + 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..8e2e2efcad8095 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(@Nullable 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(@Nullable 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..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,6 +71,10 @@ 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/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", "${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/EnergyCalendarClusterCalendarPeriodStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterCalendarPeriodStruct.kt new file mode 100644 index 00000000000000..33496767f70b5f --- /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 new file mode 100644 index 00000000000000..12b7b7be6cb234 --- /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() + put(ContextSpecificTag(TAG_DATE), optdate) + } + 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_ID), 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_ID = 3 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyCalendarClusterDayStruct { + tlvReader.enterStructure(tlvTag) + val date = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DATE))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_DATE))) + } 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_ID))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_CALENDAR_ID))) + } 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..c14d78bf9cff5b --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt @@ -0,0 +1,89 @@ +/* + * + * 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) + 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() + } + } + + 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 = + 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() + + 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..42cb66acd89939 --- /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..182eafbb889c9e --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyCalendarCluster.kt @@ -0,0 +1,1924 @@ +/* + * + * 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? = + if (!tlvReader.isNull()) { + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(EnergyCalendarClusterCalendarPeriodStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + 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? = + if (!tlvReader.isNull()) { + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(EnergyCalendarClusterCalendarPeriodStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(CalendarPeriodsAttributeSubscriptionState.Success(it)) } + } + 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? = + if (!tlvReader.isNull()) { + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(EnergyCalendarClusterDayStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + 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? = + if (!tlvReader.isNull()) { + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(EnergyCalendarClusterDayStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(SpecialDaysAttributeSubscriptionState.Success(it)) } + } + 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()) { + if (tlvReader.isNextTag(AnonymousTag)) { + EnergyCalendarClusterPeakPeriodStruct.fromTlv(AnonymousTag, tlvReader) + } else { + null + } + } 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()) { + if (tlvReader.isNextTag(AnonymousTag)) { + EnergyCalendarClusterPeakPeriodStruct.fromTlv(AnonymousTag, tlvReader) + } else { + null + } + } 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()) { + if (tlvReader.isNextTag(AnonymousTag)) { + EnergyCalendarClusterPeakPeriodStruct.fromTlv(AnonymousTag, tlvReader) + } else { + null + } + } 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()) { + if (tlvReader.isNextTag(AnonymousTag)) { + EnergyCalendarClusterPeakPeriodStruct.fromTlv(AnonymousTag, tlvReader) + } else { + null + } + } 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..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,6 +71,10 @@ 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/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", "${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 +287,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/EnergyCalendarClusterCalendarPeriodStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterCalendarPeriodStruct.kt new file mode 100644 index 00000000000000..a18bcbe8891118 --- /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 new file mode 100644 index 00000000000000..18e420a49c5e98 --- /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() + put(ContextSpecificTag(TAG_DATE), optdate) + } + 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_ID), 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_ID = 3 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyCalendarClusterDayStruct { + tlvReader.enterStructure(tlvTag) + val date = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DATE))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_DATE))) + } 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_ID))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_CALENDAR_ID))) + } 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..b12465d88c55f4 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt @@ -0,0 +1,89 @@ +/* + * + * 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) + 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() + } + } + + 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 = + 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() + + 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..57a0db6559ee93 --- /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..5aa0af60b4a9bb 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -24953,6 +24953,1334 @@ 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; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_1 = cppValue.Value().begin(); + while (iter_value_1.Next()) + { + auto & entry_1 = iter_value_1.GetValue(); + jobject newElement_1; + jobject newElement_1_startDate; + if (entry_1.startDate.IsNull()) + { + newElement_1_startDate = nullptr; + } + else + { + 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_3_date); + } + 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); + chip::JniReferences::GetInstance().CreateOptional(newElement_3_dateInsideOptional, newElement_3_date); + } + jobject newElement_3_daysOfWeek; + if (!entry_3.daysOfWeek.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_3_daysOfWeek); + } + else + { + 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()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_5_priceTier); + } + else + { + 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); + } + jobject newElement_5_friendlyCredit; + if (!entry_5.friendlyCredit.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_5_friendlyCredit); + } + else + { + 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); + } + jobject newElement_5_auxiliaryLoad; + if (!entry_5.auxiliaryLoad.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_5_auxiliaryLoad); + } + else + { + 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_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); + } + + 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; + } + + 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; + } + + 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_3_calendarID; + if (!entry_3.calendarID.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_3_calendarID); + } + else + { + 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 dayStructStructClass_4; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterDayStruct", dayStructStructClass_4); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterDayStruct"); + return nullptr; + } + + jmethodID dayStructStructCtor_4; + err = chip::JniReferences::GetInstance().FindMethod( + 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$EnergyCalendarClusterDayStruct constructor"); + return nullptr; + } + + 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 calendarPeriodStructStructClass_2; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterCalendarPeriodStruct", + calendarPeriodStructStructClass_2); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterCalendarPeriodStruct"); + return 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$EnergyCalendarClusterCalendarPeriodStruct constructor"); + return nullptr; + } + + newElement_1 = env->NewObject(calendarPeriodStructStructClass_2, calendarPeriodStructStructCtor_2, + newElement_1_startDate, newElement_1_days); + chip::JniReferences::GetInstance().AddToList(value, newElement_1); + } + } + 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; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_1 = cppValue.Value().begin(); + while (iter_value_1.Next()) + { + 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_1_date); + } + 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); + chip::JniReferences::GetInstance().CreateOptional(newElement_1_dateInsideOptional, newElement_1_date); + } + jobject newElement_1_daysOfWeek; + if (!entry_1.daysOfWeek.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_1_daysOfWeek); + } + else + { + 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()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_3_priceTier); + } + else + { + 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); + } + jobject newElement_3_friendlyCredit; + if (!entry_3.friendlyCredit.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_3_friendlyCredit); + } + else + { + 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); + } + jobject newElement_3_auxiliaryLoad; + if (!entry_3.auxiliaryLoad.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_3_auxiliaryLoad); + } + else + { + 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_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); + } + + 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; + } + + 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; + } + + 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_1_calendarID; + if (!entry_1.calendarID.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_1_calendarID); + } + else + { + 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 dayStructStructClass_2; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterDayStruct", dayStructStructClass_2); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterDayStruct"); + return nullptr; + } + + jmethodID dayStructStructCtor_2; + err = chip::JniReferences::GetInstance().FindMethod( + 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$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); + } + } + 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; + 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; + 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; + 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; + 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; + 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; + 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( + 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; + 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; + 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( + 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/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..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", @@ -26569,6 +26570,446 @@ 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.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]), + 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]), + 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.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 + 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 + 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 an unknown + # enum value. This specific value 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 DayStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + 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[uint]' = None + daysOfWeek: 'typing.Optional[uint]' = None + transitions: 'typing.List[EnergyCalendar.Structs.TransitionStruct]' = field(default_factory=lambda: []) + calendarID: 'typing.Optional[uint]' = None + + @dataclass + class CalendarPeriodStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="startDate", Tag=0, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="days", Tag=1, Type=typing.List[EnergyCalendar.Structs.DayStruct]), + ]) + + startDate: 'typing.Union[Nullable, uint]' = NullValue + 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=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="endTime", Tag=3, Type=typing.Union[Nullable, uint]), + ]) + + severity: 'EnergyCalendar.Enums.PeakPeriodSeverityEnum' = 0 + peakPeriod: 'uint' = 0 + startTime: 'typing.Union[Nullable, uint]' = NullValue + endTime: 'typing.Union[Nullable, uint]' = NullValue + + 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.Union[Nullable, typing.List[EnergyCalendar.Structs.CalendarPeriodStruct]]) + + value: 'typing.Union[Nullable, typing.List[EnergyCalendar.Structs.CalendarPeriodStruct]]' = NullValue + + @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.Union[Nullable, typing.List[EnergyCalendar.Structs.DayStruct]]) + + value: 'typing.Union[Nullable, typing.List[EnergyCalendar.Structs.DayStruct]]' = NullValue + + @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[None, Nullable, EnergyCalendar.Structs.PeakPeriodStruct]) + + value: 'typing.Union[None, Nullable, EnergyCalendar.Structs.PeakPeriodStruct]' = None + + @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[None, Nullable, EnergyCalendar.Structs.PeakPeriodStruct]) + + value: 'typing.Union[None, Nullable, EnergyCalendar.Structs.PeakPeriodStruct]' = None + + @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/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..207d6edd3d0ae7 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -9520,6 +9520,482 @@ 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 * _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_3.date = nil; + } + if (entry_3.daysOfWeek.HasValue()) { + newElement_3.daysOfWeek = [NSNumber numberWithUnsignedChar:entry_3.daysOfWeek.Value().Raw()]; + } else { + newElement_3.daysOfWeek = 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]; + } + CHIP_ERROR err = iter_5.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + newElement_3.transitions = array_5; + } + if (entry_3.calendarID.HasValue()) { + newElement_3.calendarID = [NSNumber numberWithUnsignedInt:entry_3.calendarID.Value()]; + } else { + newElement_3.calendarID = nil; + } + [array_3 addObject:newElement_3]; + } + CHIP_ERROR err = iter_3.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + newElement_1.days = array_3; + } + [array_1 addObject:newElement_1]; + } + CHIP_ERROR err = iter_1.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_1; + } + } + 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 * _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_1.date = nil; + } + if (entry_1.daysOfWeek.HasValue()) { + newElement_1.daysOfWeek = [NSNumber numberWithUnsignedChar:entry_1.daysOfWeek.Value().Raw()]; + } else { + newElement_1.daysOfWeek = 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]; + } + CHIP_ERROR err = iter_3.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + newElement_1.transitions = array_3; + } + if (entry_1.calendarID.HasValue()) { + newElement_1.calendarID = [NSNumber numberWithUnsignedInt:entry_1.calendarID.Value()]; + } else { + newElement_1.calendarID = nil; + } + [array_1 addObject:newElement_1]; + } + CHIP_ERROR err = iter_1.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_1; + } + } + 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 = [NSNumber numberWithUnsignedInt:cppValue.Value().date.Value()]; + } 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 = [NSNumber numberWithUnsignedInt:cppValue.Value().date.Value()]; + } 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]; + 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; + } + 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]; + 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; + } + 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 +19343,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..fb0e7d077c381c 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..93e5e4f50e93a8 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,89 @@ } 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; + } + break; + case MTRClusterIDTypeEnergyPreferenceID: switch (attributeID) { @@ -9702,6 +9788,16 @@ } break; + case MTRClusterIDTypeEnergyCalendarID: + + switch (eventID) { + + default: + result = [NSString stringWithFormat:@"", eventID]; + break; + } + break; + case MTRClusterIDTypeEnergyPreferenceID: switch (eventID) { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index 3a761fa7054192..0c863856f25e7f 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..9b3e921582549d 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -1508,6 +1508,36 @@ 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 MTREnergyCalendarClusterDayStruct : NSObject +@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 MTREnergyCalendarClusterCalendarPeriodStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nullable 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 * _Nullable startTime MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable 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..8a1a54c6113a12 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -6265,6 +6265,144 @@ - (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 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 MTREnergyCalendarClusterCalendarPeriodStruct +- (instancetype)init +{ + if (self = [super init]) { + + _startDate = nil; + + _days = [NSArray array]; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTREnergyCalendarClusterCalendarPeriodStruct 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 = nil; + + _endTime = nil; + } + 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 { 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..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 @@ -15253,6 +15253,508 @@ Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value) } // namespace Attributes } // namespace EnergyEvse +namespace EnergyCalendar { +namespace Attributes { + +namespace CalendarID { + +Protocols::InteractionModel::Status Get(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(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(ConcreteAttributePath(endpoint, Clusters::EnergyCalendar::Id, Id), + EmberAfWriteDataInput(writable, ZCL_INT32U_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); +} + +Protocols::InteractionModel::Status Set(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(EndpointId endpoint, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::EnergyCalendar::Id, Id), + EmberAfWriteDataInput(writable, ZCL_INT32U_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); +} + +Protocols::InteractionModel::Status SetNull(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(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(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(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(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(ConcreteAttributePath(endpoint, Clusters::EnergyCalendar::Id, Id), + EmberAfWriteDataInput(zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); +} + +Protocols::InteractionModel::Status Set(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(EndpointId endpoint, MarkAttributeDirty markDirty) +{ + uint8_t zclString[1] = { 0xFF }; + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::EnergyCalendar::Id, Id), + EmberAfWriteDataInput(zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); +} + +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(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(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(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(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(ConcreteAttributePath(endpoint, Clusters::EnergyCalendar::Id, Id), + EmberAfWriteDataInput(writable, ZCL_INT32U_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); +} + +Protocols::InteractionModel::Status Set(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(EndpointId endpoint, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::EnergyCalendar::Id, Id), + EmberAfWriteDataInput(writable, ZCL_INT32U_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); +} + +Protocols::InteractionModel::Status SetNull(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(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(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(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(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(ConcreteAttributePath(endpoint, Clusters::EnergyCalendar::Id, Id), + EmberAfWriteDataInput(writable, ZCL_INT32U_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); +} + +Protocols::InteractionModel::Status Set(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(EndpointId endpoint, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::EnergyCalendar::Id, Id), + EmberAfWriteDataInput(writable, ZCL_INT32U_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); +} + +Protocols::InteractionModel::Status SetNull(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(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(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(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(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(ConcreteAttributePath(endpoint, Clusters::EnergyCalendar::Id, Id), + EmberAfWriteDataInput(writable, ZCL_EPOCH_S_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); +} + +Protocols::InteractionModel::Status Set(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(EndpointId endpoint, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::EnergyCalendar::Id, Id), + EmberAfWriteDataInput(writable, ZCL_EPOCH_S_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); +} + +Protocols::InteractionModel::Status SetNull(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(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(EndpointId endpoint, const chip::app::DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace StartDate + +namespace ClusterRevision { + +Protocols::InteractionModel::Status Get(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(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(ConcreteAttributePath(endpoint, Clusters::EnergyCalendar::Id, Id), + EmberAfWriteDataInput(writable, ZCL_INT16U_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); +} + +Protocols::InteractionModel::Status Set(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..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 @@ -2463,6 +2463,73 @@ Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value, Mar } // namespace Attributes } // namespace EnergyEvse +namespace EnergyCalendar { +namespace Attributes { + +namespace CalendarID { +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(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(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(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(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(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 +} // 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..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 @@ -17871,6 +17871,256 @@ 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 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 CalendarPeriodStruct { +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 CalendarPeriodStruct + +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..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 @@ -24321,6 +24321,358 @@ 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 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 CalendarPeriodStruct { +enum class Fields : uint8_t +{ + kStartDate = 0, + kDays = 1, +}; + +struct Type +{ +public: + DataModel::Nullable startDate; + DataModel::List days; + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +struct DecodableType +{ +public: + DataModel::Nullable startDate; + DataModel::DecodableList days; + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; +}; + +} // namespace CalendarPeriodStruct +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); + DataModel::Nullable startTime; + DataModel::Nullable endTime; + + 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::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; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace CalendarPeriods +namespace SpecialDays { +struct TypeInfo +{ + 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; } + 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..8c75a496dcc8ef 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..91489bfd7fee76 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -3977,6 +3977,180 @@ 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::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::CalendarPeriodStruct::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("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"); + 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::CalendarPeriodStruct::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..4d05bb09f58db8 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h @@ -454,6 +454,26 @@ 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::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::CalendarPeriodStruct::Type & request, + Json::Value & value); + +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); + +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..e769b297b36668 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,155 @@ 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::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::CalendarPeriodStruct::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 +14053,106 @@ 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::Nullable> + value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("CalendarPeriods", 1, value); + } + case EnergyCalendar::Attributes::SpecialDays::Id: { + chip::app::DataModel::Nullable< + 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::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::LogAcceptedCommandId("AcceptedCommandList", 1, value, EnergyCalendar::Id); + } + 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::LogAttributeId("AttributeList", 1, value, EnergyCalendar::Id); + } + 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..5072bfb4e4d843 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,18 @@ 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::DayStruct::DecodableType & value); + +static CHIP_ERROR LogValue(const char * label, size_t indent, + 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); + static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::EnergyPreference::Structs::BalanceStruct::DecodableType & 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) { 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);