diff --git a/src/app/zap-templates/zcl/data-model/all.xml b/src/app/zap-templates/zcl/data-model/all.xml index 4e864cc4b8fce3..63cd2e9146a6b1 100644 --- a/src/app/zap-templates/zcl/data-model/all.xml +++ b/src/app/zap-templates/zcl/data-model/all.xml @@ -23,6 +23,7 @@ + diff --git a/src/app/zap-templates/zcl/data-model/chip/drlc-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/drlc-cluster.xml new file mode 100644 index 00000000000000..e3fa9f85c51c21 --- /dev/null +++ b/src/app/zap-templates/zcl/data-model/chip/drlc-cluster.xml @@ -0,0 +1,264 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Demand Response Load Control + Energy + This cluster provides an interface to the functionality of Smart Energy Demand Response and Load Control. + 0x0096 + DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER + true + true + + + DeviceClass + LoadControlPrograms + NumberOfLoadControlPrograms + Events + ActiveEvents + NumberOfEventsPerProgram + NumberOfTransistions + + DefaultRandomStart + + + + + DefaultRandomDuration + + + + + + + Upon receipt, this SHALL insert a new LoadControlProgramStruct into LoadControlPrograms, or if the ProgramID matches an existing LoadControlProgramStruct, then the provider SHALL be updated with the provided values. + + + + + + Upon receipt, this SHALL remove a the LoadControlProgramStruct from LoadControlPrograms with the matching ProgramID. + + + + + + On receipt of the AddLoadControlEventsRequest command, the server SHALL add a load control event. + + + + + + Upon receipt, this SHALL remove the LoadControlEventStruct with the matching EventID from LoadEventPrograms. + + + + + + + + Upon receipt, this SHALL clear all the load control events. + + + + + This event SHALL be generated when the status of a LoadControlEventStruct changes. + + + + + + + + + + + + + + + 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 06a1fdae15bd26..ea2d302d5c167d 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -37,6 +37,7 @@ "diagnostic-logs-cluster.xml", "dishwasher-alarm-cluster.xml", "dishwasher-mode-cluster.xml", + "drlc-cluster.xml", "microwave-oven-mode-cluster.xml", "microwave-oven-control-cluster.xml", "door-lock-cluster.xml", diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index 442cfc0681f88d..004bc03c9c8692 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -38,6 +38,7 @@ "dishwasher-mode-cluster.xml", "microwave-oven-mode-cluster.xml", "door-lock-cluster.xml", + "drlc-cluster.xml", "electrical-measurement-cluster.xml", "ethernet-network-diagnostics-cluster.xml", "fan-control-cluster.xml", diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 0e312ef1c2235f..3b5029a8a67446 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -3715,6 +3715,207 @@ client cluster ActivatedCarbonFilterMonitoring = 114 { command ResetCondition(): DefaultSuccess = 0; } +/** This cluster provides an interface to the functionality of Smart Energy Demand Response and Load Control. */ +client cluster DemandResponseLoadControl = 150 { + enum CriticalityLevelEnum : enum8 { + kUnknown = 0; + kGreen = 1; + kLevel1 = 2; + kLevel2 = 3; + kLevel3 = 4; + kLevel4 = 5; + kLevel5 = 6; + kEmergency = 7; + kPlannedOutage = 8; + kServiceDisconnect = 9; + } + + enum HeatingSourceEnum : enum8 { + kAny = 0; + kElectric = 1; + kNonElectric = 2; + } + + enum LoadControlEventChangeSourceEnum : enum8 { + kAutomatic = 0; + kUserAction = 1; + } + + enum LoadControlEventStatusEnum : enum8 { + kUnknown = 0; + kReceived = 1; + kInProgress = 2; + kCompleted = 3; + kOptedOut = 4; + kOptedIn = 5; + kCanceled = 6; + kSuperseded = 7; + kPartialOptedOut = 8; + kPartialOptedIn = 9; + kNoParticipation = 10; + kUnavailable = 11; + kFailed = 12; + } + + enum PowerSavingsEnum : enum8 { + kLow = 0; + kMedium = 1; + kHigh = 2; + } + + bitmap CancelControlBitmap : bitmap16 { + kRandomEnd = 0x1; + } + + bitmap DeviceClassBitmap : bitmap32 { + kHVAC = 0x1; + kStripHeater = 0x2; + kWaterHeater = 0x4; + kPoolPump = 0x8; + kSmartAppliance = 0x10; + kIrrigationPump = 0x20; + kCommercialLoad = 0x40; + kResidentialLoad = 0x80; + kExteriorLighting = 0x100; + kInteriorLighting = 0x200; + kEV = 0x400; + kGenerationSystem = 0x800; + kSmartInverter = 0x1000; + kEVSE = 0x2000; + kRESU = 0x4000; + kEMS = 0x8000; + kSEM = 0x10000; + } + + bitmap EventControlBitmap : bitmap16 { + kRandomStart = 0x1; + } + + bitmap EventTransitionControlBitmap : bitmap16 { + kRandomDuration = 0x1; + kIgnoreOptOut = 0x2; + } + + bitmap Feature : bitmap32 { + kEnrollmentGroups = 0x1; + kTemperatureOffset = 0x2; + kTemperatureSetpoint = 0x4; + kLoadAdjustment = 0x8; + kDutyCycle = 0x10; + kPowerSavings = 0x20; + kHeatingSource = 0x40; + } + + struct HeatingSourceControlStruct { + HeatingSourceEnum heatingSource = 0; + } + + struct PowerSavingsControlStruct { + PowerSavingsEnum powerSavings = 0; + } + + struct DutyCycleControlStruct { + percent dutyCycle = 0; + } + + struct AverageLoadControlStruct { + int8s loadAdjustment = 0; + } + + struct TemperatureControlStruct { + optional nullable int16u coolingTempOffset = 0; + optional nullable int16u heatingtTempOffset = 1; + optional nullable temperature coolingTempSetpoint = 2; + optional nullable temperature heatingTempSetpoint = 3; + } + + struct LoadControlEventTransitionStruct { + int16u duration = 0; + EventTransitionControlBitmap control = 1; + optional TemperatureControlStruct temperatureControl = 2; + optional AverageLoadControlStruct averageLoadControl = 3; + optional DutyCycleControlStruct dutyCycleControl = 4; + optional PowerSavingsControlStruct powerSavingsControl = 5; + optional HeatingSourceControlStruct heatingSourceControl = 6; + } + + struct LoadControlEventStruct { + octet_string<16> eventID = 0; + nullable octet_string<16> programID = 1; + EventControlBitmap control = 2; + DeviceClassBitmap deviceClass = 3; + optional int8u enrollmentGroup = 4; + CriticalityLevelEnum criticality = 5; + nullable epoch_s startTime = 6; + LoadControlEventTransitionStruct transitions[] = 7; + } + + struct LoadControlProgramStruct { + octet_string<16> programID = 0; + long_char_string<32> name = 1; + nullable int8u enrollmentGroup = 2; + nullable int8u randomStartMinutes = 3; + nullable int8u randomDurationMinutes = 4; + } + + info event LoadControlEventStatusChange = 0 { + octet_string eventID = 0; + nullable int8u transitionIndex = 1; + LoadControlEventStatusEnum status = 2; + CriticalityLevelEnum criticality = 3; + EventControlBitmap control = 4; + optional nullable TemperatureControlStruct temperatureControl = 5; + optional nullable AverageLoadControlStruct averageLoadControl = 6; + optional nullable DutyCycleControlStruct dutyCycleControl = 7; + optional nullable PowerSavingsControlStruct powerSavingsControl = 8; + optional nullable HeatingSourceControlStruct heatingSourceControl = 9; + } + + readonly attribute DeviceClassBitmap deviceClass = 0; + readonly attribute LoadControlProgramStruct loadControlPrograms[] = 1; + readonly attribute int8u numberOfLoadControlPrograms = 2; + readonly attribute LoadControlEventStruct events[] = 3; + readonly attribute LoadControlEventStruct activeEvents[] = 4; + readonly attribute int8u numberOfEventsPerProgram = 5; + readonly attribute int8u numberOfTransistions = 6; + attribute access(write: manage) int8u defaultRandomStart = 7; + attribute access(write: manage) int8u defaultRandomDuration = 8; + 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; + + request struct RegisterLoadControlProgramRequestRequest { + LoadControlProgramStruct loadControlProgram = 0; + } + + request struct UnregisterLoadControlProgramRequestRequest { + octet_string<16> loadControlProgramID = 0; + } + + request struct AddLoadControlEventRequestRequest { + LoadControlEventStruct event = 0; + } + + request struct RemoveLoadControlEventRequestRequest { + octet_string<16> eventID = 0; + CancelControlBitmap cancelControl = 1; + } + + /** Upon receipt, this SHALL insert a new LoadControlProgramStruct into LoadControlPrograms, or if the ProgramID matches an existing LoadControlProgramStruct, then the provider SHALL be updated with the provided values. */ + command RegisterLoadControlProgramRequest(RegisterLoadControlProgramRequestRequest): DefaultSuccess = 0; + /** Upon receipt, this SHALL remove a the LoadControlProgramStruct from LoadControlPrograms with the matching ProgramID. */ + command UnregisterLoadControlProgramRequest(UnregisterLoadControlProgramRequestRequest): DefaultSuccess = 1; + /** On receipt of the AddLoadControlEventsRequest command, the server SHALL add a load control event. */ + command AddLoadControlEventRequest(AddLoadControlEventRequestRequest): DefaultSuccess = 2; + /** Upon receipt, this SHALL remove the LoadControlEventStruct with the matching EventID from LoadEventPrograms. */ + command RemoveLoadControlEventRequest(RemoveLoadControlEventRequestRequest): DefaultSuccess = 3; + /** Upon receipt, this SHALL clear all the load control events. */ + command ClearLoadControlEventsRequest(): DefaultSuccess = 4; +} + /** An interface to a generic way to secure a door */ client cluster DoorLock = 257 { enum AlarmCodeEnum : enum8 { diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index 6c298efc59e1ce..8d50cbbd76758f 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -26252,6 +26252,557 @@ public void onSuccess(byte[] tlv) { } } + public static class DemandResponseLoadControlCluster extends BaseChipCluster { + public static final long CLUSTER_ID = 150L; + + private static final long DEVICE_CLASS_ATTRIBUTE_ID = 0L; + private static final long LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID = 1L; + private static final long NUMBER_OF_LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID = 2L; + private static final long EVENTS_ATTRIBUTE_ID = 3L; + private static final long ACTIVE_EVENTS_ATTRIBUTE_ID = 4L; + private static final long NUMBER_OF_EVENTS_PER_PROGRAM_ATTRIBUTE_ID = 5L; + private static final long NUMBER_OF_TRANSISTIONS_ATTRIBUTE_ID = 6L; + private static final long DEFAULT_RANDOM_START_ATTRIBUTE_ID = 7L; + private static final long DEFAULT_RANDOM_DURATION_ATTRIBUTE_ID = 8L; + 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 DemandResponseLoadControlCluster(long devicePtr, int endpointId) { + super(devicePtr, endpointId, CLUSTER_ID); + } + + @Override + @Deprecated + public long initWithDevice(long devicePtr, int endpointId) { + return 0L; + } + + public void registerLoadControlProgramRequest(DefaultClusterCallback callback, ChipStructs.DemandResponseLoadControlClusterLoadControlProgramStruct loadControlProgram) { + registerLoadControlProgramRequest(callback, loadControlProgram, 0); + } + + public void registerLoadControlProgramRequest(DefaultClusterCallback callback, ChipStructs.DemandResponseLoadControlClusterLoadControlProgramStruct loadControlProgram, int timedInvokeTimeoutMs) { + final long commandId = 0L; + + ArrayList elements = new ArrayList<>(); + final long loadControlProgramFieldID = 0L; + BaseTLVType loadControlProgramtlvValue = loadControlProgram.encodeTlv(); + elements.add(new StructElement(loadControlProgramFieldID, loadControlProgramtlvValue)); + + StructType value = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, value, timedInvokeTimeoutMs); + } + + public void unregisterLoadControlProgramRequest(DefaultClusterCallback callback, byte[] loadControlProgramID) { + unregisterLoadControlProgramRequest(callback, loadControlProgramID, 0); + } + + public void unregisterLoadControlProgramRequest(DefaultClusterCallback callback, byte[] loadControlProgramID, int timedInvokeTimeoutMs) { + final long commandId = 1L; + + ArrayList elements = new ArrayList<>(); + final long loadControlProgramIDFieldID = 0L; + BaseTLVType loadControlProgramIDtlvValue = new ByteArrayType(loadControlProgramID); + elements.add(new StructElement(loadControlProgramIDFieldID, loadControlProgramIDtlvValue)); + + StructType value = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, value, timedInvokeTimeoutMs); + } + + public void addLoadControlEventRequest(DefaultClusterCallback callback, ChipStructs.DemandResponseLoadControlClusterLoadControlEventStruct event) { + addLoadControlEventRequest(callback, event, 0); + } + + public void addLoadControlEventRequest(DefaultClusterCallback callback, ChipStructs.DemandResponseLoadControlClusterLoadControlEventStruct event, int timedInvokeTimeoutMs) { + final long commandId = 2L; + + ArrayList elements = new ArrayList<>(); + final long eventFieldID = 0L; + BaseTLVType eventtlvValue = event.encodeTlv(); + elements.add(new StructElement(eventFieldID, eventtlvValue)); + + StructType value = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, value, timedInvokeTimeoutMs); + } + + public void removeLoadControlEventRequest(DefaultClusterCallback callback, byte[] eventID, Integer cancelControl) { + removeLoadControlEventRequest(callback, eventID, cancelControl, 0); + } + + public void removeLoadControlEventRequest(DefaultClusterCallback callback, byte[] eventID, Integer cancelControl, int timedInvokeTimeoutMs) { + final long commandId = 3L; + + ArrayList elements = new ArrayList<>(); + final long eventIDFieldID = 0L; + BaseTLVType eventIDtlvValue = new ByteArrayType(eventID); + elements.add(new StructElement(eventIDFieldID, eventIDtlvValue)); + + final long cancelControlFieldID = 1L; + BaseTLVType cancelControltlvValue = new UIntType(cancelControl); + elements.add(new StructElement(cancelControlFieldID, cancelControltlvValue)); + + StructType value = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, value, timedInvokeTimeoutMs); + } + + public void clearLoadControlEventsRequest(DefaultClusterCallback callback) { + clearLoadControlEventsRequest(callback, 0); + } + + public void clearLoadControlEventsRequest(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + final long commandId = 4L; + + ArrayList elements = new ArrayList<>(); + StructType value = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, value, timedInvokeTimeoutMs); + } + + public interface LoadControlProgramsAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface EventsAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface ActiveEventsAttributeCallback extends BaseAttributeCallback { + void onSuccess(List 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 readDeviceClassAttribute( + LongAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DEVICE_CLASS_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, DEVICE_CLASS_ATTRIBUTE_ID, true); + } + + public void subscribeDeviceClassAttribute( + LongAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DEVICE_CLASS_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, DEVICE_CLASS_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readLoadControlProgramsAttribute( + LoadControlProgramsAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID, true); + } + + public void subscribeLoadControlProgramsAttribute( + LoadControlProgramsAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readNumberOfLoadControlProgramsAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, NUMBER_OF_LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID, true); + } + + public void subscribeNumberOfLoadControlProgramsAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, NUMBER_OF_LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readEventsAttribute( + EventsAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENTS_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, EVENTS_ATTRIBUTE_ID, true); + } + + public void subscribeEventsAttribute( + EventsAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENTS_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, EVENTS_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readActiveEventsAttribute( + ActiveEventsAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACTIVE_EVENTS_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ACTIVE_EVENTS_ATTRIBUTE_ID, true); + } + + public void subscribeActiveEventsAttribute( + ActiveEventsAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACTIVE_EVENTS_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, ACTIVE_EVENTS_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readNumberOfEventsPerProgramAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_EVENTS_PER_PROGRAM_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, NUMBER_OF_EVENTS_PER_PROGRAM_ATTRIBUTE_ID, true); + } + + public void subscribeNumberOfEventsPerProgramAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_EVENTS_PER_PROGRAM_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, NUMBER_OF_EVENTS_PER_PROGRAM_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readNumberOfTransistionsAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_TRANSISTIONS_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, NUMBER_OF_TRANSISTIONS_ATTRIBUTE_ID, true); + } + + public void subscribeNumberOfTransistionsAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_TRANSISTIONS_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, NUMBER_OF_TRANSISTIONS_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readDefaultRandomStartAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DEFAULT_RANDOM_START_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, DEFAULT_RANDOM_START_ATTRIBUTE_ID, true); + } + + public void writeDefaultRandomStartAttribute(DefaultClusterCallback callback, Integer value) { + writeDefaultRandomStartAttribute(callback, value, 0); + } + + public void writeDefaultRandomStartAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { + BaseTLVType tlvValue = new UIntType(value); + writeAttribute(new WriteAttributesCallbackImpl(callback), DEFAULT_RANDOM_START_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + } + + public void subscribeDefaultRandomStartAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DEFAULT_RANDOM_START_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, DEFAULT_RANDOM_START_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readDefaultRandomDurationAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DEFAULT_RANDOM_DURATION_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, DEFAULT_RANDOM_DURATION_ATTRIBUTE_ID, true); + } + + public void writeDefaultRandomDurationAttribute(DefaultClusterCallback callback, Integer value) { + writeDefaultRandomDurationAttribute(callback, value, 0); + } + + public void writeDefaultRandomDurationAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { + BaseTLVType tlvValue = new UIntType(value); + writeAttribute(new WriteAttributesCallbackImpl(callback), DEFAULT_RANDOM_DURATION_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + } + + public void subscribeDefaultRandomDurationAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DEFAULT_RANDOM_DURATION_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, DEFAULT_RANDOM_DURATION_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); + } + }, 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); + } + }, 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); + } + }, 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); + } + }, 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); + } + }, 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); + } + }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); + } + } + public static class DoorLockCluster extends BaseChipCluster { public static final long CLUSTER_ID = 257L; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java index 4534543f9d8634..4866e8833e8013 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java @@ -2785,6 +2785,187 @@ public String toString() { return output.toString(); } } +public static class DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent { + public byte[] eventID; + public @Nullable Integer transitionIndex; + public Integer status; + public Integer criticality; + public Integer control; + public @Nullable Optional temperatureControl; + public @Nullable Optional averageLoadControl; + public @Nullable Optional dutyCycleControl; + public @Nullable Optional powerSavingsControl; + public @Nullable Optional heatingSourceControl; + private static final long EVENT_I_D_ID = 0L; + private static final long TRANSITION_INDEX_ID = 1L; + private static final long STATUS_ID = 2L; + private static final long CRITICALITY_ID = 3L; + private static final long CONTROL_ID = 4L; + private static final long TEMPERATURE_CONTROL_ID = 5L; + private static final long AVERAGE_LOAD_CONTROL_ID = 6L; + private static final long DUTY_CYCLE_CONTROL_ID = 7L; + private static final long POWER_SAVINGS_CONTROL_ID = 8L; + private static final long HEATING_SOURCE_CONTROL_ID = 9L; + + public DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent( + byte[] eventID, + @Nullable Integer transitionIndex, + Integer status, + Integer criticality, + Integer control, + @Nullable Optional temperatureControl, + @Nullable Optional averageLoadControl, + @Nullable Optional dutyCycleControl, + @Nullable Optional powerSavingsControl, + @Nullable Optional heatingSourceControl + ) { + this.eventID = eventID; + this.transitionIndex = transitionIndex; + this.status = status; + this.criticality = criticality; + this.control = control; + this.temperatureControl = temperatureControl; + this.averageLoadControl = averageLoadControl; + this.dutyCycleControl = dutyCycleControl; + this.powerSavingsControl = powerSavingsControl; + this.heatingSourceControl = heatingSourceControl; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(EVENT_I_D_ID, new ByteArrayType(eventID))); + values.add(new StructElement(TRANSITION_INDEX_ID, transitionIndex != null ? new UIntType(transitionIndex) : new NullType())); + values.add(new StructElement(STATUS_ID, new UIntType(status))); + values.add(new StructElement(CRITICALITY_ID, new UIntType(criticality))); + values.add(new StructElement(CONTROL_ID, new UIntType(control))); + values.add(new StructElement(TEMPERATURE_CONTROL_ID, temperatureControl != null ? temperatureControl.map((nonOptionaltemperatureControl) -> nonOptionaltemperatureControl.encodeTlv()).orElse(new EmptyType()) : new NullType())); + values.add(new StructElement(AVERAGE_LOAD_CONTROL_ID, averageLoadControl != null ? averageLoadControl.map((nonOptionalaverageLoadControl) -> nonOptionalaverageLoadControl.encodeTlv()).orElse(new EmptyType()) : new NullType())); + values.add(new StructElement(DUTY_CYCLE_CONTROL_ID, dutyCycleControl != null ? dutyCycleControl.map((nonOptionaldutyCycleControl) -> nonOptionaldutyCycleControl.encodeTlv()).orElse(new EmptyType()) : new NullType())); + values.add(new StructElement(POWER_SAVINGS_CONTROL_ID, powerSavingsControl != null ? powerSavingsControl.map((nonOptionalpowerSavingsControl) -> nonOptionalpowerSavingsControl.encodeTlv()).orElse(new EmptyType()) : new NullType())); + values.add(new StructElement(HEATING_SOURCE_CONTROL_ID, heatingSourceControl != null ? heatingSourceControl.map((nonOptionalheatingSourceControl) -> nonOptionalheatingSourceControl.encodeTlv()).orElse(new EmptyType()) : new NullType())); + + return new StructType(values); + } + + public static DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + byte[] eventID = null; + @Nullable Integer transitionIndex = null; + Integer status = null; + Integer criticality = null; + Integer control = null; + @Nullable Optional temperatureControl = null; + @Nullable Optional averageLoadControl = null; + @Nullable Optional dutyCycleControl = null; + @Nullable Optional powerSavingsControl = null; + @Nullable Optional heatingSourceControl = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == EVENT_I_D_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { + ByteArrayType castingValue = element.value(ByteArrayType.class); + eventID = castingValue.value(byte[].class); + } + } else if (element.contextTagNum() == TRANSITION_INDEX_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + transitionIndex = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == STATUS_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + status = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == CRITICALITY_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + criticality = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == CONTROL_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + control = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == TEMPERATURE_CONTROL_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Struct) { + StructType castingValue = element.value(StructType.class); + temperatureControl = Optional.of(ChipStructs.DemandResponseLoadControlClusterTemperatureControlStruct.decodeTlv(castingValue)); + } + } else if (element.contextTagNum() == AVERAGE_LOAD_CONTROL_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Struct) { + StructType castingValue = element.value(StructType.class); + averageLoadControl = Optional.of(ChipStructs.DemandResponseLoadControlClusterAverageLoadControlStruct.decodeTlv(castingValue)); + } + } else if (element.contextTagNum() == DUTY_CYCLE_CONTROL_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Struct) { + StructType castingValue = element.value(StructType.class); + dutyCycleControl = Optional.of(ChipStructs.DemandResponseLoadControlClusterDutyCycleControlStruct.decodeTlv(castingValue)); + } + } else if (element.contextTagNum() == POWER_SAVINGS_CONTROL_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Struct) { + StructType castingValue = element.value(StructType.class); + powerSavingsControl = Optional.of(ChipStructs.DemandResponseLoadControlClusterPowerSavingsControlStruct.decodeTlv(castingValue)); + } + } else if (element.contextTagNum() == HEATING_SOURCE_CONTROL_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Struct) { + StructType castingValue = element.value(StructType.class); + heatingSourceControl = Optional.of(ChipStructs.DemandResponseLoadControlClusterHeatingSourceControlStruct.decodeTlv(castingValue)); + } + } + } + return new DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent( + eventID, + transitionIndex, + status, + criticality, + control, + temperatureControl, + averageLoadControl, + dutyCycleControl, + powerSavingsControl, + heatingSourceControl + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent {\n"); + output.append("\teventID: "); + output.append(Arrays.toString(eventID)); + output.append("\n"); + output.append("\ttransitionIndex: "); + output.append(transitionIndex); + output.append("\n"); + output.append("\tstatus: "); + output.append(status); + output.append("\n"); + output.append("\tcriticality: "); + output.append(criticality); + output.append("\n"); + output.append("\tcontrol: "); + output.append(control); + output.append("\n"); + output.append("\ttemperatureControl: "); + output.append(temperatureControl); + output.append("\n"); + output.append("\taverageLoadControl: "); + output.append(averageLoadControl); + output.append("\n"); + output.append("\tdutyCycleControl: "); + output.append(dutyCycleControl); + output.append("\n"); + output.append("\tpowerSavingsControl: "); + output.append(powerSavingsControl); + output.append("\n"); + output.append("\theatingSourceControl: "); + output.append(heatingSourceControl); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} public static class DoorLockClusterDoorLockAlarmEvent { public Integer alarmCode; private static final long ALARM_CODE_ID = 0L; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index 6838a3c34779c5..b9889df5832fea 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -5033,6 +5033,674 @@ public String toString() { return output.toString(); } } +public static class DemandResponseLoadControlClusterHeatingSourceControlStruct { + public Integer heatingSource; + private static final long HEATING_SOURCE_ID = 0L; + + public DemandResponseLoadControlClusterHeatingSourceControlStruct( + Integer heatingSource + ) { + this.heatingSource = heatingSource; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(HEATING_SOURCE_ID, new UIntType(heatingSource))); + + return new StructType(values); + } + + public static DemandResponseLoadControlClusterHeatingSourceControlStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Integer heatingSource = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == HEATING_SOURCE_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + heatingSource = castingValue.value(Integer.class); + } + } + } + return new DemandResponseLoadControlClusterHeatingSourceControlStruct( + heatingSource + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("DemandResponseLoadControlClusterHeatingSourceControlStruct {\n"); + output.append("\theatingSource: "); + output.append(heatingSource); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class DemandResponseLoadControlClusterPowerSavingsControlStruct { + public Integer powerSavings; + private static final long POWER_SAVINGS_ID = 0L; + + public DemandResponseLoadControlClusterPowerSavingsControlStruct( + Integer powerSavings + ) { + this.powerSavings = powerSavings; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(POWER_SAVINGS_ID, new UIntType(powerSavings))); + + return new StructType(values); + } + + public static DemandResponseLoadControlClusterPowerSavingsControlStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Integer powerSavings = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == POWER_SAVINGS_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + powerSavings = castingValue.value(Integer.class); + } + } + } + return new DemandResponseLoadControlClusterPowerSavingsControlStruct( + powerSavings + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("DemandResponseLoadControlClusterPowerSavingsControlStruct {\n"); + output.append("\tpowerSavings: "); + output.append(powerSavings); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class DemandResponseLoadControlClusterDutyCycleControlStruct { + public Integer dutyCycle; + private static final long DUTY_CYCLE_ID = 0L; + + public DemandResponseLoadControlClusterDutyCycleControlStruct( + Integer dutyCycle + ) { + this.dutyCycle = dutyCycle; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(DUTY_CYCLE_ID, new UIntType(dutyCycle))); + + return new StructType(values); + } + + public static DemandResponseLoadControlClusterDutyCycleControlStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Integer dutyCycle = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == DUTY_CYCLE_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + dutyCycle = castingValue.value(Integer.class); + } + } + } + return new DemandResponseLoadControlClusterDutyCycleControlStruct( + dutyCycle + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("DemandResponseLoadControlClusterDutyCycleControlStruct {\n"); + output.append("\tdutyCycle: "); + output.append(dutyCycle); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class DemandResponseLoadControlClusterAverageLoadControlStruct { + public Integer loadAdjustment; + private static final long LOAD_ADJUSTMENT_ID = 0L; + + public DemandResponseLoadControlClusterAverageLoadControlStruct( + Integer loadAdjustment + ) { + this.loadAdjustment = loadAdjustment; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(LOAD_ADJUSTMENT_ID, new IntType(loadAdjustment))); + + return new StructType(values); + } + + public static DemandResponseLoadControlClusterAverageLoadControlStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Integer loadAdjustment = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == LOAD_ADJUSTMENT_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Int) { + IntType castingValue = element.value(IntType.class); + loadAdjustment = castingValue.value(Integer.class); + } + } + } + return new DemandResponseLoadControlClusterAverageLoadControlStruct( + loadAdjustment + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("DemandResponseLoadControlClusterAverageLoadControlStruct {\n"); + output.append("\tloadAdjustment: "); + output.append(loadAdjustment); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class DemandResponseLoadControlClusterTemperatureControlStruct { + public @Nullable Optional coolingTempOffset; + public @Nullable Optional heatingtTempOffset; + public @Nullable Optional coolingTempSetpoint; + public @Nullable Optional heatingTempSetpoint; + private static final long COOLING_TEMP_OFFSET_ID = 0L; + private static final long HEATINGT_TEMP_OFFSET_ID = 1L; + private static final long COOLING_TEMP_SETPOINT_ID = 2L; + private static final long HEATING_TEMP_SETPOINT_ID = 3L; + + public DemandResponseLoadControlClusterTemperatureControlStruct( + @Nullable Optional coolingTempOffset, + @Nullable Optional heatingtTempOffset, + @Nullable Optional coolingTempSetpoint, + @Nullable Optional heatingTempSetpoint + ) { + this.coolingTempOffset = coolingTempOffset; + this.heatingtTempOffset = heatingtTempOffset; + this.coolingTempSetpoint = coolingTempSetpoint; + this.heatingTempSetpoint = heatingTempSetpoint; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(COOLING_TEMP_OFFSET_ID, coolingTempOffset != null ? coolingTempOffset.map((nonOptionalcoolingTempOffset) -> new UIntType(nonOptionalcoolingTempOffset)).orElse(new EmptyType()) : new NullType())); + values.add(new StructElement(HEATINGT_TEMP_OFFSET_ID, heatingtTempOffset != null ? heatingtTempOffset.map((nonOptionalheatingtTempOffset) -> new UIntType(nonOptionalheatingtTempOffset)).orElse(new EmptyType()) : new NullType())); + values.add(new StructElement(COOLING_TEMP_SETPOINT_ID, coolingTempSetpoint != null ? coolingTempSetpoint.map((nonOptionalcoolingTempSetpoint) -> new IntType(nonOptionalcoolingTempSetpoint)).orElse(new EmptyType()) : new NullType())); + values.add(new StructElement(HEATING_TEMP_SETPOINT_ID, heatingTempSetpoint != null ? heatingTempSetpoint.map((nonOptionalheatingTempSetpoint) -> new IntType(nonOptionalheatingTempSetpoint)).orElse(new EmptyType()) : new NullType())); + + return new StructType(values); + } + + public static DemandResponseLoadControlClusterTemperatureControlStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + @Nullable Optional coolingTempOffset = null; + @Nullable Optional heatingtTempOffset = null; + @Nullable Optional coolingTempSetpoint = null; + @Nullable Optional heatingTempSetpoint = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == COOLING_TEMP_OFFSET_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + coolingTempOffset = Optional.of(castingValue.value(Integer.class)); + } + } else if (element.contextTagNum() == HEATINGT_TEMP_OFFSET_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + heatingtTempOffset = Optional.of(castingValue.value(Integer.class)); + } + } else if (element.contextTagNum() == COOLING_TEMP_SETPOINT_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Int) { + IntType castingValue = element.value(IntType.class); + coolingTempSetpoint = Optional.of(castingValue.value(Integer.class)); + } + } else if (element.contextTagNum() == HEATING_TEMP_SETPOINT_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Int) { + IntType castingValue = element.value(IntType.class); + heatingTempSetpoint = Optional.of(castingValue.value(Integer.class)); + } + } + } + return new DemandResponseLoadControlClusterTemperatureControlStruct( + coolingTempOffset, + heatingtTempOffset, + coolingTempSetpoint, + heatingTempSetpoint + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("DemandResponseLoadControlClusterTemperatureControlStruct {\n"); + output.append("\tcoolingTempOffset: "); + output.append(coolingTempOffset); + output.append("\n"); + output.append("\theatingtTempOffset: "); + output.append(heatingtTempOffset); + output.append("\n"); + output.append("\tcoolingTempSetpoint: "); + output.append(coolingTempSetpoint); + output.append("\n"); + output.append("\theatingTempSetpoint: "); + output.append(heatingTempSetpoint); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class DemandResponseLoadControlClusterLoadControlEventTransitionStruct { + public Integer duration; + public Integer control; + public Optional temperatureControl; + public Optional averageLoadControl; + public Optional dutyCycleControl; + public Optional powerSavingsControl; + public Optional heatingSourceControl; + private static final long DURATION_ID = 0L; + private static final long CONTROL_ID = 1L; + private static final long TEMPERATURE_CONTROL_ID = 2L; + private static final long AVERAGE_LOAD_CONTROL_ID = 3L; + private static final long DUTY_CYCLE_CONTROL_ID = 4L; + private static final long POWER_SAVINGS_CONTROL_ID = 5L; + private static final long HEATING_SOURCE_CONTROL_ID = 6L; + + public DemandResponseLoadControlClusterLoadControlEventTransitionStruct( + Integer duration, + Integer control, + Optional temperatureControl, + Optional averageLoadControl, + Optional dutyCycleControl, + Optional powerSavingsControl, + Optional heatingSourceControl + ) { + this.duration = duration; + this.control = control; + this.temperatureControl = temperatureControl; + this.averageLoadControl = averageLoadControl; + this.dutyCycleControl = dutyCycleControl; + this.powerSavingsControl = powerSavingsControl; + this.heatingSourceControl = heatingSourceControl; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(DURATION_ID, new UIntType(duration))); + values.add(new StructElement(CONTROL_ID, new UIntType(control))); + values.add(new StructElement(TEMPERATURE_CONTROL_ID, temperatureControl.map((nonOptionaltemperatureControl) -> nonOptionaltemperatureControl.encodeTlv()).orElse(new EmptyType()))); + values.add(new StructElement(AVERAGE_LOAD_CONTROL_ID, averageLoadControl.map((nonOptionalaverageLoadControl) -> nonOptionalaverageLoadControl.encodeTlv()).orElse(new EmptyType()))); + values.add(new StructElement(DUTY_CYCLE_CONTROL_ID, dutyCycleControl.map((nonOptionaldutyCycleControl) -> nonOptionaldutyCycleControl.encodeTlv()).orElse(new EmptyType()))); + values.add(new StructElement(POWER_SAVINGS_CONTROL_ID, powerSavingsControl.map((nonOptionalpowerSavingsControl) -> nonOptionalpowerSavingsControl.encodeTlv()).orElse(new EmptyType()))); + values.add(new StructElement(HEATING_SOURCE_CONTROL_ID, heatingSourceControl.map((nonOptionalheatingSourceControl) -> nonOptionalheatingSourceControl.encodeTlv()).orElse(new EmptyType()))); + + return new StructType(values); + } + + public static DemandResponseLoadControlClusterLoadControlEventTransitionStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Integer duration = null; + Integer control = null; + Optional temperatureControl = Optional.empty(); + Optional averageLoadControl = Optional.empty(); + Optional dutyCycleControl = Optional.empty(); + Optional powerSavingsControl = Optional.empty(); + Optional heatingSourceControl = Optional.empty(); + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == DURATION_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + duration = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == CONTROL_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + control = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == TEMPERATURE_CONTROL_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Struct) { + StructType castingValue = element.value(StructType.class); + temperatureControl = Optional.of(ChipStructs.DemandResponseLoadControlClusterTemperatureControlStruct.decodeTlv(castingValue)); + } + } else if (element.contextTagNum() == AVERAGE_LOAD_CONTROL_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Struct) { + StructType castingValue = element.value(StructType.class); + averageLoadControl = Optional.of(ChipStructs.DemandResponseLoadControlClusterAverageLoadControlStruct.decodeTlv(castingValue)); + } + } else if (element.contextTagNum() == DUTY_CYCLE_CONTROL_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Struct) { + StructType castingValue = element.value(StructType.class); + dutyCycleControl = Optional.of(ChipStructs.DemandResponseLoadControlClusterDutyCycleControlStruct.decodeTlv(castingValue)); + } + } else if (element.contextTagNum() == POWER_SAVINGS_CONTROL_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Struct) { + StructType castingValue = element.value(StructType.class); + powerSavingsControl = Optional.of(ChipStructs.DemandResponseLoadControlClusterPowerSavingsControlStruct.decodeTlv(castingValue)); + } + } else if (element.contextTagNum() == HEATING_SOURCE_CONTROL_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Struct) { + StructType castingValue = element.value(StructType.class); + heatingSourceControl = Optional.of(ChipStructs.DemandResponseLoadControlClusterHeatingSourceControlStruct.decodeTlv(castingValue)); + } + } + } + return new DemandResponseLoadControlClusterLoadControlEventTransitionStruct( + duration, + control, + temperatureControl, + averageLoadControl, + dutyCycleControl, + powerSavingsControl, + heatingSourceControl + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("DemandResponseLoadControlClusterLoadControlEventTransitionStruct {\n"); + output.append("\tduration: "); + output.append(duration); + output.append("\n"); + output.append("\tcontrol: "); + output.append(control); + output.append("\n"); + output.append("\ttemperatureControl: "); + output.append(temperatureControl); + output.append("\n"); + output.append("\taverageLoadControl: "); + output.append(averageLoadControl); + output.append("\n"); + output.append("\tdutyCycleControl: "); + output.append(dutyCycleControl); + output.append("\n"); + output.append("\tpowerSavingsControl: "); + output.append(powerSavingsControl); + output.append("\n"); + output.append("\theatingSourceControl: "); + output.append(heatingSourceControl); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class DemandResponseLoadControlClusterLoadControlEventStruct { + public byte[] eventID; + public @Nullable byte[] programID; + public Integer control; + public Long deviceClass; + public Optional enrollmentGroup; + public Integer criticality; + public @Nullable Long startTime; + public ArrayList transitions; + private static final long EVENT_I_D_ID = 0L; + private static final long PROGRAM_I_D_ID = 1L; + private static final long CONTROL_ID = 2L; + private static final long DEVICE_CLASS_ID = 3L; + private static final long ENROLLMENT_GROUP_ID = 4L; + private static final long CRITICALITY_ID = 5L; + private static final long START_TIME_ID = 6L; + private static final long TRANSITIONS_ID = 7L; + + public DemandResponseLoadControlClusterLoadControlEventStruct( + byte[] eventID, + @Nullable byte[] programID, + Integer control, + Long deviceClass, + Optional enrollmentGroup, + Integer criticality, + @Nullable Long startTime, + ArrayList transitions + ) { + this.eventID = eventID; + this.programID = programID; + this.control = control; + this.deviceClass = deviceClass; + this.enrollmentGroup = enrollmentGroup; + this.criticality = criticality; + this.startTime = startTime; + this.transitions = transitions; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(EVENT_I_D_ID, new ByteArrayType(eventID))); + values.add(new StructElement(PROGRAM_I_D_ID, programID != null ? new ByteArrayType(programID) : new NullType())); + values.add(new StructElement(CONTROL_ID, new UIntType(control))); + values.add(new StructElement(DEVICE_CLASS_ID, new UIntType(deviceClass))); + values.add(new StructElement(ENROLLMENT_GROUP_ID, enrollmentGroup.map((nonOptionalenrollmentGroup) -> new UIntType(nonOptionalenrollmentGroup)).orElse(new EmptyType()))); + values.add(new StructElement(CRITICALITY_ID, new UIntType(criticality))); + values.add(new StructElement(START_TIME_ID, startTime != null ? new UIntType(startTime) : new NullType())); + values.add(new StructElement(TRANSITIONS_ID, ArrayType.generateArrayType(transitions, (elementtransitions) -> elementtransitions.encodeTlv()))); + + return new StructType(values); + } + + public static DemandResponseLoadControlClusterLoadControlEventStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + byte[] eventID = null; + @Nullable byte[] programID = null; + Integer control = null; + Long deviceClass = null; + Optional enrollmentGroup = Optional.empty(); + Integer criticality = null; + @Nullable Long startTime = null; + ArrayList transitions = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == EVENT_I_D_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { + ByteArrayType castingValue = element.value(ByteArrayType.class); + eventID = castingValue.value(byte[].class); + } + } else if (element.contextTagNum() == PROGRAM_I_D_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { + ByteArrayType castingValue = element.value(ByteArrayType.class); + programID = castingValue.value(byte[].class); + } + } else if (element.contextTagNum() == CONTROL_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + control = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == DEVICE_CLASS_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + deviceClass = castingValue.value(Long.class); + } + } else if (element.contextTagNum() == ENROLLMENT_GROUP_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + enrollmentGroup = Optional.of(castingValue.value(Integer.class)); + } + } else if (element.contextTagNum() == CRITICALITY_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + criticality = 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() == TRANSITIONS_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Array) { + ArrayType castingValue = element.value(ArrayType.class); + transitions = castingValue.map((elementcastingValue) -> ChipStructs.DemandResponseLoadControlClusterLoadControlEventTransitionStruct.decodeTlv(elementcastingValue)); + } + } + } + return new DemandResponseLoadControlClusterLoadControlEventStruct( + eventID, + programID, + control, + deviceClass, + enrollmentGroup, + criticality, + startTime, + transitions + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("DemandResponseLoadControlClusterLoadControlEventStruct {\n"); + output.append("\teventID: "); + output.append(Arrays.toString(eventID)); + output.append("\n"); + output.append("\tprogramID: "); + output.append(Arrays.toString(programID)); + output.append("\n"); + output.append("\tcontrol: "); + output.append(control); + output.append("\n"); + output.append("\tdeviceClass: "); + output.append(deviceClass); + output.append("\n"); + output.append("\tenrollmentGroup: "); + output.append(enrollmentGroup); + output.append("\n"); + output.append("\tcriticality: "); + output.append(criticality); + output.append("\n"); + output.append("\tstartTime: "); + output.append(startTime); + output.append("\n"); + output.append("\ttransitions: "); + output.append(transitions); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class DemandResponseLoadControlClusterLoadControlProgramStruct { + public byte[] programID; + public String name; + public @Nullable Integer enrollmentGroup; + public @Nullable Integer randomStartMinutes; + public @Nullable Integer randomDurationMinutes; + private static final long PROGRAM_I_D_ID = 0L; + private static final long NAME_ID = 1L; + private static final long ENROLLMENT_GROUP_ID = 2L; + private static final long RANDOM_START_MINUTES_ID = 3L; + private static final long RANDOM_DURATION_MINUTES_ID = 4L; + + public DemandResponseLoadControlClusterLoadControlProgramStruct( + byte[] programID, + String name, + @Nullable Integer enrollmentGroup, + @Nullable Integer randomStartMinutes, + @Nullable Integer randomDurationMinutes + ) { + this.programID = programID; + this.name = name; + this.enrollmentGroup = enrollmentGroup; + this.randomStartMinutes = randomStartMinutes; + this.randomDurationMinutes = randomDurationMinutes; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(PROGRAM_I_D_ID, new ByteArrayType(programID))); + values.add(new StructElement(NAME_ID, new StringType(name))); + values.add(new StructElement(ENROLLMENT_GROUP_ID, enrollmentGroup != null ? new UIntType(enrollmentGroup) : new NullType())); + values.add(new StructElement(RANDOM_START_MINUTES_ID, randomStartMinutes != null ? new UIntType(randomStartMinutes) : new NullType())); + values.add(new StructElement(RANDOM_DURATION_MINUTES_ID, randomDurationMinutes != null ? new UIntType(randomDurationMinutes) : new NullType())); + + return new StructType(values); + } + + public static DemandResponseLoadControlClusterLoadControlProgramStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + byte[] programID = null; + String name = null; + @Nullable Integer enrollmentGroup = null; + @Nullable Integer randomStartMinutes = null; + @Nullable Integer randomDurationMinutes = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == PROGRAM_I_D_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { + ByteArrayType castingValue = element.value(ByteArrayType.class); + programID = castingValue.value(byte[].class); + } + } else if (element.contextTagNum() == NAME_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.String) { + StringType castingValue = element.value(StringType.class); + name = castingValue.value(String.class); + } + } else if (element.contextTagNum() == ENROLLMENT_GROUP_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + enrollmentGroup = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == RANDOM_START_MINUTES_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + randomStartMinutes = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == RANDOM_DURATION_MINUTES_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + randomDurationMinutes = castingValue.value(Integer.class); + } + } + } + return new DemandResponseLoadControlClusterLoadControlProgramStruct( + programID, + name, + enrollmentGroup, + randomStartMinutes, + randomDurationMinutes + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("DemandResponseLoadControlClusterLoadControlProgramStruct {\n"); + output.append("\tprogramID: "); + output.append(Arrays.toString(programID)); + output.append("\n"); + output.append("\tname: "); + output.append(name); + output.append("\n"); + output.append("\tenrollmentGroup: "); + output.append(enrollmentGroup); + output.append("\n"); + output.append("\trandomStartMinutes: "); + output.append(randomStartMinutes); + output.append("\n"); + output.append("\trandomDurationMinutes: "); + output.append(randomDurationMinutes); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} public static class DoorLockClusterCredentialStruct { public Integer credentialType; public Integer credentialIndex; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java index 5d35f2341c1ff1..a340abd92582a1 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java @@ -208,6 +208,9 @@ public static BaseCluster getCluster(long clusterId) { if (clusterId == ActivatedCarbonFilterMonitoring.ID) { return new ActivatedCarbonFilterMonitoring(); } + if (clusterId == DemandResponseLoadControl.ID) { + return new DemandResponseLoadControl(); + } if (clusterId == DoorLock.ID) { return new DoorLock(); } @@ -8397,6 +8400,189 @@ public long getCommandID(String name) throws IllegalArgumentException { return Command.valueOf(name).getID(); } } + public static class DemandResponseLoadControl implements BaseCluster { + public static final long ID = 150L; + public long getID() { + return ID; + } + + public enum Attribute { + DeviceClass(0L), + LoadControlPrograms(1L), + NumberOfLoadControlPrograms(2L), + Events(3L), + ActiveEvents(4L), + NumberOfEventsPerProgram(5L), + NumberOfTransistions(6L), + DefaultRandomStart(7L), + DefaultRandomDuration(8L), + 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 { + LoadControlEventStatusChange(0L),; + 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 { + RegisterLoadControlProgramRequest(0L), + UnregisterLoadControlProgramRequest(1L), + AddLoadControlEventRequest(2L), + RemoveLoadControlEventRequest(3L), + ClearLoadControlEventsRequest(4L),; + 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(); + } + }public enum RegisterLoadControlProgramRequestCommandField {LoadControlProgram(0),; + private final int id; + RegisterLoadControlProgramRequestCommandField(int id) { + this.id = id; + } + + public int getID() { + return id; + } + public static RegisterLoadControlProgramRequestCommandField value(int id) throws NoSuchFieldError { + for (RegisterLoadControlProgramRequestCommandField field : RegisterLoadControlProgramRequestCommandField.values()) { + if (field.getID() == id) { + return field; + } + } + throw new NoSuchFieldError(); + } + }public enum UnregisterLoadControlProgramRequestCommandField {LoadControlProgramID(0),; + private final int id; + UnregisterLoadControlProgramRequestCommandField(int id) { + this.id = id; + } + + public int getID() { + return id; + } + public static UnregisterLoadControlProgramRequestCommandField value(int id) throws NoSuchFieldError { + for (UnregisterLoadControlProgramRequestCommandField field : UnregisterLoadControlProgramRequestCommandField.values()) { + if (field.getID() == id) { + return field; + } + } + throw new NoSuchFieldError(); + } + }public enum AddLoadControlEventRequestCommandField {Event(0),; + private final int id; + AddLoadControlEventRequestCommandField(int id) { + this.id = id; + } + + public int getID() { + return id; + } + public static AddLoadControlEventRequestCommandField value(int id) throws NoSuchFieldError { + for (AddLoadControlEventRequestCommandField field : AddLoadControlEventRequestCommandField.values()) { + if (field.getID() == id) { + return field; + } + } + throw new NoSuchFieldError(); + } + }public enum RemoveLoadControlEventRequestCommandField {EventID(0),CancelControl(1),; + private final int id; + RemoveLoadControlEventRequestCommandField(int id) { + this.id = id; + } + + public int getID() { + return id; + } + public static RemoveLoadControlEventRequestCommandField value(int id) throws NoSuchFieldError { + for (RemoveLoadControlEventRequestCommandField field : RemoveLoadControlEventRequestCommandField.values()) { + if (field.getID() == id) { + return field; + } + } + 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 DoorLock implements BaseCluster { public static final long ID = 257L; 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 c5d9d1d9df7def..8f86942fe67027 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java @@ -9121,6 +9121,153 @@ public void onError(Exception ex) { } } + public static class DelegatedDemandResponseLoadControlClusterLoadControlProgramsAttributeCallback implements ChipClusters.DemandResponseLoadControlCluster.LoadControlProgramsAttributeCallback, 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 DelegatedDemandResponseLoadControlClusterEventsAttributeCallback implements ChipClusters.DemandResponseLoadControlCluster.EventsAttributeCallback, 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 DelegatedDemandResponseLoadControlClusterActiveEventsAttributeCallback implements ChipClusters.DemandResponseLoadControlCluster.ActiveEventsAttributeCallback, 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 DelegatedDemandResponseLoadControlClusterGeneratedCommandListAttributeCallback implements ChipClusters.DemandResponseLoadControlCluster.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 DelegatedDemandResponseLoadControlClusterAcceptedCommandListAttributeCallback implements ChipClusters.DemandResponseLoadControlCluster.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 DelegatedDemandResponseLoadControlClusterEventListAttributeCallback implements ChipClusters.DemandResponseLoadControlCluster.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 DelegatedDemandResponseLoadControlClusterAttributeListAttributeCallback implements ChipClusters.DemandResponseLoadControlCluster.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 DelegatedDoorLockClusterGetWeekDayScheduleResponseCallback implements ChipClusters.DoorLockCluster.GetWeekDayScheduleResponseCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @@ -17394,6 +17541,10 @@ public Map initializeClusterMap() { (ptr, endpointId) -> new ChipClusters.ActivatedCarbonFilterMonitoringCluster(ptr, endpointId), new HashMap<>()); clusterMap.put("activatedCarbonFilterMonitoring", activatedCarbonFilterMonitoringClusterInfo); + ClusterInfo demandResponseLoadControlClusterInfo = new ClusterInfo( + (ptr, endpointId) -> new ChipClusters.DemandResponseLoadControlCluster(ptr, endpointId), new HashMap<>()); + clusterMap.put("demandResponseLoadControl", demandResponseLoadControlClusterInfo); + ClusterInfo doorLockClusterInfo = new ClusterInfo( (ptr, endpointId) -> new ChipClusters.DoorLockCluster(ptr, endpointId), new HashMap<>()); clusterMap.put("doorLock", doorLockClusterInfo); @@ -17622,6 +17773,7 @@ public void combineCommand(Map destination, Map> getCommandMap() { commandMap.put("activatedCarbonFilterMonitoring", activatedCarbonFilterMonitoringClusterInteractionInfoMap); + Map demandResponseLoadControlClusterInteractionInfoMap = new LinkedHashMap<>(); + + Map demandResponseLoadControlregisterLoadControlProgramRequestCommandParams = new LinkedHashMap(); + + InteractionInfo demandResponseLoadControlregisterLoadControlProgramRequestInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DemandResponseLoadControlCluster) cluster) + .registerLoadControlProgramRequest((DefaultClusterCallback) callback + , (ChipStructs.DemandResponseLoadControlClusterLoadControlProgramStruct) + commandArguments.get("loadControlProgram") + ); + }, + () -> new DelegatedDefaultClusterCallback(), + demandResponseLoadControlregisterLoadControlProgramRequestCommandParams + ); + demandResponseLoadControlClusterInteractionInfoMap.put("registerLoadControlProgramRequest", demandResponseLoadControlregisterLoadControlProgramRequestInteractionInfo); + + Map demandResponseLoadControlunregisterLoadControlProgramRequestCommandParams = new LinkedHashMap(); + + CommandParameterInfo demandResponseLoadControlunregisterLoadControlProgramRequestloadControlProgramIDCommandParameterInfo = new CommandParameterInfo("loadControlProgramID", byte[].class, byte[].class); + demandResponseLoadControlunregisterLoadControlProgramRequestCommandParams.put("loadControlProgramID",demandResponseLoadControlunregisterLoadControlProgramRequestloadControlProgramIDCommandParameterInfo); + InteractionInfo demandResponseLoadControlunregisterLoadControlProgramRequestInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DemandResponseLoadControlCluster) cluster) + .unregisterLoadControlProgramRequest((DefaultClusterCallback) callback + , (byte[]) + commandArguments.get("loadControlProgramID") + ); + }, + () -> new DelegatedDefaultClusterCallback(), + demandResponseLoadControlunregisterLoadControlProgramRequestCommandParams + ); + demandResponseLoadControlClusterInteractionInfoMap.put("unregisterLoadControlProgramRequest", demandResponseLoadControlunregisterLoadControlProgramRequestInteractionInfo); + + Map demandResponseLoadControladdLoadControlEventRequestCommandParams = new LinkedHashMap(); + + InteractionInfo demandResponseLoadControladdLoadControlEventRequestInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DemandResponseLoadControlCluster) cluster) + .addLoadControlEventRequest((DefaultClusterCallback) callback + , (ChipStructs.DemandResponseLoadControlClusterLoadControlEventStruct) + commandArguments.get("event") + ); + }, + () -> new DelegatedDefaultClusterCallback(), + demandResponseLoadControladdLoadControlEventRequestCommandParams + ); + demandResponseLoadControlClusterInteractionInfoMap.put("addLoadControlEventRequest", demandResponseLoadControladdLoadControlEventRequestInteractionInfo); + + Map demandResponseLoadControlremoveLoadControlEventRequestCommandParams = new LinkedHashMap(); + + CommandParameterInfo demandResponseLoadControlremoveLoadControlEventRequesteventIDCommandParameterInfo = new CommandParameterInfo("eventID", byte[].class, byte[].class); + demandResponseLoadControlremoveLoadControlEventRequestCommandParams.put("eventID",demandResponseLoadControlremoveLoadControlEventRequesteventIDCommandParameterInfo); + + CommandParameterInfo demandResponseLoadControlremoveLoadControlEventRequestcancelControlCommandParameterInfo = new CommandParameterInfo("cancelControl", Integer.class, Integer.class); + demandResponseLoadControlremoveLoadControlEventRequestCommandParams.put("cancelControl",demandResponseLoadControlremoveLoadControlEventRequestcancelControlCommandParameterInfo); + InteractionInfo demandResponseLoadControlremoveLoadControlEventRequestInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DemandResponseLoadControlCluster) cluster) + .removeLoadControlEventRequest((DefaultClusterCallback) callback + , (byte[]) + commandArguments.get("eventID") + , (Integer) + commandArguments.get("cancelControl") + ); + }, + () -> new DelegatedDefaultClusterCallback(), + demandResponseLoadControlremoveLoadControlEventRequestCommandParams + ); + demandResponseLoadControlClusterInteractionInfoMap.put("removeLoadControlEventRequest", demandResponseLoadControlremoveLoadControlEventRequestInteractionInfo); + + Map demandResponseLoadControlclearLoadControlEventsRequestCommandParams = new LinkedHashMap(); + InteractionInfo demandResponseLoadControlclearLoadControlEventsRequestInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DemandResponseLoadControlCluster) cluster) + .clearLoadControlEventsRequest((DefaultClusterCallback) callback + ); + }, + () -> new DelegatedDefaultClusterCallback(), + demandResponseLoadControlclearLoadControlEventsRequestCommandParams + ); + demandResponseLoadControlClusterInteractionInfoMap.put("clearLoadControlEventsRequest", demandResponseLoadControlclearLoadControlEventsRequestInteractionInfo); + + commandMap.put("demandResponseLoadControl", demandResponseLoadControlClusterInteractionInfoMap); + Map doorLockClusterInteractionInfoMap = new LinkedHashMap<>(); Map doorLocklockDoorCommandParams = new LinkedHashMap(); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java index eae902b09073b9..4e1b64b42e125f 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java @@ -8284,6 +8284,175 @@ private static Map readActivatedCarbonFilterMonitoringI return result; } + private static Map readDemandResponseLoadControlInteractionInfo() { + Map result = new LinkedHashMap<>();Map readDemandResponseLoadControlDeviceClassCommandParams = new LinkedHashMap(); + InteractionInfo readDemandResponseLoadControlDeviceClassAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DemandResponseLoadControlCluster) cluster).readDeviceClassAttribute( + (ChipClusters.LongAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + readDemandResponseLoadControlDeviceClassCommandParams + ); + result.put("readDeviceClassAttribute", readDemandResponseLoadControlDeviceClassAttributeInteractionInfo); + Map readDemandResponseLoadControlLoadControlProgramsCommandParams = new LinkedHashMap(); + InteractionInfo readDemandResponseLoadControlLoadControlProgramsAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DemandResponseLoadControlCluster) cluster).readLoadControlProgramsAttribute( + (ChipClusters.DemandResponseLoadControlCluster.LoadControlProgramsAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedDemandResponseLoadControlClusterLoadControlProgramsAttributeCallback(), + readDemandResponseLoadControlLoadControlProgramsCommandParams + ); + result.put("readLoadControlProgramsAttribute", readDemandResponseLoadControlLoadControlProgramsAttributeInteractionInfo); + Map readDemandResponseLoadControlNumberOfLoadControlProgramsCommandParams = new LinkedHashMap(); + InteractionInfo readDemandResponseLoadControlNumberOfLoadControlProgramsAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DemandResponseLoadControlCluster) cluster).readNumberOfLoadControlProgramsAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readDemandResponseLoadControlNumberOfLoadControlProgramsCommandParams + ); + result.put("readNumberOfLoadControlProgramsAttribute", readDemandResponseLoadControlNumberOfLoadControlProgramsAttributeInteractionInfo); + Map readDemandResponseLoadControlEventsCommandParams = new LinkedHashMap(); + InteractionInfo readDemandResponseLoadControlEventsAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DemandResponseLoadControlCluster) cluster).readEventsAttribute( + (ChipClusters.DemandResponseLoadControlCluster.EventsAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedDemandResponseLoadControlClusterEventsAttributeCallback(), + readDemandResponseLoadControlEventsCommandParams + ); + result.put("readEventsAttribute", readDemandResponseLoadControlEventsAttributeInteractionInfo); + Map readDemandResponseLoadControlActiveEventsCommandParams = new LinkedHashMap(); + InteractionInfo readDemandResponseLoadControlActiveEventsAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DemandResponseLoadControlCluster) cluster).readActiveEventsAttribute( + (ChipClusters.DemandResponseLoadControlCluster.ActiveEventsAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedDemandResponseLoadControlClusterActiveEventsAttributeCallback(), + readDemandResponseLoadControlActiveEventsCommandParams + ); + result.put("readActiveEventsAttribute", readDemandResponseLoadControlActiveEventsAttributeInteractionInfo); + Map readDemandResponseLoadControlNumberOfEventsPerProgramCommandParams = new LinkedHashMap(); + InteractionInfo readDemandResponseLoadControlNumberOfEventsPerProgramAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DemandResponseLoadControlCluster) cluster).readNumberOfEventsPerProgramAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readDemandResponseLoadControlNumberOfEventsPerProgramCommandParams + ); + result.put("readNumberOfEventsPerProgramAttribute", readDemandResponseLoadControlNumberOfEventsPerProgramAttributeInteractionInfo); + Map readDemandResponseLoadControlNumberOfTransistionsCommandParams = new LinkedHashMap(); + InteractionInfo readDemandResponseLoadControlNumberOfTransistionsAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DemandResponseLoadControlCluster) cluster).readNumberOfTransistionsAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readDemandResponseLoadControlNumberOfTransistionsCommandParams + ); + result.put("readNumberOfTransistionsAttribute", readDemandResponseLoadControlNumberOfTransistionsAttributeInteractionInfo); + Map readDemandResponseLoadControlDefaultRandomStartCommandParams = new LinkedHashMap(); + InteractionInfo readDemandResponseLoadControlDefaultRandomStartAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DemandResponseLoadControlCluster) cluster).readDefaultRandomStartAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readDemandResponseLoadControlDefaultRandomStartCommandParams + ); + result.put("readDefaultRandomStartAttribute", readDemandResponseLoadControlDefaultRandomStartAttributeInteractionInfo); + Map readDemandResponseLoadControlDefaultRandomDurationCommandParams = new LinkedHashMap(); + InteractionInfo readDemandResponseLoadControlDefaultRandomDurationAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DemandResponseLoadControlCluster) cluster).readDefaultRandomDurationAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readDemandResponseLoadControlDefaultRandomDurationCommandParams + ); + result.put("readDefaultRandomDurationAttribute", readDemandResponseLoadControlDefaultRandomDurationAttributeInteractionInfo); + Map readDemandResponseLoadControlGeneratedCommandListCommandParams = new LinkedHashMap(); + InteractionInfo readDemandResponseLoadControlGeneratedCommandListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DemandResponseLoadControlCluster) cluster).readGeneratedCommandListAttribute( + (ChipClusters.DemandResponseLoadControlCluster.GeneratedCommandListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedDemandResponseLoadControlClusterGeneratedCommandListAttributeCallback(), + readDemandResponseLoadControlGeneratedCommandListCommandParams + ); + result.put("readGeneratedCommandListAttribute", readDemandResponseLoadControlGeneratedCommandListAttributeInteractionInfo); + Map readDemandResponseLoadControlAcceptedCommandListCommandParams = new LinkedHashMap(); + InteractionInfo readDemandResponseLoadControlAcceptedCommandListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DemandResponseLoadControlCluster) cluster).readAcceptedCommandListAttribute( + (ChipClusters.DemandResponseLoadControlCluster.AcceptedCommandListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedDemandResponseLoadControlClusterAcceptedCommandListAttributeCallback(), + readDemandResponseLoadControlAcceptedCommandListCommandParams + ); + result.put("readAcceptedCommandListAttribute", readDemandResponseLoadControlAcceptedCommandListAttributeInteractionInfo); + Map readDemandResponseLoadControlEventListCommandParams = new LinkedHashMap(); + InteractionInfo readDemandResponseLoadControlEventListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DemandResponseLoadControlCluster) cluster).readEventListAttribute( + (ChipClusters.DemandResponseLoadControlCluster.EventListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedDemandResponseLoadControlClusterEventListAttributeCallback(), + readDemandResponseLoadControlEventListCommandParams + ); + result.put("readEventListAttribute", readDemandResponseLoadControlEventListAttributeInteractionInfo); + Map readDemandResponseLoadControlAttributeListCommandParams = new LinkedHashMap(); + InteractionInfo readDemandResponseLoadControlAttributeListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DemandResponseLoadControlCluster) cluster).readAttributeListAttribute( + (ChipClusters.DemandResponseLoadControlCluster.AttributeListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedDemandResponseLoadControlClusterAttributeListAttributeCallback(), + readDemandResponseLoadControlAttributeListCommandParams + ); + result.put("readAttributeListAttribute", readDemandResponseLoadControlAttributeListAttributeInteractionInfo); + Map readDemandResponseLoadControlFeatureMapCommandParams = new LinkedHashMap(); + InteractionInfo readDemandResponseLoadControlFeatureMapAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DemandResponseLoadControlCluster) cluster).readFeatureMapAttribute( + (ChipClusters.LongAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + readDemandResponseLoadControlFeatureMapCommandParams + ); + result.put("readFeatureMapAttribute", readDemandResponseLoadControlFeatureMapAttributeInteractionInfo); + Map readDemandResponseLoadControlClusterRevisionCommandParams = new LinkedHashMap(); + InteractionInfo readDemandResponseLoadControlClusterRevisionAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DemandResponseLoadControlCluster) cluster).readClusterRevisionAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readDemandResponseLoadControlClusterRevisionCommandParams + ); + result.put("readClusterRevisionAttribute", readDemandResponseLoadControlClusterRevisionAttributeInteractionInfo); + + return result; + } private static Map readDoorLockInteractionInfo() { Map result = new LinkedHashMap<>();Map readDoorLockLockStateCommandParams = new LinkedHashMap(); InteractionInfo readDoorLockLockStateAttributeInteractionInfo = new InteractionInfo( @@ -17851,6 +18020,7 @@ public Map> getReadAttributeMap() { put("rvcOperationalState", readRvcOperationalStateInteractionInfo()); put("hepaFilterMonitoring", readHepaFilterMonitoringInteractionInfo()); put("activatedCarbonFilterMonitoring", readActivatedCarbonFilterMonitoringInteractionInfo()); + put("demandResponseLoadControl", readDemandResponseLoadControlInteractionInfo()); put("doorLock", readDoorLockInteractionInfo()); put("windowCovering", readWindowCoveringInteractionInfo()); put("barrierControl", readBarrierControlInteractionInfo()); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java index 03660cab51c6d0..2f14aa26764e42 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java @@ -1092,6 +1092,52 @@ public Map> getWriteAttributeMap() { ); writeActivatedCarbonFilterMonitoringInteractionInfo.put("writeLastChangedTimeAttribute", writeActivatedCarbonFilterMonitoringLastChangedTimeAttributeInteractionInfo); writeAttributeMap.put("activatedCarbonFilterMonitoring", writeActivatedCarbonFilterMonitoringInteractionInfo); + Map writeDemandResponseLoadControlInteractionInfo = new LinkedHashMap<>(); + Map writeDemandResponseLoadControlDefaultRandomStartCommandParams = new LinkedHashMap(); + CommandParameterInfo demandResponseLoadControldefaultRandomStartCommandParameterInfo = + new CommandParameterInfo( + "value", + Integer.class, + Integer.class + ); + writeDemandResponseLoadControlDefaultRandomStartCommandParams.put( + "value", + demandResponseLoadControldefaultRandomStartCommandParameterInfo + ); + InteractionInfo writeDemandResponseLoadControlDefaultRandomStartAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DemandResponseLoadControlCluster) cluster).writeDefaultRandomStartAttribute( + (DefaultClusterCallback) callback, + (Integer) commandArguments.get("value") + ); + }, + () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), + writeDemandResponseLoadControlDefaultRandomStartCommandParams + ); + writeDemandResponseLoadControlInteractionInfo.put("writeDefaultRandomStartAttribute", writeDemandResponseLoadControlDefaultRandomStartAttributeInteractionInfo); + Map writeDemandResponseLoadControlDefaultRandomDurationCommandParams = new LinkedHashMap(); + CommandParameterInfo demandResponseLoadControldefaultRandomDurationCommandParameterInfo = + new CommandParameterInfo( + "value", + Integer.class, + Integer.class + ); + writeDemandResponseLoadControlDefaultRandomDurationCommandParams.put( + "value", + demandResponseLoadControldefaultRandomDurationCommandParameterInfo + ); + InteractionInfo writeDemandResponseLoadControlDefaultRandomDurationAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DemandResponseLoadControlCluster) cluster).writeDefaultRandomDurationAttribute( + (DefaultClusterCallback) callback, + (Integer) commandArguments.get("value") + ); + }, + () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), + writeDemandResponseLoadControlDefaultRandomDurationCommandParams + ); + writeDemandResponseLoadControlInteractionInfo.put("writeDefaultRandomDurationAttribute", writeDemandResponseLoadControlDefaultRandomDurationAttributeInteractionInfo); + writeAttributeMap.put("demandResponseLoadControl", writeDemandResponseLoadControlInteractionInfo); Map writeDoorLockInteractionInfo = new LinkedHashMap<>(); Map writeDoorLockDoorOpenEventsCommandParams = new LinkedHashMap(); CommandParameterInfo doorLockdoorOpenEventsCommandParameterInfo = diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent.kt new file mode 100644 index 00000000000000..a4ab48a89bc770 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent.kt @@ -0,0 +1,244 @@ +/* + * + * 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.eventstructs + +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 DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent( + val eventID: ByteArray, + val transitionIndex: UInt?, + val status: UInt, + val criticality: UInt, + val control: UInt, + val temperatureControl: + Optional< + chip.devicecontroller.cluster.structs.DemandResponseLoadControlClusterTemperatureControlStruct + >?, + val averageLoadControl: + Optional< + chip.devicecontroller.cluster.structs.DemandResponseLoadControlClusterAverageLoadControlStruct + >?, + val dutyCycleControl: + Optional< + chip.devicecontroller.cluster.structs.DemandResponseLoadControlClusterDutyCycleControlStruct + >?, + val powerSavingsControl: + Optional< + chip.devicecontroller.cluster.structs.DemandResponseLoadControlClusterPowerSavingsControlStruct + >?, + val heatingSourceControl: + Optional< + chip.devicecontroller.cluster.structs.DemandResponseLoadControlClusterHeatingSourceControlStruct + >? +) { + override fun toString(): String = buildString { + append("DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent {\n") + append("\teventID : $eventID\n") + append("\ttransitionIndex : $transitionIndex\n") + append("\tstatus : $status\n") + append("\tcriticality : $criticality\n") + append("\tcontrol : $control\n") + append("\ttemperatureControl : $temperatureControl\n") + append("\taverageLoadControl : $averageLoadControl\n") + append("\tdutyCycleControl : $dutyCycleControl\n") + append("\tpowerSavingsControl : $powerSavingsControl\n") + append("\theatingSourceControl : $heatingSourceControl\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_EVENT_I_D), eventID) + if (transitionIndex != null) { + put(ContextSpecificTag(TAG_TRANSITION_INDEX), transitionIndex) + } else { + putNull(ContextSpecificTag(TAG_TRANSITION_INDEX)) + } + put(ContextSpecificTag(TAG_STATUS), status) + put(ContextSpecificTag(TAG_CRITICALITY), criticality) + put(ContextSpecificTag(TAG_CONTROL), control) + if (temperatureControl != null) { + if (temperatureControl.isPresent) { + val opttemperatureControl = temperatureControl.get() + opttemperatureControl.toTlv(ContextSpecificTag(TAG_TEMPERATURE_CONTROL), this) + } + } else { + putNull(ContextSpecificTag(TAG_TEMPERATURE_CONTROL)) + } + if (averageLoadControl != null) { + if (averageLoadControl.isPresent) { + val optaverageLoadControl = averageLoadControl.get() + optaverageLoadControl.toTlv(ContextSpecificTag(TAG_AVERAGE_LOAD_CONTROL), this) + } + } else { + putNull(ContextSpecificTag(TAG_AVERAGE_LOAD_CONTROL)) + } + if (dutyCycleControl != null) { + if (dutyCycleControl.isPresent) { + val optdutyCycleControl = dutyCycleControl.get() + optdutyCycleControl.toTlv(ContextSpecificTag(TAG_DUTY_CYCLE_CONTROL), this) + } + } else { + putNull(ContextSpecificTag(TAG_DUTY_CYCLE_CONTROL)) + } + if (powerSavingsControl != null) { + if (powerSavingsControl.isPresent) { + val optpowerSavingsControl = powerSavingsControl.get() + optpowerSavingsControl.toTlv(ContextSpecificTag(TAG_POWER_SAVINGS_CONTROL), this) + } + } else { + putNull(ContextSpecificTag(TAG_POWER_SAVINGS_CONTROL)) + } + if (heatingSourceControl != null) { + if (heatingSourceControl.isPresent) { + val optheatingSourceControl = heatingSourceControl.get() + optheatingSourceControl.toTlv(ContextSpecificTag(TAG_HEATING_SOURCE_CONTROL), this) + } + } else { + putNull(ContextSpecificTag(TAG_HEATING_SOURCE_CONTROL)) + } + endStructure() + } + } + + companion object { + private const val TAG_EVENT_I_D = 0 + private const val TAG_TRANSITION_INDEX = 1 + private const val TAG_STATUS = 2 + private const val TAG_CRITICALITY = 3 + private const val TAG_CONTROL = 4 + private const val TAG_TEMPERATURE_CONTROL = 5 + private const val TAG_AVERAGE_LOAD_CONTROL = 6 + private const val TAG_DUTY_CYCLE_CONTROL = 7 + private const val TAG_POWER_SAVINGS_CONTROL = 8 + private const val TAG_HEATING_SOURCE_CONTROL = 9 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent { + tlvReader.enterStructure(tlvTag) + val eventID = tlvReader.getByteArray(ContextSpecificTag(TAG_EVENT_I_D)) + val transitionIndex = + if (!tlvReader.isNull()) { + tlvReader.getUInt(ContextSpecificTag(TAG_TRANSITION_INDEX)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_TRANSITION_INDEX)) + null + } + val status = tlvReader.getUInt(ContextSpecificTag(TAG_STATUS)) + val criticality = tlvReader.getUInt(ContextSpecificTag(TAG_CRITICALITY)) + val control = tlvReader.getUInt(ContextSpecificTag(TAG_CONTROL)) + val temperatureControl = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_TEMPERATURE_CONTROL))) { + Optional.of( + chip.devicecontroller.cluster.structs + .DemandResponseLoadControlClusterTemperatureControlStruct + .fromTlv(ContextSpecificTag(TAG_TEMPERATURE_CONTROL), tlvReader) + ) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_TEMPERATURE_CONTROL)) + null + } + val averageLoadControl = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_AVERAGE_LOAD_CONTROL))) { + Optional.of( + chip.devicecontroller.cluster.structs + .DemandResponseLoadControlClusterAverageLoadControlStruct + .fromTlv(ContextSpecificTag(TAG_AVERAGE_LOAD_CONTROL), tlvReader) + ) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_AVERAGE_LOAD_CONTROL)) + null + } + val dutyCycleControl = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DUTY_CYCLE_CONTROL))) { + Optional.of( + chip.devicecontroller.cluster.structs + .DemandResponseLoadControlClusterDutyCycleControlStruct + .fromTlv(ContextSpecificTag(TAG_DUTY_CYCLE_CONTROL), tlvReader) + ) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_DUTY_CYCLE_CONTROL)) + null + } + val powerSavingsControl = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_POWER_SAVINGS_CONTROL))) { + Optional.of( + chip.devicecontroller.cluster.structs + .DemandResponseLoadControlClusterPowerSavingsControlStruct + .fromTlv(ContextSpecificTag(TAG_POWER_SAVINGS_CONTROL), tlvReader) + ) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_POWER_SAVINGS_CONTROL)) + null + } + val heatingSourceControl = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_HEATING_SOURCE_CONTROL))) { + Optional.of( + chip.devicecontroller.cluster.structs + .DemandResponseLoadControlClusterHeatingSourceControlStruct + .fromTlv(ContextSpecificTag(TAG_HEATING_SOURCE_CONTROL), tlvReader) + ) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_HEATING_SOURCE_CONTROL)) + null + } + + tlvReader.exitContainer() + + return DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent( + eventID, + transitionIndex, + status, + criticality, + control, + temperatureControl, + averageLoadControl, + dutyCycleControl, + powerSavingsControl, + heatingSourceControl + ) + } + } +} 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 85e9c85ce1e2cd..aaf9b5a5d48257 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni @@ -24,6 +24,14 @@ structs_sources = [ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterDimensionStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterParameterStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterStyleInformationStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterAverageLoadControlStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterDutyCycleControlStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterHeatingSourceControlStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlEventStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlEventTransitionStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlProgramStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterPowerSavingsControlStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterTemperatureControlStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DescriptorClusterDeviceTypeStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DescriptorClusterSemanticTagStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DishwasherModeClusterModeOptionStruct.kt", @@ -98,6 +106,7 @@ eventstructs_sources = [ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BooleanStateClusterStateChangeEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BridgedDeviceBasicInformationClusterReachableChangedEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BridgedDeviceBasicInformationClusterStartUpEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DishwasherAlarmClusterNotifyEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DoorLockClusterDoorLockAlarmEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DoorLockClusterDoorStateChangeEvent.kt", diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterAverageLoadControlStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterAverageLoadControlStruct.kt new file mode 100644 index 00000000000000..a4dd7c659efb22 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterAverageLoadControlStruct.kt @@ -0,0 +1,55 @@ +/* + * + * 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 DemandResponseLoadControlClusterAverageLoadControlStruct(val loadAdjustment: Int) { + override fun toString(): String = buildString { + append("DemandResponseLoadControlClusterAverageLoadControlStruct {\n") + append("\tloadAdjustment : $loadAdjustment\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_LOAD_ADJUSTMENT), loadAdjustment) + endStructure() + } + } + + companion object { + private const val TAG_LOAD_ADJUSTMENT = 0 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): DemandResponseLoadControlClusterAverageLoadControlStruct { + tlvReader.enterStructure(tlvTag) + val loadAdjustment = tlvReader.getInt(ContextSpecificTag(TAG_LOAD_ADJUSTMENT)) + + tlvReader.exitContainer() + + return DemandResponseLoadControlClusterAverageLoadControlStruct(loadAdjustment) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterDutyCycleControlStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterDutyCycleControlStruct.kt new file mode 100644 index 00000000000000..af1ad8026cc11b --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterDutyCycleControlStruct.kt @@ -0,0 +1,55 @@ +/* + * + * 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 DemandResponseLoadControlClusterDutyCycleControlStruct(val dutyCycle: UInt) { + override fun toString(): String = buildString { + append("DemandResponseLoadControlClusterDutyCycleControlStruct {\n") + append("\tdutyCycle : $dutyCycle\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_DUTY_CYCLE), dutyCycle) + endStructure() + } + } + + companion object { + private const val TAG_DUTY_CYCLE = 0 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): DemandResponseLoadControlClusterDutyCycleControlStruct { + tlvReader.enterStructure(tlvTag) + val dutyCycle = tlvReader.getUInt(ContextSpecificTag(TAG_DUTY_CYCLE)) + + tlvReader.exitContainer() + + return DemandResponseLoadControlClusterDutyCycleControlStruct(dutyCycle) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterHeatingSourceControlStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterHeatingSourceControlStruct.kt new file mode 100644 index 00000000000000..049c061b9966e1 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterHeatingSourceControlStruct.kt @@ -0,0 +1,55 @@ +/* + * + * 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 DemandResponseLoadControlClusterHeatingSourceControlStruct(val heatingSource: UInt) { + override fun toString(): String = buildString { + append("DemandResponseLoadControlClusterHeatingSourceControlStruct {\n") + append("\theatingSource : $heatingSource\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_HEATING_SOURCE), heatingSource) + endStructure() + } + } + + companion object { + private const val TAG_HEATING_SOURCE = 0 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): DemandResponseLoadControlClusterHeatingSourceControlStruct { + tlvReader.enterStructure(tlvTag) + val heatingSource = tlvReader.getUInt(ContextSpecificTag(TAG_HEATING_SOURCE)) + + tlvReader.exitContainer() + + return DemandResponseLoadControlClusterHeatingSourceControlStruct(heatingSource) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlEventStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlEventStruct.kt new file mode 100644 index 00000000000000..f714af6d7b8fbd --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlEventStruct.kt @@ -0,0 +1,147 @@ +/* + * + * 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 DemandResponseLoadControlClusterLoadControlEventStruct( + val eventID: ByteArray, + val programID: ByteArray?, + val control: UInt, + val deviceClass: ULong, + val enrollmentGroup: Optional, + val criticality: UInt, + val startTime: ULong?, + val transitions: List +) { + override fun toString(): String = buildString { + append("DemandResponseLoadControlClusterLoadControlEventStruct {\n") + append("\teventID : $eventID\n") + append("\tprogramID : $programID\n") + append("\tcontrol : $control\n") + append("\tdeviceClass : $deviceClass\n") + append("\tenrollmentGroup : $enrollmentGroup\n") + append("\tcriticality : $criticality\n") + append("\tstartTime : $startTime\n") + append("\ttransitions : $transitions\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_EVENT_I_D), eventID) + if (programID != null) { + put(ContextSpecificTag(TAG_PROGRAM_I_D), programID) + } else { + putNull(ContextSpecificTag(TAG_PROGRAM_I_D)) + } + put(ContextSpecificTag(TAG_CONTROL), control) + put(ContextSpecificTag(TAG_DEVICE_CLASS), deviceClass) + if (enrollmentGroup.isPresent) { + val optenrollmentGroup = enrollmentGroup.get() + put(ContextSpecificTag(TAG_ENROLLMENT_GROUP), optenrollmentGroup) + } + put(ContextSpecificTag(TAG_CRITICALITY), criticality) + if (startTime != null) { + put(ContextSpecificTag(TAG_START_TIME), startTime) + } else { + putNull(ContextSpecificTag(TAG_START_TIME)) + } + startArray(ContextSpecificTag(TAG_TRANSITIONS)) + for (item in transitions.iterator()) { + item.toTlv(AnonymousTag, this) + } + endArray() + endStructure() + } + } + + companion object { + private const val TAG_EVENT_I_D = 0 + private const val TAG_PROGRAM_I_D = 1 + private const val TAG_CONTROL = 2 + private const val TAG_DEVICE_CLASS = 3 + private const val TAG_ENROLLMENT_GROUP = 4 + private const val TAG_CRITICALITY = 5 + private const val TAG_START_TIME = 6 + private const val TAG_TRANSITIONS = 7 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): DemandResponseLoadControlClusterLoadControlEventStruct { + tlvReader.enterStructure(tlvTag) + val eventID = tlvReader.getByteArray(ContextSpecificTag(TAG_EVENT_I_D)) + val programID = + if (!tlvReader.isNull()) { + tlvReader.getByteArray(ContextSpecificTag(TAG_PROGRAM_I_D)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_PROGRAM_I_D)) + null + } + val control = tlvReader.getUInt(ContextSpecificTag(TAG_CONTROL)) + val deviceClass = tlvReader.getULong(ContextSpecificTag(TAG_DEVICE_CLASS)) + val enrollmentGroup = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_ENROLLMENT_GROUP))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_ENROLLMENT_GROUP))) + } else { + Optional.empty() + } + val criticality = tlvReader.getUInt(ContextSpecificTag(TAG_CRITICALITY)) + val startTime = + if (!tlvReader.isNull()) { + tlvReader.getULong(ContextSpecificTag(TAG_START_TIME)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_START_TIME)) + null + } + val transitions = + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_TRANSITIONS)) + while (!tlvReader.isEndOfContainer()) { + add( + DemandResponseLoadControlClusterLoadControlEventTransitionStruct.fromTlv( + AnonymousTag, + tlvReader + ) + ) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return DemandResponseLoadControlClusterLoadControlEventStruct( + eventID, + programID, + control, + deviceClass, + enrollmentGroup, + criticality, + startTime, + transitions + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlEventTransitionStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlEventTransitionStruct.kt new file mode 100644 index 00000000000000..6d44b1e020d180 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlEventTransitionStruct.kt @@ -0,0 +1,161 @@ +/* + * + * 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 DemandResponseLoadControlClusterLoadControlEventTransitionStruct( + val duration: UInt, + val control: UInt, + val temperatureControl: Optional, + val averageLoadControl: Optional, + val dutyCycleControl: Optional, + val powerSavingsControl: Optional, + val heatingSourceControl: Optional +) { + override fun toString(): String = buildString { + append("DemandResponseLoadControlClusterLoadControlEventTransitionStruct {\n") + append("\tduration : $duration\n") + append("\tcontrol : $control\n") + append("\ttemperatureControl : $temperatureControl\n") + append("\taverageLoadControl : $averageLoadControl\n") + append("\tdutyCycleControl : $dutyCycleControl\n") + append("\tpowerSavingsControl : $powerSavingsControl\n") + append("\theatingSourceControl : $heatingSourceControl\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_DURATION), duration) + put(ContextSpecificTag(TAG_CONTROL), control) + if (temperatureControl.isPresent) { + val opttemperatureControl = temperatureControl.get() + opttemperatureControl.toTlv(ContextSpecificTag(TAG_TEMPERATURE_CONTROL), this) + } + if (averageLoadControl.isPresent) { + val optaverageLoadControl = averageLoadControl.get() + optaverageLoadControl.toTlv(ContextSpecificTag(TAG_AVERAGE_LOAD_CONTROL), this) + } + if (dutyCycleControl.isPresent) { + val optdutyCycleControl = dutyCycleControl.get() + optdutyCycleControl.toTlv(ContextSpecificTag(TAG_DUTY_CYCLE_CONTROL), this) + } + if (powerSavingsControl.isPresent) { + val optpowerSavingsControl = powerSavingsControl.get() + optpowerSavingsControl.toTlv(ContextSpecificTag(TAG_POWER_SAVINGS_CONTROL), this) + } + if (heatingSourceControl.isPresent) { + val optheatingSourceControl = heatingSourceControl.get() + optheatingSourceControl.toTlv(ContextSpecificTag(TAG_HEATING_SOURCE_CONTROL), this) + } + endStructure() + } + } + + companion object { + private const val TAG_DURATION = 0 + private const val TAG_CONTROL = 1 + private const val TAG_TEMPERATURE_CONTROL = 2 + private const val TAG_AVERAGE_LOAD_CONTROL = 3 + private const val TAG_DUTY_CYCLE_CONTROL = 4 + private const val TAG_POWER_SAVINGS_CONTROL = 5 + private const val TAG_HEATING_SOURCE_CONTROL = 6 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): DemandResponseLoadControlClusterLoadControlEventTransitionStruct { + tlvReader.enterStructure(tlvTag) + val duration = tlvReader.getUInt(ContextSpecificTag(TAG_DURATION)) + val control = tlvReader.getUInt(ContextSpecificTag(TAG_CONTROL)) + val temperatureControl = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_TEMPERATURE_CONTROL))) { + Optional.of( + DemandResponseLoadControlClusterTemperatureControlStruct.fromTlv( + ContextSpecificTag(TAG_TEMPERATURE_CONTROL), + tlvReader + ) + ) + } else { + Optional.empty() + } + val averageLoadControl = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_AVERAGE_LOAD_CONTROL))) { + Optional.of( + DemandResponseLoadControlClusterAverageLoadControlStruct.fromTlv( + ContextSpecificTag(TAG_AVERAGE_LOAD_CONTROL), + tlvReader + ) + ) + } else { + Optional.empty() + } + val dutyCycleControl = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DUTY_CYCLE_CONTROL))) { + Optional.of( + DemandResponseLoadControlClusterDutyCycleControlStruct.fromTlv( + ContextSpecificTag(TAG_DUTY_CYCLE_CONTROL), + tlvReader + ) + ) + } else { + Optional.empty() + } + val powerSavingsControl = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_POWER_SAVINGS_CONTROL))) { + Optional.of( + DemandResponseLoadControlClusterPowerSavingsControlStruct.fromTlv( + ContextSpecificTag(TAG_POWER_SAVINGS_CONTROL), + tlvReader + ) + ) + } else { + Optional.empty() + } + val heatingSourceControl = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_HEATING_SOURCE_CONTROL))) { + Optional.of( + DemandResponseLoadControlClusterHeatingSourceControlStruct.fromTlv( + ContextSpecificTag(TAG_HEATING_SOURCE_CONTROL), + tlvReader + ) + ) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return DemandResponseLoadControlClusterLoadControlEventTransitionStruct( + duration, + control, + temperatureControl, + averageLoadControl, + dutyCycleControl, + powerSavingsControl, + heatingSourceControl + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlProgramStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlProgramStruct.kt new file mode 100644 index 00000000000000..289e4b0a1dbebf --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlProgramStruct.kt @@ -0,0 +1,113 @@ +/* + * + * 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 DemandResponseLoadControlClusterLoadControlProgramStruct( + val programID: ByteArray, + val name: String, + val enrollmentGroup: UInt?, + val randomStartMinutes: UInt?, + val randomDurationMinutes: UInt? +) { + override fun toString(): String = buildString { + append("DemandResponseLoadControlClusterLoadControlProgramStruct {\n") + append("\tprogramID : $programID\n") + append("\tname : $name\n") + append("\tenrollmentGroup : $enrollmentGroup\n") + append("\trandomStartMinutes : $randomStartMinutes\n") + append("\trandomDurationMinutes : $randomDurationMinutes\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_PROGRAM_I_D), programID) + put(ContextSpecificTag(TAG_NAME), name) + if (enrollmentGroup != null) { + put(ContextSpecificTag(TAG_ENROLLMENT_GROUP), enrollmentGroup) + } else { + putNull(ContextSpecificTag(TAG_ENROLLMENT_GROUP)) + } + if (randomStartMinutes != null) { + put(ContextSpecificTag(TAG_RANDOM_START_MINUTES), randomStartMinutes) + } else { + putNull(ContextSpecificTag(TAG_RANDOM_START_MINUTES)) + } + if (randomDurationMinutes != null) { + put(ContextSpecificTag(TAG_RANDOM_DURATION_MINUTES), randomDurationMinutes) + } else { + putNull(ContextSpecificTag(TAG_RANDOM_DURATION_MINUTES)) + } + endStructure() + } + } + + companion object { + private const val TAG_PROGRAM_I_D = 0 + private const val TAG_NAME = 1 + private const val TAG_ENROLLMENT_GROUP = 2 + private const val TAG_RANDOM_START_MINUTES = 3 + private const val TAG_RANDOM_DURATION_MINUTES = 4 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): DemandResponseLoadControlClusterLoadControlProgramStruct { + tlvReader.enterStructure(tlvTag) + val programID = tlvReader.getByteArray(ContextSpecificTag(TAG_PROGRAM_I_D)) + val name = tlvReader.getString(ContextSpecificTag(TAG_NAME)) + val enrollmentGroup = + if (!tlvReader.isNull()) { + tlvReader.getUInt(ContextSpecificTag(TAG_ENROLLMENT_GROUP)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_ENROLLMENT_GROUP)) + null + } + val randomStartMinutes = + if (!tlvReader.isNull()) { + tlvReader.getUInt(ContextSpecificTag(TAG_RANDOM_START_MINUTES)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_RANDOM_START_MINUTES)) + null + } + val randomDurationMinutes = + if (!tlvReader.isNull()) { + tlvReader.getUInt(ContextSpecificTag(TAG_RANDOM_DURATION_MINUTES)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_RANDOM_DURATION_MINUTES)) + null + } + + tlvReader.exitContainer() + + return DemandResponseLoadControlClusterLoadControlProgramStruct( + programID, + name, + enrollmentGroup, + randomStartMinutes, + randomDurationMinutes + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterPowerSavingsControlStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterPowerSavingsControlStruct.kt new file mode 100644 index 00000000000000..30ed601d4ac156 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterPowerSavingsControlStruct.kt @@ -0,0 +1,55 @@ +/* + * + * 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 DemandResponseLoadControlClusterPowerSavingsControlStruct(val powerSavings: UInt) { + override fun toString(): String = buildString { + append("DemandResponseLoadControlClusterPowerSavingsControlStruct {\n") + append("\tpowerSavings : $powerSavings\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_POWER_SAVINGS), powerSavings) + endStructure() + } + } + + companion object { + private const val TAG_POWER_SAVINGS = 0 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): DemandResponseLoadControlClusterPowerSavingsControlStruct { + tlvReader.enterStructure(tlvTag) + val powerSavings = tlvReader.getUInt(ContextSpecificTag(TAG_POWER_SAVINGS)) + + tlvReader.exitContainer() + + return DemandResponseLoadControlClusterPowerSavingsControlStruct(powerSavings) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterScopedLoadControlEventStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterScopedLoadControlEventStruct.kt new file mode 100644 index 00000000000000..6a02cd2f755090 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterScopedLoadControlEventStruct.kt @@ -0,0 +1,144 @@ +/* + * + * 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 DemandResponseLoadControlClusterScopedLoadControlEventStruct( + val eventID: ByteArray, + val programControl: ByteArray, + val control: UInt, + val deviceClass: ULong, + val enrollmentGroup: UInt?, + val criticality: UInt, + val startTime: ULong?, + val transitions: List, + val fabricIndex: UInt +) { + override fun toString(): String = buildString { + append("DemandResponseLoadControlClusterScopedLoadControlEventStruct {\n") + append("\teventID : $eventID\n") + append("\tprogramControl : $programControl\n") + append("\tcontrol : $control\n") + append("\tdeviceClass : $deviceClass\n") + append("\tenrollmentGroup : $enrollmentGroup\n") + append("\tcriticality : $criticality\n") + append("\tstartTime : $startTime\n") + append("\ttransitions : $transitions\n") + append("\tfabricIndex : $fabricIndex\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_EVENT_I_D), eventID) + put(ContextSpecificTag(TAG_PROGRAM_CONTROL), programControl) + put(ContextSpecificTag(TAG_CONTROL), control) + put(ContextSpecificTag(TAG_DEVICE_CLASS), deviceClass) + if (enrollmentGroup != null) { + put(ContextSpecificTag(TAG_ENROLLMENT_GROUP), enrollmentGroup) + } else { + putNull(ContextSpecificTag(TAG_ENROLLMENT_GROUP)) + } + put(ContextSpecificTag(TAG_CRITICALITY), criticality) + if (startTime != null) { + put(ContextSpecificTag(TAG_START_TIME), startTime) + } else { + putNull(ContextSpecificTag(TAG_START_TIME)) + } + startArray(ContextSpecificTag(TAG_TRANSITIONS)) + for (item in transitions.iterator()) { + item.toTlv(AnonymousTag, this) + } + endArray() + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + endStructure() + } + } + + companion object { + private const val TAG_EVENT_I_D = 0 + private const val TAG_PROGRAM_CONTROL = 1 + private const val TAG_CONTROL = 2 + private const val TAG_DEVICE_CLASS = 3 + private const val TAG_ENROLLMENT_GROUP = 4 + private const val TAG_CRITICALITY = 5 + private const val TAG_START_TIME = 6 + private const val TAG_TRANSITIONS = 7 + private const val TAG_FABRIC_INDEX = 254 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): DemandResponseLoadControlClusterScopedLoadControlEventStruct { + tlvReader.enterStructure(tlvTag) + val eventID = tlvReader.getByteArray(ContextSpecificTag(TAG_EVENT_I_D)) + val programControl = tlvReader.getByteArray(ContextSpecificTag(TAG_PROGRAM_CONTROL)) + val control = tlvReader.getUInt(ContextSpecificTag(TAG_CONTROL)) + val deviceClass = tlvReader.getULong(ContextSpecificTag(TAG_DEVICE_CLASS)) + val enrollmentGroup = + if (!tlvReader.isNull()) { + tlvReader.getUInt(ContextSpecificTag(TAG_ENROLLMENT_GROUP)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_ENROLLMENT_GROUP)) + null + } + val criticality = tlvReader.getUInt(ContextSpecificTag(TAG_CRITICALITY)) + val startTime = + if (!tlvReader.isNull()) { + tlvReader.getULong(ContextSpecificTag(TAG_START_TIME)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_START_TIME)) + null + } + val transitions = + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_TRANSITIONS)) + while (!tlvReader.isEndOfContainer()) { + add( + DemandResponseLoadControlClusterLoadControlEventTransitionStruct.fromTlv( + AnonymousTag, + tlvReader + ) + ) + } + tlvReader.exitContainer() + } + val fabricIndex = tlvReader.getUInt(ContextSpecificTag(TAG_FABRIC_INDEX)) + + tlvReader.exitContainer() + + return DemandResponseLoadControlClusterScopedLoadControlEventStruct( + eventID, + programControl, + control, + deviceClass, + enrollmentGroup, + criticality, + startTime, + transitions, + fabricIndex + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterTemperatureControlStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterTemperatureControlStruct.kt new file mode 100644 index 00000000000000..925c1db888410a --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterTemperatureControlStruct.kt @@ -0,0 +1,146 @@ +/* + * + * 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 DemandResponseLoadControlClusterTemperatureControlStruct( + val coolingTempOffset: Optional?, + val heatingtTempOffset: Optional?, + val coolingTempSetpoint: Optional?, + val heatingTempSetpoint: Optional? +) { + override fun toString(): String = buildString { + append("DemandResponseLoadControlClusterTemperatureControlStruct {\n") + append("\tcoolingTempOffset : $coolingTempOffset\n") + append("\theatingtTempOffset : $heatingtTempOffset\n") + append("\tcoolingTempSetpoint : $coolingTempSetpoint\n") + append("\theatingTempSetpoint : $heatingTempSetpoint\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (coolingTempOffset != null) { + if (coolingTempOffset.isPresent) { + val optcoolingTempOffset = coolingTempOffset.get() + put(ContextSpecificTag(TAG_COOLING_TEMP_OFFSET), optcoolingTempOffset) + } + } else { + putNull(ContextSpecificTag(TAG_COOLING_TEMP_OFFSET)) + } + if (heatingtTempOffset != null) { + if (heatingtTempOffset.isPresent) { + val optheatingtTempOffset = heatingtTempOffset.get() + put(ContextSpecificTag(TAG_HEATINGT_TEMP_OFFSET), optheatingtTempOffset) + } + } else { + putNull(ContextSpecificTag(TAG_HEATINGT_TEMP_OFFSET)) + } + if (coolingTempSetpoint != null) { + if (coolingTempSetpoint.isPresent) { + val optcoolingTempSetpoint = coolingTempSetpoint.get() + put(ContextSpecificTag(TAG_COOLING_TEMP_SETPOINT), optcoolingTempSetpoint) + } + } else { + putNull(ContextSpecificTag(TAG_COOLING_TEMP_SETPOINT)) + } + if (heatingTempSetpoint != null) { + if (heatingTempSetpoint.isPresent) { + val optheatingTempSetpoint = heatingTempSetpoint.get() + put(ContextSpecificTag(TAG_HEATING_TEMP_SETPOINT), optheatingTempSetpoint) + } + } else { + putNull(ContextSpecificTag(TAG_HEATING_TEMP_SETPOINT)) + } + endStructure() + } + } + + companion object { + private const val TAG_COOLING_TEMP_OFFSET = 0 + private const val TAG_HEATINGT_TEMP_OFFSET = 1 + private const val TAG_COOLING_TEMP_SETPOINT = 2 + private const val TAG_HEATING_TEMP_SETPOINT = 3 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): DemandResponseLoadControlClusterTemperatureControlStruct { + tlvReader.enterStructure(tlvTag) + val coolingTempOffset = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_COOLING_TEMP_OFFSET))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_COOLING_TEMP_OFFSET))) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_COOLING_TEMP_OFFSET)) + null + } + val heatingtTempOffset = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_HEATINGT_TEMP_OFFSET))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_HEATINGT_TEMP_OFFSET))) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_HEATINGT_TEMP_OFFSET)) + null + } + val coolingTempSetpoint = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_COOLING_TEMP_SETPOINT))) { + Optional.of(tlvReader.getInt(ContextSpecificTag(TAG_COOLING_TEMP_SETPOINT))) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_COOLING_TEMP_SETPOINT)) + null + } + val heatingTempSetpoint = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_HEATING_TEMP_SETPOINT))) { + Optional.of(tlvReader.getInt(ContextSpecificTag(TAG_HEATING_TEMP_SETPOINT))) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_HEATING_TEMP_SETPOINT)) + null + } + + tlvReader.exitContainer() + + return DemandResponseLoadControlClusterTemperatureControlStruct( + coolingTempOffset, + heatingtTempOffset, + coolingTempSetpoint, + heatingTempSetpoint + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/DemandResponseLoadControlCluster.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/DemandResponseLoadControlCluster.kt new file mode 100644 index 00000000000000..f2e3ce480e1eb4 --- /dev/null +++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/DemandResponseLoadControlCluster.kt @@ -0,0 +1,268 @@ +/* + * + * 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.devicecontroller.cluster.clusters + +import matter.controller.MatterController +import matter.devicecontroller.cluster.structs.* + +class DemandResponseLoadControlCluster( + private val controller: MatterController, + private val endpointId: UShort +) { + class LoadControlProgramsAttribute( + val value: List + ) + + class EventsAttribute(val value: List) + + class ActiveEventsAttribute( + val value: List + ) + + class GeneratedCommandListAttribute(val value: List) + + class AcceptedCommandListAttribute(val value: List) + + class EventListAttribute(val value: List) + + class AttributeListAttribute(val value: List) + + suspend fun registerLoadControlProgramRequest( + loadControlProgram: DemandResponseLoadControlClusterLoadControlProgramStruct, + timedInvokeTimeoutMs: Int? = null + ) { + val commandId = 0L + + if (timedInvokeTimeoutMs != null) { + // Do the action with timedInvokeTimeoutMs + } else { + // Do the action without timedInvokeTimeoutMs + } + } + + suspend fun unregisterLoadControlProgramRequest( + loadControlProgramID: ByteArray, + timedInvokeTimeoutMs: Int? = null + ) { + val commandId = 1L + + if (timedInvokeTimeoutMs != null) { + // Do the action with timedInvokeTimeoutMs + } else { + // Do the action without timedInvokeTimeoutMs + } + } + + suspend fun addLoadControlEventRequest( + event: DemandResponseLoadControlClusterLoadControlEventStruct, + timedInvokeTimeoutMs: Int? = null + ) { + val commandId = 2L + + if (timedInvokeTimeoutMs != null) { + // Do the action with timedInvokeTimeoutMs + } else { + // Do the action without timedInvokeTimeoutMs + } + } + + suspend fun removeLoadControlEventRequest( + eventID: ByteArray, + cancelControl: UInt, + timedInvokeTimeoutMs: Int? = null + ) { + val commandId = 3L + + if (timedInvokeTimeoutMs != null) { + // Do the action with timedInvokeTimeoutMs + } else { + // Do the action without timedInvokeTimeoutMs + } + } + + suspend fun clearLoadControlEventsRequest(timedInvokeTimeoutMs: Int? = null) { + val commandId = 4L + + if (timedInvokeTimeoutMs != null) { + // Do the action with timedInvokeTimeoutMs + } else { + // Do the action without timedInvokeTimeoutMs + } + } + + suspend fun readDeviceClassAttribute(): UInt { + // Implementation needs to be added here + } + + suspend fun subscribeDeviceClassAttribute(minInterval: Int, maxInterval: Int): UInt { + // Implementation needs to be added here + } + + suspend fun readLoadControlProgramsAttribute(): LoadControlProgramsAttribute { + // Implementation needs to be added here + } + + suspend fun subscribeLoadControlProgramsAttribute( + minInterval: Int, + maxInterval: Int + ): LoadControlProgramsAttribute { + // Implementation needs to be added here + } + + suspend fun readNumberOfLoadControlProgramsAttribute(): UByte { + // Implementation needs to be added here + } + + suspend fun subscribeNumberOfLoadControlProgramsAttribute( + minInterval: Int, + maxInterval: Int + ): UByte { + // Implementation needs to be added here + } + + suspend fun readEventsAttribute(): EventsAttribute { + // Implementation needs to be added here + } + + suspend fun subscribeEventsAttribute(minInterval: Int, maxInterval: Int): EventsAttribute { + // Implementation needs to be added here + } + + suspend fun readActiveEventsAttribute(): ActiveEventsAttribute { + // Implementation needs to be added here + } + + suspend fun subscribeActiveEventsAttribute( + minInterval: Int, + maxInterval: Int + ): ActiveEventsAttribute { + // Implementation needs to be added here + } + + suspend fun readNumberOfEventsPerProgramAttribute(): UByte { + // Implementation needs to be added here + } + + suspend fun subscribeNumberOfEventsPerProgramAttribute( + minInterval: Int, + maxInterval: Int + ): UByte { + // Implementation needs to be added here + } + + suspend fun readNumberOfTransistionsAttribute(): UByte { + // Implementation needs to be added here + } + + suspend fun subscribeNumberOfTransistionsAttribute(minInterval: Int, maxInterval: Int): UByte { + // Implementation needs to be added here + } + + suspend fun readDefaultRandomStartAttribute(): UByte { + // Implementation needs to be added here + } + + suspend fun writeDefaultRandomStartAttribute(value: UByte, timedWriteTimeoutMs: Int? = null) { + if (timedWriteTimeoutMs != null) { + // Do the action with timedWriteTimeoutMs + } else { + // Do the action without timedWriteTimeoutMs + } + } + + suspend fun subscribeDefaultRandomStartAttribute(minInterval: Int, maxInterval: Int): UByte { + // Implementation needs to be added here + } + + suspend fun readDefaultRandomDurationAttribute(): UByte { + // Implementation needs to be added here + } + + suspend fun writeDefaultRandomDurationAttribute(value: UByte, timedWriteTimeoutMs: Int? = null) { + if (timedWriteTimeoutMs != null) { + // Do the action with timedWriteTimeoutMs + } else { + // Do the action without timedWriteTimeoutMs + } + } + + suspend fun subscribeDefaultRandomDurationAttribute(minInterval: Int, maxInterval: Int): UByte { + // Implementation needs to be added here + } + + suspend fun readGeneratedCommandListAttribute(): GeneratedCommandListAttribute { + // Implementation needs to be added here + } + + suspend fun subscribeGeneratedCommandListAttribute( + minInterval: Int, + maxInterval: Int + ): GeneratedCommandListAttribute { + // Implementation needs to be added here + } + + suspend fun readAcceptedCommandListAttribute(): AcceptedCommandListAttribute { + // Implementation needs to be added here + } + + suspend fun subscribeAcceptedCommandListAttribute( + minInterval: Int, + maxInterval: Int + ): AcceptedCommandListAttribute { + // Implementation needs to be added here + } + + suspend fun readEventListAttribute(): EventListAttribute { + // Implementation needs to be added here + } + + suspend fun subscribeEventListAttribute(minInterval: Int, maxInterval: Int): EventListAttribute { + // Implementation needs to be added here + } + + suspend fun readAttributeListAttribute(): AttributeListAttribute { + // Implementation needs to be added here + } + + suspend fun subscribeAttributeListAttribute( + minInterval: Int, + maxInterval: Int + ): AttributeListAttribute { + // Implementation needs to be added here + } + + suspend fun readFeatureMapAttribute(): UInt { + // Implementation needs to be added here + } + + suspend fun subscribeFeatureMapAttribute(minInterval: Int, maxInterval: Int): UInt { + // Implementation needs to be added here + } + + suspend fun readClusterRevisionAttribute(): UShort { + // Implementation needs to be added here + } + + suspend fun subscribeClusterRevisionAttribute(minInterval: Int, maxInterval: Int): UShort { + // Implementation needs to be added here + } + + companion object { + const val CLUSTER_ID: UInt = 150u + } +} diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent.kt new file mode 100644 index 00000000000000..92b680ff01eb05 --- /dev/null +++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent.kt @@ -0,0 +1,244 @@ +/* + * + * 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.devicecontroller.cluster.eventstructs + +import java.util.Optional +import matter.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent( + val eventID: ByteArray, + val transitionIndex: UByte?, + val status: UInt, + val criticality: UInt, + val control: UInt, + val temperatureControl: + Optional< + matter.devicecontroller.cluster.structs.DemandResponseLoadControlClusterTemperatureControlStruct + >?, + val averageLoadControl: + Optional< + matter.devicecontroller.cluster.structs.DemandResponseLoadControlClusterAverageLoadControlStruct + >?, + val dutyCycleControl: + Optional< + matter.devicecontroller.cluster.structs.DemandResponseLoadControlClusterDutyCycleControlStruct + >?, + val powerSavingsControl: + Optional< + matter.devicecontroller.cluster.structs.DemandResponseLoadControlClusterPowerSavingsControlStruct + >?, + val heatingSourceControl: + Optional< + matter.devicecontroller.cluster.structs.DemandResponseLoadControlClusterHeatingSourceControlStruct + >? +) { + override fun toString(): String = buildString { + append("DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent {\n") + append("\teventID : $eventID\n") + append("\ttransitionIndex : $transitionIndex\n") + append("\tstatus : $status\n") + append("\tcriticality : $criticality\n") + append("\tcontrol : $control\n") + append("\ttemperatureControl : $temperatureControl\n") + append("\taverageLoadControl : $averageLoadControl\n") + append("\tdutyCycleControl : $dutyCycleControl\n") + append("\tpowerSavingsControl : $powerSavingsControl\n") + append("\theatingSourceControl : $heatingSourceControl\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_EVENT_I_D), eventID) + if (transitionIndex != null) { + put(ContextSpecificTag(TAG_TRANSITION_INDEX), transitionIndex) + } else { + putNull(ContextSpecificTag(TAG_TRANSITION_INDEX)) + } + put(ContextSpecificTag(TAG_STATUS), status) + put(ContextSpecificTag(TAG_CRITICALITY), criticality) + put(ContextSpecificTag(TAG_CONTROL), control) + if (temperatureControl != null) { + if (temperatureControl.isPresent) { + val opttemperatureControl = temperatureControl.get() + opttemperatureControl.toTlv(ContextSpecificTag(TAG_TEMPERATURE_CONTROL), this) + } + } else { + putNull(ContextSpecificTag(TAG_TEMPERATURE_CONTROL)) + } + if (averageLoadControl != null) { + if (averageLoadControl.isPresent) { + val optaverageLoadControl = averageLoadControl.get() + optaverageLoadControl.toTlv(ContextSpecificTag(TAG_AVERAGE_LOAD_CONTROL), this) + } + } else { + putNull(ContextSpecificTag(TAG_AVERAGE_LOAD_CONTROL)) + } + if (dutyCycleControl != null) { + if (dutyCycleControl.isPresent) { + val optdutyCycleControl = dutyCycleControl.get() + optdutyCycleControl.toTlv(ContextSpecificTag(TAG_DUTY_CYCLE_CONTROL), this) + } + } else { + putNull(ContextSpecificTag(TAG_DUTY_CYCLE_CONTROL)) + } + if (powerSavingsControl != null) { + if (powerSavingsControl.isPresent) { + val optpowerSavingsControl = powerSavingsControl.get() + optpowerSavingsControl.toTlv(ContextSpecificTag(TAG_POWER_SAVINGS_CONTROL), this) + } + } else { + putNull(ContextSpecificTag(TAG_POWER_SAVINGS_CONTROL)) + } + if (heatingSourceControl != null) { + if (heatingSourceControl.isPresent) { + val optheatingSourceControl = heatingSourceControl.get() + optheatingSourceControl.toTlv(ContextSpecificTag(TAG_HEATING_SOURCE_CONTROL), this) + } + } else { + putNull(ContextSpecificTag(TAG_HEATING_SOURCE_CONTROL)) + } + endStructure() + } + } + + companion object { + private const val TAG_EVENT_I_D = 0 + private const val TAG_TRANSITION_INDEX = 1 + private const val TAG_STATUS = 2 + private const val TAG_CRITICALITY = 3 + private const val TAG_CONTROL = 4 + private const val TAG_TEMPERATURE_CONTROL = 5 + private const val TAG_AVERAGE_LOAD_CONTROL = 6 + private const val TAG_DUTY_CYCLE_CONTROL = 7 + private const val TAG_POWER_SAVINGS_CONTROL = 8 + private const val TAG_HEATING_SOURCE_CONTROL = 9 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent { + tlvReader.enterStructure(tlvTag) + val eventID = tlvReader.getByteArray(ContextSpecificTag(TAG_EVENT_I_D)) + val transitionIndex = + if (!tlvReader.isNull()) { + tlvReader.getUByte(ContextSpecificTag(TAG_TRANSITION_INDEX)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_TRANSITION_INDEX)) + null + } + val status = tlvReader.getUInt(ContextSpecificTag(TAG_STATUS)) + val criticality = tlvReader.getUInt(ContextSpecificTag(TAG_CRITICALITY)) + val control = tlvReader.getUInt(ContextSpecificTag(TAG_CONTROL)) + val temperatureControl = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_TEMPERATURE_CONTROL))) { + Optional.of( + matter.devicecontroller.cluster.structs + .DemandResponseLoadControlClusterTemperatureControlStruct + .fromTlv(ContextSpecificTag(TAG_TEMPERATURE_CONTROL), tlvReader) + ) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_TEMPERATURE_CONTROL)) + null + } + val averageLoadControl = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_AVERAGE_LOAD_CONTROL))) { + Optional.of( + matter.devicecontroller.cluster.structs + .DemandResponseLoadControlClusterAverageLoadControlStruct + .fromTlv(ContextSpecificTag(TAG_AVERAGE_LOAD_CONTROL), tlvReader) + ) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_AVERAGE_LOAD_CONTROL)) + null + } + val dutyCycleControl = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DUTY_CYCLE_CONTROL))) { + Optional.of( + matter.devicecontroller.cluster.structs + .DemandResponseLoadControlClusterDutyCycleControlStruct + .fromTlv(ContextSpecificTag(TAG_DUTY_CYCLE_CONTROL), tlvReader) + ) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_DUTY_CYCLE_CONTROL)) + null + } + val powerSavingsControl = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_POWER_SAVINGS_CONTROL))) { + Optional.of( + matter.devicecontroller.cluster.structs + .DemandResponseLoadControlClusterPowerSavingsControlStruct + .fromTlv(ContextSpecificTag(TAG_POWER_SAVINGS_CONTROL), tlvReader) + ) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_POWER_SAVINGS_CONTROL)) + null + } + val heatingSourceControl = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_HEATING_SOURCE_CONTROL))) { + Optional.of( + matter.devicecontroller.cluster.structs + .DemandResponseLoadControlClusterHeatingSourceControlStruct + .fromTlv(ContextSpecificTag(TAG_HEATING_SOURCE_CONTROL), tlvReader) + ) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_HEATING_SOURCE_CONTROL)) + null + } + + tlvReader.exitContainer() + + return DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent( + eventID, + transitionIndex, + status, + criticality, + control, + temperatureControl, + averageLoadControl, + dutyCycleControl, + powerSavingsControl, + heatingSourceControl + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/files.gni b/src/controller/java/generated/java/matter/devicecontroller/cluster/files.gni index 963f883c7c9649..54dbdd6875c852 100644 --- a/src/controller/java/generated/java/matter/devicecontroller/cluster/files.gni +++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/files.gni @@ -24,6 +24,14 @@ matter_structs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/ContentLauncherClusterDimensionStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/ContentLauncherClusterParameterStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/ContentLauncherClusterStyleInformationStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterAverageLoadControlStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterDutyCycleControlStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterHeatingSourceControlStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlEventStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlEventTransitionStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlProgramStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterPowerSavingsControlStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterTemperatureControlStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DescriptorClusterDeviceTypeStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DescriptorClusterSemanticTagStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DishwasherModeClusterModeOptionStruct.kt", @@ -98,6 +106,7 @@ matter_eventstructs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/BooleanStateClusterStateChangeEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/BridgedDeviceBasicInformationClusterReachableChangedEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/BridgedDeviceBasicInformationClusterStartUpEvent.kt", + "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/DishwasherAlarmClusterNotifyEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/DoorLockClusterDoorLockAlarmEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/DoorLockClusterDoorStateChangeEvent.kt", @@ -165,6 +174,7 @@ matter_clusters_sources = [ "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/ChannelCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/ColorControlCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/ContentLauncherCluster.kt", + "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/DemandResponseLoadControlCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/DescriptorCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/DiagnosticLogsCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/DishwasherAlarmCluster.kt", diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterAverageLoadControlStruct.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterAverageLoadControlStruct.kt new file mode 100644 index 00000000000000..1e4fd9f18cfe1d --- /dev/null +++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterAverageLoadControlStruct.kt @@ -0,0 +1,55 @@ +/* + * + * 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.devicecontroller.cluster.structs + +import matter.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class DemandResponseLoadControlClusterAverageLoadControlStruct(val loadAdjustment: Byte) { + override fun toString(): String = buildString { + append("DemandResponseLoadControlClusterAverageLoadControlStruct {\n") + append("\tloadAdjustment : $loadAdjustment\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_LOAD_ADJUSTMENT), loadAdjustment) + endStructure() + } + } + + companion object { + private const val TAG_LOAD_ADJUSTMENT = 0 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): DemandResponseLoadControlClusterAverageLoadControlStruct { + tlvReader.enterStructure(tlvTag) + val loadAdjustment = tlvReader.getByte(ContextSpecificTag(TAG_LOAD_ADJUSTMENT)) + + tlvReader.exitContainer() + + return DemandResponseLoadControlClusterAverageLoadControlStruct(loadAdjustment) + } + } +} diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterDutyCycleControlStruct.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterDutyCycleControlStruct.kt new file mode 100644 index 00000000000000..1e23b648c727a9 --- /dev/null +++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterDutyCycleControlStruct.kt @@ -0,0 +1,55 @@ +/* + * + * 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.devicecontroller.cluster.structs + +import matter.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class DemandResponseLoadControlClusterDutyCycleControlStruct(val dutyCycle: UByte) { + override fun toString(): String = buildString { + append("DemandResponseLoadControlClusterDutyCycleControlStruct {\n") + append("\tdutyCycle : $dutyCycle\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_DUTY_CYCLE), dutyCycle) + endStructure() + } + } + + companion object { + private const val TAG_DUTY_CYCLE = 0 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): DemandResponseLoadControlClusterDutyCycleControlStruct { + tlvReader.enterStructure(tlvTag) + val dutyCycle = tlvReader.getUByte(ContextSpecificTag(TAG_DUTY_CYCLE)) + + tlvReader.exitContainer() + + return DemandResponseLoadControlClusterDutyCycleControlStruct(dutyCycle) + } + } +} diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterHeatingSourceControlStruct.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterHeatingSourceControlStruct.kt new file mode 100644 index 00000000000000..0be25f2696b61c --- /dev/null +++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterHeatingSourceControlStruct.kt @@ -0,0 +1,55 @@ +/* + * + * 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.devicecontroller.cluster.structs + +import matter.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class DemandResponseLoadControlClusterHeatingSourceControlStruct(val heatingSource: UInt) { + override fun toString(): String = buildString { + append("DemandResponseLoadControlClusterHeatingSourceControlStruct {\n") + append("\theatingSource : $heatingSource\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_HEATING_SOURCE), heatingSource) + endStructure() + } + } + + companion object { + private const val TAG_HEATING_SOURCE = 0 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): DemandResponseLoadControlClusterHeatingSourceControlStruct { + tlvReader.enterStructure(tlvTag) + val heatingSource = tlvReader.getUInt(ContextSpecificTag(TAG_HEATING_SOURCE)) + + tlvReader.exitContainer() + + return DemandResponseLoadControlClusterHeatingSourceControlStruct(heatingSource) + } + } +} diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlEventStruct.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlEventStruct.kt new file mode 100644 index 00000000000000..fff221a680f729 --- /dev/null +++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlEventStruct.kt @@ -0,0 +1,147 @@ +/* + * + * 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.devicecontroller.cluster.structs + +import java.util.Optional +import matter.devicecontroller.cluster.* +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class DemandResponseLoadControlClusterLoadControlEventStruct( + val eventID: ByteArray, + val programID: ByteArray?, + val control: UInt, + val deviceClass: ULong, + val enrollmentGroup: Optional, + val criticality: UInt, + val startTime: UInt?, + val transitions: List +) { + override fun toString(): String = buildString { + append("DemandResponseLoadControlClusterLoadControlEventStruct {\n") + append("\teventID : $eventID\n") + append("\tprogramID : $programID\n") + append("\tcontrol : $control\n") + append("\tdeviceClass : $deviceClass\n") + append("\tenrollmentGroup : $enrollmentGroup\n") + append("\tcriticality : $criticality\n") + append("\tstartTime : $startTime\n") + append("\ttransitions : $transitions\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_EVENT_I_D), eventID) + if (programID != null) { + put(ContextSpecificTag(TAG_PROGRAM_I_D), programID) + } else { + putNull(ContextSpecificTag(TAG_PROGRAM_I_D)) + } + put(ContextSpecificTag(TAG_CONTROL), control) + put(ContextSpecificTag(TAG_DEVICE_CLASS), deviceClass) + if (enrollmentGroup.isPresent) { + val optenrollmentGroup = enrollmentGroup.get() + put(ContextSpecificTag(TAG_ENROLLMENT_GROUP), optenrollmentGroup) + } + put(ContextSpecificTag(TAG_CRITICALITY), criticality) + if (startTime != null) { + put(ContextSpecificTag(TAG_START_TIME), startTime) + } else { + putNull(ContextSpecificTag(TAG_START_TIME)) + } + startArray(ContextSpecificTag(TAG_TRANSITIONS)) + for (item in transitions.iterator()) { + item.toTlv(AnonymousTag, this) + } + endArray() + endStructure() + } + } + + companion object { + private const val TAG_EVENT_I_D = 0 + private const val TAG_PROGRAM_I_D = 1 + private const val TAG_CONTROL = 2 + private const val TAG_DEVICE_CLASS = 3 + private const val TAG_ENROLLMENT_GROUP = 4 + private const val TAG_CRITICALITY = 5 + private const val TAG_START_TIME = 6 + private const val TAG_TRANSITIONS = 7 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): DemandResponseLoadControlClusterLoadControlEventStruct { + tlvReader.enterStructure(tlvTag) + val eventID = tlvReader.getByteArray(ContextSpecificTag(TAG_EVENT_I_D)) + val programID = + if (!tlvReader.isNull()) { + tlvReader.getByteArray(ContextSpecificTag(TAG_PROGRAM_I_D)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_PROGRAM_I_D)) + null + } + val control = tlvReader.getUInt(ContextSpecificTag(TAG_CONTROL)) + val deviceClass = tlvReader.getULong(ContextSpecificTag(TAG_DEVICE_CLASS)) + val enrollmentGroup = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_ENROLLMENT_GROUP))) { + Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_ENROLLMENT_GROUP))) + } else { + Optional.empty() + } + val criticality = tlvReader.getUInt(ContextSpecificTag(TAG_CRITICALITY)) + val startTime = + if (!tlvReader.isNull()) { + tlvReader.getUInt(ContextSpecificTag(TAG_START_TIME)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_START_TIME)) + null + } + val transitions = + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_TRANSITIONS)) + while (!tlvReader.isEndOfContainer()) { + add( + DemandResponseLoadControlClusterLoadControlEventTransitionStruct.fromTlv( + AnonymousTag, + tlvReader + ) + ) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return DemandResponseLoadControlClusterLoadControlEventStruct( + eventID, + programID, + control, + deviceClass, + enrollmentGroup, + criticality, + startTime, + transitions + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlEventTransitionStruct.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlEventTransitionStruct.kt new file mode 100644 index 00000000000000..46c70edba6e5c8 --- /dev/null +++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlEventTransitionStruct.kt @@ -0,0 +1,161 @@ +/* + * + * 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.devicecontroller.cluster.structs + +import java.util.Optional +import matter.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class DemandResponseLoadControlClusterLoadControlEventTransitionStruct( + val duration: UShort, + val control: UInt, + val temperatureControl: Optional, + val averageLoadControl: Optional, + val dutyCycleControl: Optional, + val powerSavingsControl: Optional, + val heatingSourceControl: Optional +) { + override fun toString(): String = buildString { + append("DemandResponseLoadControlClusterLoadControlEventTransitionStruct {\n") + append("\tduration : $duration\n") + append("\tcontrol : $control\n") + append("\ttemperatureControl : $temperatureControl\n") + append("\taverageLoadControl : $averageLoadControl\n") + append("\tdutyCycleControl : $dutyCycleControl\n") + append("\tpowerSavingsControl : $powerSavingsControl\n") + append("\theatingSourceControl : $heatingSourceControl\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_DURATION), duration) + put(ContextSpecificTag(TAG_CONTROL), control) + if (temperatureControl.isPresent) { + val opttemperatureControl = temperatureControl.get() + opttemperatureControl.toTlv(ContextSpecificTag(TAG_TEMPERATURE_CONTROL), this) + } + if (averageLoadControl.isPresent) { + val optaverageLoadControl = averageLoadControl.get() + optaverageLoadControl.toTlv(ContextSpecificTag(TAG_AVERAGE_LOAD_CONTROL), this) + } + if (dutyCycleControl.isPresent) { + val optdutyCycleControl = dutyCycleControl.get() + optdutyCycleControl.toTlv(ContextSpecificTag(TAG_DUTY_CYCLE_CONTROL), this) + } + if (powerSavingsControl.isPresent) { + val optpowerSavingsControl = powerSavingsControl.get() + optpowerSavingsControl.toTlv(ContextSpecificTag(TAG_POWER_SAVINGS_CONTROL), this) + } + if (heatingSourceControl.isPresent) { + val optheatingSourceControl = heatingSourceControl.get() + optheatingSourceControl.toTlv(ContextSpecificTag(TAG_HEATING_SOURCE_CONTROL), this) + } + endStructure() + } + } + + companion object { + private const val TAG_DURATION = 0 + private const val TAG_CONTROL = 1 + private const val TAG_TEMPERATURE_CONTROL = 2 + private const val TAG_AVERAGE_LOAD_CONTROL = 3 + private const val TAG_DUTY_CYCLE_CONTROL = 4 + private const val TAG_POWER_SAVINGS_CONTROL = 5 + private const val TAG_HEATING_SOURCE_CONTROL = 6 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): DemandResponseLoadControlClusterLoadControlEventTransitionStruct { + tlvReader.enterStructure(tlvTag) + val duration = tlvReader.getUShort(ContextSpecificTag(TAG_DURATION)) + val control = tlvReader.getUInt(ContextSpecificTag(TAG_CONTROL)) + val temperatureControl = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_TEMPERATURE_CONTROL))) { + Optional.of( + DemandResponseLoadControlClusterTemperatureControlStruct.fromTlv( + ContextSpecificTag(TAG_TEMPERATURE_CONTROL), + tlvReader + ) + ) + } else { + Optional.empty() + } + val averageLoadControl = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_AVERAGE_LOAD_CONTROL))) { + Optional.of( + DemandResponseLoadControlClusterAverageLoadControlStruct.fromTlv( + ContextSpecificTag(TAG_AVERAGE_LOAD_CONTROL), + tlvReader + ) + ) + } else { + Optional.empty() + } + val dutyCycleControl = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DUTY_CYCLE_CONTROL))) { + Optional.of( + DemandResponseLoadControlClusterDutyCycleControlStruct.fromTlv( + ContextSpecificTag(TAG_DUTY_CYCLE_CONTROL), + tlvReader + ) + ) + } else { + Optional.empty() + } + val powerSavingsControl = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_POWER_SAVINGS_CONTROL))) { + Optional.of( + DemandResponseLoadControlClusterPowerSavingsControlStruct.fromTlv( + ContextSpecificTag(TAG_POWER_SAVINGS_CONTROL), + tlvReader + ) + ) + } else { + Optional.empty() + } + val heatingSourceControl = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_HEATING_SOURCE_CONTROL))) { + Optional.of( + DemandResponseLoadControlClusterHeatingSourceControlStruct.fromTlv( + ContextSpecificTag(TAG_HEATING_SOURCE_CONTROL), + tlvReader + ) + ) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return DemandResponseLoadControlClusterLoadControlEventTransitionStruct( + duration, + control, + temperatureControl, + averageLoadControl, + dutyCycleControl, + powerSavingsControl, + heatingSourceControl + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlProgramStruct.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlProgramStruct.kt new file mode 100644 index 00000000000000..fd21d4d07fb729 --- /dev/null +++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlProgramStruct.kt @@ -0,0 +1,113 @@ +/* + * + * 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.devicecontroller.cluster.structs + +import matter.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class DemandResponseLoadControlClusterLoadControlProgramStruct( + val programID: ByteArray, + val name: String, + val enrollmentGroup: UByte?, + val randomStartMinutes: UByte?, + val randomDurationMinutes: UByte? +) { + override fun toString(): String = buildString { + append("DemandResponseLoadControlClusterLoadControlProgramStruct {\n") + append("\tprogramID : $programID\n") + append("\tname : $name\n") + append("\tenrollmentGroup : $enrollmentGroup\n") + append("\trandomStartMinutes : $randomStartMinutes\n") + append("\trandomDurationMinutes : $randomDurationMinutes\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_PROGRAM_I_D), programID) + put(ContextSpecificTag(TAG_NAME), name) + if (enrollmentGroup != null) { + put(ContextSpecificTag(TAG_ENROLLMENT_GROUP), enrollmentGroup) + } else { + putNull(ContextSpecificTag(TAG_ENROLLMENT_GROUP)) + } + if (randomStartMinutes != null) { + put(ContextSpecificTag(TAG_RANDOM_START_MINUTES), randomStartMinutes) + } else { + putNull(ContextSpecificTag(TAG_RANDOM_START_MINUTES)) + } + if (randomDurationMinutes != null) { + put(ContextSpecificTag(TAG_RANDOM_DURATION_MINUTES), randomDurationMinutes) + } else { + putNull(ContextSpecificTag(TAG_RANDOM_DURATION_MINUTES)) + } + endStructure() + } + } + + companion object { + private const val TAG_PROGRAM_I_D = 0 + private const val TAG_NAME = 1 + private const val TAG_ENROLLMENT_GROUP = 2 + private const val TAG_RANDOM_START_MINUTES = 3 + private const val TAG_RANDOM_DURATION_MINUTES = 4 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): DemandResponseLoadControlClusterLoadControlProgramStruct { + tlvReader.enterStructure(tlvTag) + val programID = tlvReader.getByteArray(ContextSpecificTag(TAG_PROGRAM_I_D)) + val name = tlvReader.getString(ContextSpecificTag(TAG_NAME)) + val enrollmentGroup = + if (!tlvReader.isNull()) { + tlvReader.getUByte(ContextSpecificTag(TAG_ENROLLMENT_GROUP)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_ENROLLMENT_GROUP)) + null + } + val randomStartMinutes = + if (!tlvReader.isNull()) { + tlvReader.getUByte(ContextSpecificTag(TAG_RANDOM_START_MINUTES)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_RANDOM_START_MINUTES)) + null + } + val randomDurationMinutes = + if (!tlvReader.isNull()) { + tlvReader.getUByte(ContextSpecificTag(TAG_RANDOM_DURATION_MINUTES)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_RANDOM_DURATION_MINUTES)) + null + } + + tlvReader.exitContainer() + + return DemandResponseLoadControlClusterLoadControlProgramStruct( + programID, + name, + enrollmentGroup, + randomStartMinutes, + randomDurationMinutes + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterPowerSavingsControlStruct.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterPowerSavingsControlStruct.kt new file mode 100644 index 00000000000000..811e87bdc7c429 --- /dev/null +++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterPowerSavingsControlStruct.kt @@ -0,0 +1,55 @@ +/* + * + * 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.devicecontroller.cluster.structs + +import matter.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class DemandResponseLoadControlClusterPowerSavingsControlStruct(val powerSavings: UInt) { + override fun toString(): String = buildString { + append("DemandResponseLoadControlClusterPowerSavingsControlStruct {\n") + append("\tpowerSavings : $powerSavings\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_POWER_SAVINGS), powerSavings) + endStructure() + } + } + + companion object { + private const val TAG_POWER_SAVINGS = 0 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): DemandResponseLoadControlClusterPowerSavingsControlStruct { + tlvReader.enterStructure(tlvTag) + val powerSavings = tlvReader.getUInt(ContextSpecificTag(TAG_POWER_SAVINGS)) + + tlvReader.exitContainer() + + return DemandResponseLoadControlClusterPowerSavingsControlStruct(powerSavings) + } + } +} diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterScopedLoadControlEventStruct.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterScopedLoadControlEventStruct.kt new file mode 100644 index 00000000000000..f9ea556026897f --- /dev/null +++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterScopedLoadControlEventStruct.kt @@ -0,0 +1,144 @@ +/* + * + * 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.devicecontroller.cluster.structs + +import matter.devicecontroller.cluster.* +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class DemandResponseLoadControlClusterScopedLoadControlEventStruct( + val eventID: ByteArray, + val programControl: ByteArray, + val control: UInt, + val deviceClass: ULong, + val enrollmentGroup: UByte?, + val criticality: UInt, + val startTime: UInt?, + val transitions: List, + val fabricIndex: UByte +) { + override fun toString(): String = buildString { + append("DemandResponseLoadControlClusterScopedLoadControlEventStruct {\n") + append("\teventID : $eventID\n") + append("\tprogramControl : $programControl\n") + append("\tcontrol : $control\n") + append("\tdeviceClass : $deviceClass\n") + append("\tenrollmentGroup : $enrollmentGroup\n") + append("\tcriticality : $criticality\n") + append("\tstartTime : $startTime\n") + append("\ttransitions : $transitions\n") + append("\tfabricIndex : $fabricIndex\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_EVENT_I_D), eventID) + put(ContextSpecificTag(TAG_PROGRAM_CONTROL), programControl) + put(ContextSpecificTag(TAG_CONTROL), control) + put(ContextSpecificTag(TAG_DEVICE_CLASS), deviceClass) + if (enrollmentGroup != null) { + put(ContextSpecificTag(TAG_ENROLLMENT_GROUP), enrollmentGroup) + } else { + putNull(ContextSpecificTag(TAG_ENROLLMENT_GROUP)) + } + put(ContextSpecificTag(TAG_CRITICALITY), criticality) + if (startTime != null) { + put(ContextSpecificTag(TAG_START_TIME), startTime) + } else { + putNull(ContextSpecificTag(TAG_START_TIME)) + } + startArray(ContextSpecificTag(TAG_TRANSITIONS)) + for (item in transitions.iterator()) { + item.toTlv(AnonymousTag, this) + } + endArray() + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + endStructure() + } + } + + companion object { + private const val TAG_EVENT_I_D = 0 + private const val TAG_PROGRAM_CONTROL = 1 + private const val TAG_CONTROL = 2 + private const val TAG_DEVICE_CLASS = 3 + private const val TAG_ENROLLMENT_GROUP = 4 + private const val TAG_CRITICALITY = 5 + private const val TAG_START_TIME = 6 + private const val TAG_TRANSITIONS = 7 + private const val TAG_FABRIC_INDEX = 254 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): DemandResponseLoadControlClusterScopedLoadControlEventStruct { + tlvReader.enterStructure(tlvTag) + val eventID = tlvReader.getByteArray(ContextSpecificTag(TAG_EVENT_I_D)) + val programControl = tlvReader.getByteArray(ContextSpecificTag(TAG_PROGRAM_CONTROL)) + val control = tlvReader.getUInt(ContextSpecificTag(TAG_CONTROL)) + val deviceClass = tlvReader.getULong(ContextSpecificTag(TAG_DEVICE_CLASS)) + val enrollmentGroup = + if (!tlvReader.isNull()) { + tlvReader.getUByte(ContextSpecificTag(TAG_ENROLLMENT_GROUP)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_ENROLLMENT_GROUP)) + null + } + val criticality = tlvReader.getUInt(ContextSpecificTag(TAG_CRITICALITY)) + val startTime = + if (!tlvReader.isNull()) { + tlvReader.getUInt(ContextSpecificTag(TAG_START_TIME)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_START_TIME)) + null + } + val transitions = + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_TRANSITIONS)) + while (!tlvReader.isEndOfContainer()) { + add( + DemandResponseLoadControlClusterLoadControlEventTransitionStruct.fromTlv( + AnonymousTag, + tlvReader + ) + ) + } + tlvReader.exitContainer() + } + val fabricIndex = tlvReader.getUByte(ContextSpecificTag(TAG_FABRIC_INDEX)) + + tlvReader.exitContainer() + + return DemandResponseLoadControlClusterScopedLoadControlEventStruct( + eventID, + programControl, + control, + deviceClass, + enrollmentGroup, + criticality, + startTime, + transitions, + fabricIndex + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterTemperatureControlStruct.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterTemperatureControlStruct.kt new file mode 100644 index 00000000000000..89d78db74606f3 --- /dev/null +++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterTemperatureControlStruct.kt @@ -0,0 +1,146 @@ +/* + * + * 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.devicecontroller.cluster.structs + +import java.util.Optional +import matter.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class DemandResponseLoadControlClusterTemperatureControlStruct( + val coolingTempOffset: Optional?, + val heatingtTempOffset: Optional?, + val coolingTempSetpoint: Optional?, + val heatingTempSetpoint: Optional? +) { + override fun toString(): String = buildString { + append("DemandResponseLoadControlClusterTemperatureControlStruct {\n") + append("\tcoolingTempOffset : $coolingTempOffset\n") + append("\theatingtTempOffset : $heatingtTempOffset\n") + append("\tcoolingTempSetpoint : $coolingTempSetpoint\n") + append("\theatingTempSetpoint : $heatingTempSetpoint\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (coolingTempOffset != null) { + if (coolingTempOffset.isPresent) { + val optcoolingTempOffset = coolingTempOffset.get() + put(ContextSpecificTag(TAG_COOLING_TEMP_OFFSET), optcoolingTempOffset) + } + } else { + putNull(ContextSpecificTag(TAG_COOLING_TEMP_OFFSET)) + } + if (heatingtTempOffset != null) { + if (heatingtTempOffset.isPresent) { + val optheatingtTempOffset = heatingtTempOffset.get() + put(ContextSpecificTag(TAG_HEATINGT_TEMP_OFFSET), optheatingtTempOffset) + } + } else { + putNull(ContextSpecificTag(TAG_HEATINGT_TEMP_OFFSET)) + } + if (coolingTempSetpoint != null) { + if (coolingTempSetpoint.isPresent) { + val optcoolingTempSetpoint = coolingTempSetpoint.get() + put(ContextSpecificTag(TAG_COOLING_TEMP_SETPOINT), optcoolingTempSetpoint) + } + } else { + putNull(ContextSpecificTag(TAG_COOLING_TEMP_SETPOINT)) + } + if (heatingTempSetpoint != null) { + if (heatingTempSetpoint.isPresent) { + val optheatingTempSetpoint = heatingTempSetpoint.get() + put(ContextSpecificTag(TAG_HEATING_TEMP_SETPOINT), optheatingTempSetpoint) + } + } else { + putNull(ContextSpecificTag(TAG_HEATING_TEMP_SETPOINT)) + } + endStructure() + } + } + + companion object { + private const val TAG_COOLING_TEMP_OFFSET = 0 + private const val TAG_HEATINGT_TEMP_OFFSET = 1 + private const val TAG_COOLING_TEMP_SETPOINT = 2 + private const val TAG_HEATING_TEMP_SETPOINT = 3 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): DemandResponseLoadControlClusterTemperatureControlStruct { + tlvReader.enterStructure(tlvTag) + val coolingTempOffset = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_COOLING_TEMP_OFFSET))) { + Optional.of(tlvReader.getUShort(ContextSpecificTag(TAG_COOLING_TEMP_OFFSET))) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_COOLING_TEMP_OFFSET)) + null + } + val heatingtTempOffset = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_HEATINGT_TEMP_OFFSET))) { + Optional.of(tlvReader.getUShort(ContextSpecificTag(TAG_HEATINGT_TEMP_OFFSET))) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_HEATINGT_TEMP_OFFSET)) + null + } + val coolingTempSetpoint = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_COOLING_TEMP_SETPOINT))) { + Optional.of(tlvReader.getShort(ContextSpecificTag(TAG_COOLING_TEMP_SETPOINT))) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_COOLING_TEMP_SETPOINT)) + null + } + val heatingTempSetpoint = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_HEATING_TEMP_SETPOINT))) { + Optional.of(tlvReader.getShort(ContextSpecificTag(TAG_HEATING_TEMP_SETPOINT))) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_HEATING_TEMP_SETPOINT)) + null + } + + tlvReader.exitContainer() + + return DemandResponseLoadControlClusterTemperatureControlStruct( + coolingTempOffset, + heatingtTempOffset, + coolingTempSetpoint, + heatingTempSetpoint + ) + } + } +} diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index 4eb41ce3946849..2d8fe197e143f4 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -17831,6 +17831,1389 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } break; } + case app::Clusters::DemandResponseLoadControl::Id: { + using namespace app::Clusters::DemandResponseLoadControl; + switch (aPath.mAttributeId) + { + case Attributes::DeviceClass::Id: { + using TypeInfo = Attributes::DeviceClass::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.Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + return value; + } + case Attributes::LoadControlPrograms::Id: { + using TypeInfo = Attributes::LoadControlPrograms::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + jobject newElement_0_programID; + jbyteArray newElement_0_programIDByteArray = env->NewByteArray(static_cast(entry_0.programID.size())); + env->SetByteArrayRegion(newElement_0_programIDByteArray, 0, static_cast(entry_0.programID.size()), + reinterpret_cast(entry_0.programID.data())); + newElement_0_programID = newElement_0_programIDByteArray; + jobject newElement_0_name; + LogErrorOnFailure(chip::JniReferences::GetInstance().CharToStringUTF(entry_0.name, newElement_0_name)); + jobject newElement_0_enrollmentGroup; + if (entry_0.enrollmentGroup.IsNull()) + { + newElement_0_enrollmentGroup = nullptr; + } + else + { + std::string newElement_0_enrollmentGroupClassName = "java/lang/Integer"; + std::string newElement_0_enrollmentGroupCtorSignature = "(I)V"; + jint jninewElement_0_enrollmentGroup = static_cast(entry_0.enrollmentGroup.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_enrollmentGroupClassName.c_str(), newElement_0_enrollmentGroupCtorSignature.c_str(), + jninewElement_0_enrollmentGroup, newElement_0_enrollmentGroup); + } + jobject newElement_0_randomStartMinutes; + if (entry_0.randomStartMinutes.IsNull()) + { + newElement_0_randomStartMinutes = nullptr; + } + else + { + std::string newElement_0_randomStartMinutesClassName = "java/lang/Integer"; + std::string newElement_0_randomStartMinutesCtorSignature = "(I)V"; + jint jninewElement_0_randomStartMinutes = static_cast(entry_0.randomStartMinutes.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_randomStartMinutesClassName.c_str(), newElement_0_randomStartMinutesCtorSignature.c_str(), + jninewElement_0_randomStartMinutes, newElement_0_randomStartMinutes); + } + jobject newElement_0_randomDurationMinutes; + if (entry_0.randomDurationMinutes.IsNull()) + { + newElement_0_randomDurationMinutes = nullptr; + } + else + { + std::string newElement_0_randomDurationMinutesClassName = "java/lang/Integer"; + std::string newElement_0_randomDurationMinutesCtorSignature = "(I)V"; + jint jninewElement_0_randomDurationMinutes = static_cast(entry_0.randomDurationMinutes.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_randomDurationMinutesClassName.c_str(), + newElement_0_randomDurationMinutesCtorSignature.c_str(), jninewElement_0_randomDurationMinutes, + newElement_0_randomDurationMinutes); + } + + jclass loadControlProgramStructStructClass_1; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterLoadControlProgramStruct", + loadControlProgramStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$DemandResponseLoadControlClusterLoadControlProgramStruct"); + return nullptr; + } + jmethodID loadControlProgramStructStructCtor_1 = + env->GetMethodID(loadControlProgramStructStructClass_1, "", + "([BLjava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V"); + if (loadControlProgramStructStructCtor_1 == nullptr) + { + ChipLogError(Zcl, + "Could not find ChipStructs$DemandResponseLoadControlClusterLoadControlProgramStruct constructor"); + return nullptr; + } + + newElement_0 = env->NewObject(loadControlProgramStructStructClass_1, loadControlProgramStructStructCtor_1, + newElement_0_programID, newElement_0_name, newElement_0_enrollmentGroup, + newElement_0_randomStartMinutes, newElement_0_randomDurationMinutes); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::NumberOfLoadControlPrograms::Id: { + using TypeInfo = Attributes::NumberOfLoadControlPrograms::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; + } + case Attributes::Events::Id: { + using TypeInfo = Attributes::Events::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + jobject newElement_0_eventID; + jbyteArray newElement_0_eventIDByteArray = env->NewByteArray(static_cast(entry_0.eventID.size())); + env->SetByteArrayRegion(newElement_0_eventIDByteArray, 0, static_cast(entry_0.eventID.size()), + reinterpret_cast(entry_0.eventID.data())); + newElement_0_eventID = newElement_0_eventIDByteArray; + jobject newElement_0_programID; + if (entry_0.programID.IsNull()) + { + newElement_0_programID = nullptr; + } + else + { + jbyteArray newElement_0_programIDByteArray = + env->NewByteArray(static_cast(entry_0.programID.Value().size())); + env->SetByteArrayRegion(newElement_0_programIDByteArray, 0, + static_cast(entry_0.programID.Value().size()), + reinterpret_cast(entry_0.programID.Value().data())); + newElement_0_programID = newElement_0_programIDByteArray; + } + jobject newElement_0_control; + std::string newElement_0_controlClassName = "java/lang/Integer"; + std::string newElement_0_controlCtorSignature = "(I)V"; + jint jninewElement_0_control = static_cast(entry_0.control.Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_controlClassName.c_str(), + newElement_0_controlCtorSignature.c_str(), + jninewElement_0_control, newElement_0_control); + jobject newElement_0_deviceClass; + std::string newElement_0_deviceClassClassName = "java/lang/Long"; + std::string newElement_0_deviceClassCtorSignature = "(J)V"; + jlong jninewElement_0_deviceClass = static_cast(entry_0.deviceClass.Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_deviceClassClassName.c_str(), + newElement_0_deviceClassCtorSignature.c_str(), + jninewElement_0_deviceClass, newElement_0_deviceClass); + jobject newElement_0_enrollmentGroup; + if (!entry_0.enrollmentGroup.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_enrollmentGroup); + } + else + { + jobject newElement_0_enrollmentGroupInsideOptional; + std::string newElement_0_enrollmentGroupInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_0_enrollmentGroupInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_0_enrollmentGroupInsideOptional = static_cast(entry_0.enrollmentGroup.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_enrollmentGroupInsideOptionalClassName.c_str(), + newElement_0_enrollmentGroupInsideOptionalCtorSignature.c_str(), + jninewElement_0_enrollmentGroupInsideOptional, newElement_0_enrollmentGroupInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_enrollmentGroupInsideOptional, + newElement_0_enrollmentGroup); + } + jobject newElement_0_criticality; + std::string newElement_0_criticalityClassName = "java/lang/Integer"; + std::string newElement_0_criticalityCtorSignature = "(I)V"; + jint jninewElement_0_criticality = static_cast(entry_0.criticality); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_criticalityClassName.c_str(), + newElement_0_criticalityCtorSignature.c_str(), + jninewElement_0_criticality, newElement_0_criticality); + jobject newElement_0_startTime; + if (entry_0.startTime.IsNull()) + { + newElement_0_startTime = nullptr; + } + else + { + std::string newElement_0_startTimeClassName = "java/lang/Long"; + std::string newElement_0_startTimeCtorSignature = "(J)V"; + jlong jninewElement_0_startTime = static_cast(entry_0.startTime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_startTimeClassName.c_str(), + newElement_0_startTimeCtorSignature.c_str(), + jninewElement_0_startTime, newElement_0_startTime); + } + jobject newElement_0_transitions; + chip::JniReferences::GetInstance().CreateArrayList(newElement_0_transitions); + + auto iter_newElement_0_transitions_2 = entry_0.transitions.begin(); + while (iter_newElement_0_transitions_2.Next()) + { + auto & entry_2 = iter_newElement_0_transitions_2.GetValue(); + jobject newElement_2; + jobject newElement_2_duration; + std::string newElement_2_durationClassName = "java/lang/Integer"; + std::string newElement_2_durationCtorSignature = "(I)V"; + jint jninewElement_2_duration = static_cast(entry_2.duration); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_2_durationClassName.c_str(), + newElement_2_durationCtorSignature.c_str(), + jninewElement_2_duration, newElement_2_duration); + jobject newElement_2_control; + std::string newElement_2_controlClassName = "java/lang/Integer"; + std::string newElement_2_controlCtorSignature = "(I)V"; + jint jninewElement_2_control = static_cast(entry_2.control.Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_2_controlClassName.c_str(), + newElement_2_controlCtorSignature.c_str(), + jninewElement_2_control, newElement_2_control); + jobject newElement_2_temperatureControl; + if (!entry_2.temperatureControl.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_temperatureControl); + } + else + { + jobject newElement_2_temperatureControlInsideOptional; + jobject newElement_2_temperatureControlInsideOptional_coolingTempOffset; + if (!entry_2.temperatureControl.Value().coolingTempOffset.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional( + nullptr, newElement_2_temperatureControlInsideOptional_coolingTempOffset); + } + else + { + jobject newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptional; + if (entry_2.temperatureControl.Value().coolingTempOffset.Value().IsNull()) + { + newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptional = nullptr; + } + else + { + std::string newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptionalClassName = + "java/lang/Integer"; + std::string + newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptionalCtorSignature = + "(I)V"; + jint jninewElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptional = + static_cast(entry_2.temperatureControl.Value().coolingTempOffset.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptionalClassName.c_str(), + newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptionalCtorSignature + .c_str(), + jninewElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptional, + newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptional); + } + chip::JniReferences::GetInstance().CreateOptional( + newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptional, + newElement_2_temperatureControlInsideOptional_coolingTempOffset); + } + jobject newElement_2_temperatureControlInsideOptional_heatingtTempOffset; + if (!entry_2.temperatureControl.Value().heatingtTempOffset.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional( + nullptr, newElement_2_temperatureControlInsideOptional_heatingtTempOffset); + } + else + { + jobject newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptional; + if (entry_2.temperatureControl.Value().heatingtTempOffset.Value().IsNull()) + { + newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptional = nullptr; + } + else + { + std::string + newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptionalClassName = + "java/lang/Integer"; + std::string + newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptionalCtorSignature = + "(I)V"; + jint jninewElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptional = + static_cast(entry_2.temperatureControl.Value().heatingtTempOffset.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptionalClassName.c_str(), + newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptionalCtorSignature + .c_str(), + jninewElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptional, + newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptional); + } + chip::JniReferences::GetInstance().CreateOptional( + newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptional, + newElement_2_temperatureControlInsideOptional_heatingtTempOffset); + } + jobject newElement_2_temperatureControlInsideOptional_coolingTempSetpoint; + if (!entry_2.temperatureControl.Value().coolingTempSetpoint.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional( + nullptr, newElement_2_temperatureControlInsideOptional_coolingTempSetpoint); + } + else + { + jobject newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptional; + if (entry_2.temperatureControl.Value().coolingTempSetpoint.Value().IsNull()) + { + newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptional = nullptr; + } + else + { + std::string + newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptionalClassName = + "java/lang/Integer"; + std::string + newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptionalCtorSignature = + "(I)V"; + jint jninewElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptional = + static_cast(entry_2.temperatureControl.Value().coolingTempSetpoint.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptionalClassName + .c_str(), + newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptionalCtorSignature + .c_str(), + jninewElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptional, + newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptional); + } + chip::JniReferences::GetInstance().CreateOptional( + newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptional, + newElement_2_temperatureControlInsideOptional_coolingTempSetpoint); + } + jobject newElement_2_temperatureControlInsideOptional_heatingTempSetpoint; + if (!entry_2.temperatureControl.Value().heatingTempSetpoint.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional( + nullptr, newElement_2_temperatureControlInsideOptional_heatingTempSetpoint); + } + else + { + jobject newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptional; + if (entry_2.temperatureControl.Value().heatingTempSetpoint.Value().IsNull()) + { + newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptional = nullptr; + } + else + { + std::string + newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptionalClassName = + "java/lang/Integer"; + std::string + newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptionalCtorSignature = + "(I)V"; + jint jninewElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptional = + static_cast(entry_2.temperatureControl.Value().heatingTempSetpoint.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptionalClassName + .c_str(), + newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptionalCtorSignature + .c_str(), + jninewElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptional, + newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptional); + } + chip::JniReferences::GetInstance().CreateOptional( + newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptional, + newElement_2_temperatureControlInsideOptional_heatingTempSetpoint); + } + + jclass temperatureControlStructStructClass_5; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterTemperatureControlStruct", + temperatureControlStructStructClass_5); + if (err != CHIP_NO_ERROR) + { + ChipLogError( + Zcl, "Could not find class ChipStructs$DemandResponseLoadControlClusterTemperatureControlStruct"); + return nullptr; + } + jmethodID temperatureControlStructStructCtor_5 = + env->GetMethodID(temperatureControlStructStructClass_5, "", + "(Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V"); + if (temperatureControlStructStructCtor_5 == nullptr) + { + ChipLogError( + Zcl, + "Could not find ChipStructs$DemandResponseLoadControlClusterTemperatureControlStruct constructor"); + return nullptr; + } + + newElement_2_temperatureControlInsideOptional = + env->NewObject(temperatureControlStructStructClass_5, temperatureControlStructStructCtor_5, + newElement_2_temperatureControlInsideOptional_coolingTempOffset, + newElement_2_temperatureControlInsideOptional_heatingtTempOffset, + newElement_2_temperatureControlInsideOptional_coolingTempSetpoint, + newElement_2_temperatureControlInsideOptional_heatingTempSetpoint); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_temperatureControlInsideOptional, + newElement_2_temperatureControl); + } + jobject newElement_2_averageLoadControl; + if (!entry_2.averageLoadControl.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_averageLoadControl); + } + else + { + jobject newElement_2_averageLoadControlInsideOptional; + jobject newElement_2_averageLoadControlInsideOptional_loadAdjustment; + std::string newElement_2_averageLoadControlInsideOptional_loadAdjustmentClassName = "java/lang/Integer"; + std::string newElement_2_averageLoadControlInsideOptional_loadAdjustmentCtorSignature = "(I)V"; + jint jninewElement_2_averageLoadControlInsideOptional_loadAdjustment = + static_cast(entry_2.averageLoadControl.Value().loadAdjustment); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_averageLoadControlInsideOptional_loadAdjustmentClassName.c_str(), + newElement_2_averageLoadControlInsideOptional_loadAdjustmentCtorSignature.c_str(), + jninewElement_2_averageLoadControlInsideOptional_loadAdjustment, + newElement_2_averageLoadControlInsideOptional_loadAdjustment); + + jclass averageLoadControlStructStructClass_5; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterAverageLoadControlStruct", + averageLoadControlStructStructClass_5); + if (err != CHIP_NO_ERROR) + { + ChipLogError( + Zcl, "Could not find class ChipStructs$DemandResponseLoadControlClusterAverageLoadControlStruct"); + return nullptr; + } + jmethodID averageLoadControlStructStructCtor_5 = + env->GetMethodID(averageLoadControlStructStructClass_5, "", "(Ljava/lang/Integer;)V"); + if (averageLoadControlStructStructCtor_5 == nullptr) + { + ChipLogError( + Zcl, + "Could not find ChipStructs$DemandResponseLoadControlClusterAverageLoadControlStruct constructor"); + return nullptr; + } + + newElement_2_averageLoadControlInsideOptional = + env->NewObject(averageLoadControlStructStructClass_5, averageLoadControlStructStructCtor_5, + newElement_2_averageLoadControlInsideOptional_loadAdjustment); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_averageLoadControlInsideOptional, + newElement_2_averageLoadControl); + } + jobject newElement_2_dutyCycleControl; + if (!entry_2.dutyCycleControl.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_dutyCycleControl); + } + else + { + jobject newElement_2_dutyCycleControlInsideOptional; + jobject newElement_2_dutyCycleControlInsideOptional_dutyCycle; + std::string newElement_2_dutyCycleControlInsideOptional_dutyCycleClassName = "java/lang/Integer"; + std::string newElement_2_dutyCycleControlInsideOptional_dutyCycleCtorSignature = "(I)V"; + jint jninewElement_2_dutyCycleControlInsideOptional_dutyCycle = + static_cast(entry_2.dutyCycleControl.Value().dutyCycle); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_dutyCycleControlInsideOptional_dutyCycleClassName.c_str(), + newElement_2_dutyCycleControlInsideOptional_dutyCycleCtorSignature.c_str(), + jninewElement_2_dutyCycleControlInsideOptional_dutyCycle, + newElement_2_dutyCycleControlInsideOptional_dutyCycle); + + jclass dutyCycleControlStructStructClass_5; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterDutyCycleControlStruct", + dutyCycleControlStructStructClass_5); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, + "Could not find class ChipStructs$DemandResponseLoadControlClusterDutyCycleControlStruct"); + return nullptr; + } + jmethodID dutyCycleControlStructStructCtor_5 = + env->GetMethodID(dutyCycleControlStructStructClass_5, "", "(Ljava/lang/Integer;)V"); + if (dutyCycleControlStructStructCtor_5 == nullptr) + { + ChipLogError( + Zcl, + "Could not find ChipStructs$DemandResponseLoadControlClusterDutyCycleControlStruct constructor"); + return nullptr; + } + + newElement_2_dutyCycleControlInsideOptional = + env->NewObject(dutyCycleControlStructStructClass_5, dutyCycleControlStructStructCtor_5, + newElement_2_dutyCycleControlInsideOptional_dutyCycle); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_dutyCycleControlInsideOptional, + newElement_2_dutyCycleControl); + } + jobject newElement_2_powerSavingsControl; + if (!entry_2.powerSavingsControl.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_powerSavingsControl); + } + else + { + jobject newElement_2_powerSavingsControlInsideOptional; + jobject newElement_2_powerSavingsControlInsideOptional_powerSavings; + std::string newElement_2_powerSavingsControlInsideOptional_powerSavingsClassName = "java/lang/Integer"; + std::string newElement_2_powerSavingsControlInsideOptional_powerSavingsCtorSignature = "(I)V"; + jint jninewElement_2_powerSavingsControlInsideOptional_powerSavings = + static_cast(entry_2.powerSavingsControl.Value().powerSavings); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_powerSavingsControlInsideOptional_powerSavingsClassName.c_str(), + newElement_2_powerSavingsControlInsideOptional_powerSavingsCtorSignature.c_str(), + jninewElement_2_powerSavingsControlInsideOptional_powerSavings, + newElement_2_powerSavingsControlInsideOptional_powerSavings); + + jclass powerSavingsControlStructStructClass_5; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterPowerSavingsControlStruct", + powerSavingsControlStructStructClass_5); + if (err != CHIP_NO_ERROR) + { + ChipLogError( + Zcl, "Could not find class ChipStructs$DemandResponseLoadControlClusterPowerSavingsControlStruct"); + return nullptr; + } + jmethodID powerSavingsControlStructStructCtor_5 = + env->GetMethodID(powerSavingsControlStructStructClass_5, "", "(Ljava/lang/Integer;)V"); + if (powerSavingsControlStructStructCtor_5 == nullptr) + { + ChipLogError( + Zcl, + "Could not find ChipStructs$DemandResponseLoadControlClusterPowerSavingsControlStruct constructor"); + return nullptr; + } + + newElement_2_powerSavingsControlInsideOptional = + env->NewObject(powerSavingsControlStructStructClass_5, powerSavingsControlStructStructCtor_5, + newElement_2_powerSavingsControlInsideOptional_powerSavings); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_powerSavingsControlInsideOptional, + newElement_2_powerSavingsControl); + } + jobject newElement_2_heatingSourceControl; + if (!entry_2.heatingSourceControl.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_heatingSourceControl); + } + else + { + jobject newElement_2_heatingSourceControlInsideOptional; + jobject newElement_2_heatingSourceControlInsideOptional_heatingSource; + std::string newElement_2_heatingSourceControlInsideOptional_heatingSourceClassName = "java/lang/Integer"; + std::string newElement_2_heatingSourceControlInsideOptional_heatingSourceCtorSignature = "(I)V"; + jint jninewElement_2_heatingSourceControlInsideOptional_heatingSource = + static_cast(entry_2.heatingSourceControl.Value().heatingSource); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_heatingSourceControlInsideOptional_heatingSourceClassName.c_str(), + newElement_2_heatingSourceControlInsideOptional_heatingSourceCtorSignature.c_str(), + jninewElement_2_heatingSourceControlInsideOptional_heatingSource, + newElement_2_heatingSourceControlInsideOptional_heatingSource); + + jclass heatingSourceControlStructStructClass_5; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterHeatingSourceControlStruct", + heatingSourceControlStructStructClass_5); + if (err != CHIP_NO_ERROR) + { + ChipLogError( + Zcl, "Could not find class ChipStructs$DemandResponseLoadControlClusterHeatingSourceControlStruct"); + return nullptr; + } + jmethodID heatingSourceControlStructStructCtor_5 = + env->GetMethodID(heatingSourceControlStructStructClass_5, "", "(Ljava/lang/Integer;)V"); + if (heatingSourceControlStructStructCtor_5 == nullptr) + { + ChipLogError(Zcl, + "Could not find ChipStructs$DemandResponseLoadControlClusterHeatingSourceControlStruct " + "constructor"); + return nullptr; + } + + newElement_2_heatingSourceControlInsideOptional = + env->NewObject(heatingSourceControlStructStructClass_5, heatingSourceControlStructStructCtor_5, + newElement_2_heatingSourceControlInsideOptional_heatingSource); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_heatingSourceControlInsideOptional, + newElement_2_heatingSourceControl); + } + + jclass loadControlEventTransitionStructStructClass_3; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterLoadControlEventTransitionStruct", + loadControlEventTransitionStructStructClass_3); + if (err != CHIP_NO_ERROR) + { + ChipLogError( + Zcl, + "Could not find class ChipStructs$DemandResponseLoadControlClusterLoadControlEventTransitionStruct"); + return nullptr; + } + jmethodID loadControlEventTransitionStructStructCtor_3 = + env->GetMethodID(loadControlEventTransitionStructStructClass_3, "", + "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;Ljava/" + "util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V"); + if (loadControlEventTransitionStructStructCtor_3 == nullptr) + { + ChipLogError(Zcl, + "Could not find ChipStructs$DemandResponseLoadControlClusterLoadControlEventTransitionStruct " + "constructor"); + return nullptr; + } + + newElement_2 = + env->NewObject(loadControlEventTransitionStructStructClass_3, loadControlEventTransitionStructStructCtor_3, + newElement_2_duration, newElement_2_control, newElement_2_temperatureControl, + newElement_2_averageLoadControl, newElement_2_dutyCycleControl, + newElement_2_powerSavingsControl, newElement_2_heatingSourceControl); + chip::JniReferences::GetInstance().AddToList(newElement_0_transitions, newElement_2); + } + + jclass loadControlEventStructStructClass_1; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterLoadControlEventStruct", + loadControlEventStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$DemandResponseLoadControlClusterLoadControlEventStruct"); + return nullptr; + } + jmethodID loadControlEventStructStructCtor_1 = + env->GetMethodID(loadControlEventStructStructClass_1, "", + "([B[BLjava/lang/Integer;Ljava/lang/Long;Ljava/util/Optional;Ljava/lang/Integer;Ljava/lang/" + "Long;Ljava/util/ArrayList;)V"); + if (loadControlEventStructStructCtor_1 == nullptr) + { + ChipLogError(Zcl, + "Could not find ChipStructs$DemandResponseLoadControlClusterLoadControlEventStruct constructor"); + return nullptr; + } + + newElement_0 = env->NewObject(loadControlEventStructStructClass_1, loadControlEventStructStructCtor_1, + newElement_0_eventID, newElement_0_programID, newElement_0_control, + newElement_0_deviceClass, newElement_0_enrollmentGroup, newElement_0_criticality, + newElement_0_startTime, newElement_0_transitions); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::ActiveEvents::Id: { + using TypeInfo = Attributes::ActiveEvents::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + jobject newElement_0_eventID; + jbyteArray newElement_0_eventIDByteArray = env->NewByteArray(static_cast(entry_0.eventID.size())); + env->SetByteArrayRegion(newElement_0_eventIDByteArray, 0, static_cast(entry_0.eventID.size()), + reinterpret_cast(entry_0.eventID.data())); + newElement_0_eventID = newElement_0_eventIDByteArray; + jobject newElement_0_programID; + if (entry_0.programID.IsNull()) + { + newElement_0_programID = nullptr; + } + else + { + jbyteArray newElement_0_programIDByteArray = + env->NewByteArray(static_cast(entry_0.programID.Value().size())); + env->SetByteArrayRegion(newElement_0_programIDByteArray, 0, + static_cast(entry_0.programID.Value().size()), + reinterpret_cast(entry_0.programID.Value().data())); + newElement_0_programID = newElement_0_programIDByteArray; + } + jobject newElement_0_control; + std::string newElement_0_controlClassName = "java/lang/Integer"; + std::string newElement_0_controlCtorSignature = "(I)V"; + jint jninewElement_0_control = static_cast(entry_0.control.Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_controlClassName.c_str(), + newElement_0_controlCtorSignature.c_str(), + jninewElement_0_control, newElement_0_control); + jobject newElement_0_deviceClass; + std::string newElement_0_deviceClassClassName = "java/lang/Long"; + std::string newElement_0_deviceClassCtorSignature = "(J)V"; + jlong jninewElement_0_deviceClass = static_cast(entry_0.deviceClass.Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_deviceClassClassName.c_str(), + newElement_0_deviceClassCtorSignature.c_str(), + jninewElement_0_deviceClass, newElement_0_deviceClass); + jobject newElement_0_enrollmentGroup; + if (!entry_0.enrollmentGroup.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_enrollmentGroup); + } + else + { + jobject newElement_0_enrollmentGroupInsideOptional; + std::string newElement_0_enrollmentGroupInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_0_enrollmentGroupInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_0_enrollmentGroupInsideOptional = static_cast(entry_0.enrollmentGroup.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_enrollmentGroupInsideOptionalClassName.c_str(), + newElement_0_enrollmentGroupInsideOptionalCtorSignature.c_str(), + jninewElement_0_enrollmentGroupInsideOptional, newElement_0_enrollmentGroupInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_enrollmentGroupInsideOptional, + newElement_0_enrollmentGroup); + } + jobject newElement_0_criticality; + std::string newElement_0_criticalityClassName = "java/lang/Integer"; + std::string newElement_0_criticalityCtorSignature = "(I)V"; + jint jninewElement_0_criticality = static_cast(entry_0.criticality); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_criticalityClassName.c_str(), + newElement_0_criticalityCtorSignature.c_str(), + jninewElement_0_criticality, newElement_0_criticality); + jobject newElement_0_startTime; + if (entry_0.startTime.IsNull()) + { + newElement_0_startTime = nullptr; + } + else + { + std::string newElement_0_startTimeClassName = "java/lang/Long"; + std::string newElement_0_startTimeCtorSignature = "(J)V"; + jlong jninewElement_0_startTime = static_cast(entry_0.startTime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_startTimeClassName.c_str(), + newElement_0_startTimeCtorSignature.c_str(), + jninewElement_0_startTime, newElement_0_startTime); + } + jobject newElement_0_transitions; + chip::JniReferences::GetInstance().CreateArrayList(newElement_0_transitions); + + auto iter_newElement_0_transitions_2 = entry_0.transitions.begin(); + while (iter_newElement_0_transitions_2.Next()) + { + auto & entry_2 = iter_newElement_0_transitions_2.GetValue(); + jobject newElement_2; + jobject newElement_2_duration; + std::string newElement_2_durationClassName = "java/lang/Integer"; + std::string newElement_2_durationCtorSignature = "(I)V"; + jint jninewElement_2_duration = static_cast(entry_2.duration); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_2_durationClassName.c_str(), + newElement_2_durationCtorSignature.c_str(), + jninewElement_2_duration, newElement_2_duration); + jobject newElement_2_control; + std::string newElement_2_controlClassName = "java/lang/Integer"; + std::string newElement_2_controlCtorSignature = "(I)V"; + jint jninewElement_2_control = static_cast(entry_2.control.Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_2_controlClassName.c_str(), + newElement_2_controlCtorSignature.c_str(), + jninewElement_2_control, newElement_2_control); + jobject newElement_2_temperatureControl; + if (!entry_2.temperatureControl.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_temperatureControl); + } + else + { + jobject newElement_2_temperatureControlInsideOptional; + jobject newElement_2_temperatureControlInsideOptional_coolingTempOffset; + if (!entry_2.temperatureControl.Value().coolingTempOffset.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional( + nullptr, newElement_2_temperatureControlInsideOptional_coolingTempOffset); + } + else + { + jobject newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptional; + if (entry_2.temperatureControl.Value().coolingTempOffset.Value().IsNull()) + { + newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptional = nullptr; + } + else + { + std::string newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptionalClassName = + "java/lang/Integer"; + std::string + newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptionalCtorSignature = + "(I)V"; + jint jninewElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptional = + static_cast(entry_2.temperatureControl.Value().coolingTempOffset.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptionalClassName.c_str(), + newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptionalCtorSignature + .c_str(), + jninewElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptional, + newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptional); + } + chip::JniReferences::GetInstance().CreateOptional( + newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptional, + newElement_2_temperatureControlInsideOptional_coolingTempOffset); + } + jobject newElement_2_temperatureControlInsideOptional_heatingtTempOffset; + if (!entry_2.temperatureControl.Value().heatingtTempOffset.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional( + nullptr, newElement_2_temperatureControlInsideOptional_heatingtTempOffset); + } + else + { + jobject newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptional; + if (entry_2.temperatureControl.Value().heatingtTempOffset.Value().IsNull()) + { + newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptional = nullptr; + } + else + { + std::string + newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptionalClassName = + "java/lang/Integer"; + std::string + newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptionalCtorSignature = + "(I)V"; + jint jninewElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptional = + static_cast(entry_2.temperatureControl.Value().heatingtTempOffset.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptionalClassName.c_str(), + newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptionalCtorSignature + .c_str(), + jninewElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptional, + newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptional); + } + chip::JniReferences::GetInstance().CreateOptional( + newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptional, + newElement_2_temperatureControlInsideOptional_heatingtTempOffset); + } + jobject newElement_2_temperatureControlInsideOptional_coolingTempSetpoint; + if (!entry_2.temperatureControl.Value().coolingTempSetpoint.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional( + nullptr, newElement_2_temperatureControlInsideOptional_coolingTempSetpoint); + } + else + { + jobject newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptional; + if (entry_2.temperatureControl.Value().coolingTempSetpoint.Value().IsNull()) + { + newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptional = nullptr; + } + else + { + std::string + newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptionalClassName = + "java/lang/Integer"; + std::string + newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptionalCtorSignature = + "(I)V"; + jint jninewElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptional = + static_cast(entry_2.temperatureControl.Value().coolingTempSetpoint.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptionalClassName + .c_str(), + newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptionalCtorSignature + .c_str(), + jninewElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptional, + newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptional); + } + chip::JniReferences::GetInstance().CreateOptional( + newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptional, + newElement_2_temperatureControlInsideOptional_coolingTempSetpoint); + } + jobject newElement_2_temperatureControlInsideOptional_heatingTempSetpoint; + if (!entry_2.temperatureControl.Value().heatingTempSetpoint.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional( + nullptr, newElement_2_temperatureControlInsideOptional_heatingTempSetpoint); + } + else + { + jobject newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptional; + if (entry_2.temperatureControl.Value().heatingTempSetpoint.Value().IsNull()) + { + newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptional = nullptr; + } + else + { + std::string + newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptionalClassName = + "java/lang/Integer"; + std::string + newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptionalCtorSignature = + "(I)V"; + jint jninewElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptional = + static_cast(entry_2.temperatureControl.Value().heatingTempSetpoint.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptionalClassName + .c_str(), + newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptionalCtorSignature + .c_str(), + jninewElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptional, + newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptional); + } + chip::JniReferences::GetInstance().CreateOptional( + newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptional, + newElement_2_temperatureControlInsideOptional_heatingTempSetpoint); + } + + jclass temperatureControlStructStructClass_5; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterTemperatureControlStruct", + temperatureControlStructStructClass_5); + if (err != CHIP_NO_ERROR) + { + ChipLogError( + Zcl, "Could not find class ChipStructs$DemandResponseLoadControlClusterTemperatureControlStruct"); + return nullptr; + } + jmethodID temperatureControlStructStructCtor_5 = + env->GetMethodID(temperatureControlStructStructClass_5, "", + "(Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V"); + if (temperatureControlStructStructCtor_5 == nullptr) + { + ChipLogError( + Zcl, + "Could not find ChipStructs$DemandResponseLoadControlClusterTemperatureControlStruct constructor"); + return nullptr; + } + + newElement_2_temperatureControlInsideOptional = + env->NewObject(temperatureControlStructStructClass_5, temperatureControlStructStructCtor_5, + newElement_2_temperatureControlInsideOptional_coolingTempOffset, + newElement_2_temperatureControlInsideOptional_heatingtTempOffset, + newElement_2_temperatureControlInsideOptional_coolingTempSetpoint, + newElement_2_temperatureControlInsideOptional_heatingTempSetpoint); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_temperatureControlInsideOptional, + newElement_2_temperatureControl); + } + jobject newElement_2_averageLoadControl; + if (!entry_2.averageLoadControl.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_averageLoadControl); + } + else + { + jobject newElement_2_averageLoadControlInsideOptional; + jobject newElement_2_averageLoadControlInsideOptional_loadAdjustment; + std::string newElement_2_averageLoadControlInsideOptional_loadAdjustmentClassName = "java/lang/Integer"; + std::string newElement_2_averageLoadControlInsideOptional_loadAdjustmentCtorSignature = "(I)V"; + jint jninewElement_2_averageLoadControlInsideOptional_loadAdjustment = + static_cast(entry_2.averageLoadControl.Value().loadAdjustment); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_averageLoadControlInsideOptional_loadAdjustmentClassName.c_str(), + newElement_2_averageLoadControlInsideOptional_loadAdjustmentCtorSignature.c_str(), + jninewElement_2_averageLoadControlInsideOptional_loadAdjustment, + newElement_2_averageLoadControlInsideOptional_loadAdjustment); + + jclass averageLoadControlStructStructClass_5; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterAverageLoadControlStruct", + averageLoadControlStructStructClass_5); + if (err != CHIP_NO_ERROR) + { + ChipLogError( + Zcl, "Could not find class ChipStructs$DemandResponseLoadControlClusterAverageLoadControlStruct"); + return nullptr; + } + jmethodID averageLoadControlStructStructCtor_5 = + env->GetMethodID(averageLoadControlStructStructClass_5, "", "(Ljava/lang/Integer;)V"); + if (averageLoadControlStructStructCtor_5 == nullptr) + { + ChipLogError( + Zcl, + "Could not find ChipStructs$DemandResponseLoadControlClusterAverageLoadControlStruct constructor"); + return nullptr; + } + + newElement_2_averageLoadControlInsideOptional = + env->NewObject(averageLoadControlStructStructClass_5, averageLoadControlStructStructCtor_5, + newElement_2_averageLoadControlInsideOptional_loadAdjustment); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_averageLoadControlInsideOptional, + newElement_2_averageLoadControl); + } + jobject newElement_2_dutyCycleControl; + if (!entry_2.dutyCycleControl.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_dutyCycleControl); + } + else + { + jobject newElement_2_dutyCycleControlInsideOptional; + jobject newElement_2_dutyCycleControlInsideOptional_dutyCycle; + std::string newElement_2_dutyCycleControlInsideOptional_dutyCycleClassName = "java/lang/Integer"; + std::string newElement_2_dutyCycleControlInsideOptional_dutyCycleCtorSignature = "(I)V"; + jint jninewElement_2_dutyCycleControlInsideOptional_dutyCycle = + static_cast(entry_2.dutyCycleControl.Value().dutyCycle); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_dutyCycleControlInsideOptional_dutyCycleClassName.c_str(), + newElement_2_dutyCycleControlInsideOptional_dutyCycleCtorSignature.c_str(), + jninewElement_2_dutyCycleControlInsideOptional_dutyCycle, + newElement_2_dutyCycleControlInsideOptional_dutyCycle); + + jclass dutyCycleControlStructStructClass_5; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterDutyCycleControlStruct", + dutyCycleControlStructStructClass_5); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, + "Could not find class ChipStructs$DemandResponseLoadControlClusterDutyCycleControlStruct"); + return nullptr; + } + jmethodID dutyCycleControlStructStructCtor_5 = + env->GetMethodID(dutyCycleControlStructStructClass_5, "", "(Ljava/lang/Integer;)V"); + if (dutyCycleControlStructStructCtor_5 == nullptr) + { + ChipLogError( + Zcl, + "Could not find ChipStructs$DemandResponseLoadControlClusterDutyCycleControlStruct constructor"); + return nullptr; + } + + newElement_2_dutyCycleControlInsideOptional = + env->NewObject(dutyCycleControlStructStructClass_5, dutyCycleControlStructStructCtor_5, + newElement_2_dutyCycleControlInsideOptional_dutyCycle); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_dutyCycleControlInsideOptional, + newElement_2_dutyCycleControl); + } + jobject newElement_2_powerSavingsControl; + if (!entry_2.powerSavingsControl.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_powerSavingsControl); + } + else + { + jobject newElement_2_powerSavingsControlInsideOptional; + jobject newElement_2_powerSavingsControlInsideOptional_powerSavings; + std::string newElement_2_powerSavingsControlInsideOptional_powerSavingsClassName = "java/lang/Integer"; + std::string newElement_2_powerSavingsControlInsideOptional_powerSavingsCtorSignature = "(I)V"; + jint jninewElement_2_powerSavingsControlInsideOptional_powerSavings = + static_cast(entry_2.powerSavingsControl.Value().powerSavings); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_powerSavingsControlInsideOptional_powerSavingsClassName.c_str(), + newElement_2_powerSavingsControlInsideOptional_powerSavingsCtorSignature.c_str(), + jninewElement_2_powerSavingsControlInsideOptional_powerSavings, + newElement_2_powerSavingsControlInsideOptional_powerSavings); + + jclass powerSavingsControlStructStructClass_5; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterPowerSavingsControlStruct", + powerSavingsControlStructStructClass_5); + if (err != CHIP_NO_ERROR) + { + ChipLogError( + Zcl, "Could not find class ChipStructs$DemandResponseLoadControlClusterPowerSavingsControlStruct"); + return nullptr; + } + jmethodID powerSavingsControlStructStructCtor_5 = + env->GetMethodID(powerSavingsControlStructStructClass_5, "", "(Ljava/lang/Integer;)V"); + if (powerSavingsControlStructStructCtor_5 == nullptr) + { + ChipLogError( + Zcl, + "Could not find ChipStructs$DemandResponseLoadControlClusterPowerSavingsControlStruct constructor"); + return nullptr; + } + + newElement_2_powerSavingsControlInsideOptional = + env->NewObject(powerSavingsControlStructStructClass_5, powerSavingsControlStructStructCtor_5, + newElement_2_powerSavingsControlInsideOptional_powerSavings); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_powerSavingsControlInsideOptional, + newElement_2_powerSavingsControl); + } + jobject newElement_2_heatingSourceControl; + if (!entry_2.heatingSourceControl.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_heatingSourceControl); + } + else + { + jobject newElement_2_heatingSourceControlInsideOptional; + jobject newElement_2_heatingSourceControlInsideOptional_heatingSource; + std::string newElement_2_heatingSourceControlInsideOptional_heatingSourceClassName = "java/lang/Integer"; + std::string newElement_2_heatingSourceControlInsideOptional_heatingSourceCtorSignature = "(I)V"; + jint jninewElement_2_heatingSourceControlInsideOptional_heatingSource = + static_cast(entry_2.heatingSourceControl.Value().heatingSource); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_heatingSourceControlInsideOptional_heatingSourceClassName.c_str(), + newElement_2_heatingSourceControlInsideOptional_heatingSourceCtorSignature.c_str(), + jninewElement_2_heatingSourceControlInsideOptional_heatingSource, + newElement_2_heatingSourceControlInsideOptional_heatingSource); + + jclass heatingSourceControlStructStructClass_5; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterHeatingSourceControlStruct", + heatingSourceControlStructStructClass_5); + if (err != CHIP_NO_ERROR) + { + ChipLogError( + Zcl, "Could not find class ChipStructs$DemandResponseLoadControlClusterHeatingSourceControlStruct"); + return nullptr; + } + jmethodID heatingSourceControlStructStructCtor_5 = + env->GetMethodID(heatingSourceControlStructStructClass_5, "", "(Ljava/lang/Integer;)V"); + if (heatingSourceControlStructStructCtor_5 == nullptr) + { + ChipLogError(Zcl, + "Could not find ChipStructs$DemandResponseLoadControlClusterHeatingSourceControlStruct " + "constructor"); + return nullptr; + } + + newElement_2_heatingSourceControlInsideOptional = + env->NewObject(heatingSourceControlStructStructClass_5, heatingSourceControlStructStructCtor_5, + newElement_2_heatingSourceControlInsideOptional_heatingSource); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_heatingSourceControlInsideOptional, + newElement_2_heatingSourceControl); + } + + jclass loadControlEventTransitionStructStructClass_3; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterLoadControlEventTransitionStruct", + loadControlEventTransitionStructStructClass_3); + if (err != CHIP_NO_ERROR) + { + ChipLogError( + Zcl, + "Could not find class ChipStructs$DemandResponseLoadControlClusterLoadControlEventTransitionStruct"); + return nullptr; + } + jmethodID loadControlEventTransitionStructStructCtor_3 = + env->GetMethodID(loadControlEventTransitionStructStructClass_3, "", + "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;Ljava/" + "util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V"); + if (loadControlEventTransitionStructStructCtor_3 == nullptr) + { + ChipLogError(Zcl, + "Could not find ChipStructs$DemandResponseLoadControlClusterLoadControlEventTransitionStruct " + "constructor"); + return nullptr; + } + + newElement_2 = + env->NewObject(loadControlEventTransitionStructStructClass_3, loadControlEventTransitionStructStructCtor_3, + newElement_2_duration, newElement_2_control, newElement_2_temperatureControl, + newElement_2_averageLoadControl, newElement_2_dutyCycleControl, + newElement_2_powerSavingsControl, newElement_2_heatingSourceControl); + chip::JniReferences::GetInstance().AddToList(newElement_0_transitions, newElement_2); + } + + jclass loadControlEventStructStructClass_1; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterLoadControlEventStruct", + loadControlEventStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$DemandResponseLoadControlClusterLoadControlEventStruct"); + return nullptr; + } + jmethodID loadControlEventStructStructCtor_1 = + env->GetMethodID(loadControlEventStructStructClass_1, "", + "([B[BLjava/lang/Integer;Ljava/lang/Long;Ljava/util/Optional;Ljava/lang/Integer;Ljava/lang/" + "Long;Ljava/util/ArrayList;)V"); + if (loadControlEventStructStructCtor_1 == nullptr) + { + ChipLogError(Zcl, + "Could not find ChipStructs$DemandResponseLoadControlClusterLoadControlEventStruct constructor"); + return nullptr; + } + + newElement_0 = env->NewObject(loadControlEventStructStructClass_1, loadControlEventStructStructCtor_1, + newElement_0_eventID, newElement_0_programID, newElement_0_control, + newElement_0_deviceClass, newElement_0_enrollmentGroup, newElement_0_criticality, + newElement_0_startTime, newElement_0_transitions); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::NumberOfEventsPerProgram::Id: { + using TypeInfo = Attributes::NumberOfEventsPerProgram::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; + } + case Attributes::NumberOfTransistions::Id: { + using TypeInfo = Attributes::NumberOfTransistions::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; + } + case Attributes::DefaultRandomStart::Id: { + using TypeInfo = Attributes::DefaultRandomStart::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; + } + case Attributes::DefaultRandomDuration::Id: { + using TypeInfo = Attributes::DefaultRandomDuration::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; + } + 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::DoorLock::Id: { using namespace app::Clusters::DoorLock; switch (aPath.mAttributeId) diff --git a/src/controller/java/zap-generated/CHIPClientCallbacks.h b/src/controller/java/zap-generated/CHIPClientCallbacks.h index 96f3a671890993..2c4046a73920c0 100644 --- a/src/controller/java/zap-generated/CHIPClientCallbacks.h +++ b/src/controller/java/zap-generated/CHIPClientCallbacks.h @@ -675,6 +675,26 @@ typedef void (*ActivatedCarbonFilterMonitoringEventListListAttributeCallback)( void * context, const chip::app::DataModel::DecodableList & data); typedef void (*ActivatedCarbonFilterMonitoringAttributeListListAttributeCallback)( void * context, const chip::app::DataModel::DecodableList & data); +typedef void (*DemandResponseLoadControlLoadControlProgramsListAttributeCallback)( + void * context, + const chip::app::DataModel::DecodableList< + chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlProgramStruct::DecodableType> & data); +typedef void (*DemandResponseLoadControlEventsListAttributeCallback)( + void * context, + const chip::app::DataModel::DecodableList< + chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlEventStruct::DecodableType> & data); +typedef void (*DemandResponseLoadControlActiveEventsListAttributeCallback)( + void * context, + const chip::app::DataModel::DecodableList< + chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlEventStruct::DecodableType> & data); +typedef void (*DemandResponseLoadControlGeneratedCommandListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); +typedef void (*DemandResponseLoadControlAcceptedCommandListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); +typedef void (*DemandResponseLoadControlEventListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); +typedef void (*DemandResponseLoadControlAttributeListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); typedef void (*DoorLockGeneratedCommandListListAttributeCallback)( void * context, const chip::app::DataModel::DecodableList & data); typedef void (*DoorLockAcceptedCommandListListAttributeCallback)(void * context, diff --git a/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp b/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp index da47dd0819efdb..9d3dbec50b8c25 100644 --- a/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp +++ b/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp @@ -3108,6 +3108,110 @@ JNI_METHOD(void, ActivatedCarbonFilterMonitoringCluster, writeLastChangedTimeAtt onFailure.release(); } +JNI_METHOD(void, DemandResponseLoadControlCluster, writeDefaultRandomStartAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) +{ + chip::DeviceLayer::StackLock lock; + ListFreer listFreer; + using TypeInfo = chip::app::Clusters::DemandResponseLoadControl::Attributes::DefaultRandomStart::TypeInfo; + TypeInfo::Type cppValue; + + std::vector> cleanupByteArrays; + std::vector> cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + DemandResponseLoadControlCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + if (timedWriteTimeoutMs == nullptr) + { + err = cppCluster->WriteAttribute(cppValue, onSuccess->mContext, successFn->mCall, failureFn->mCall); + } + else + { + err = cppCluster->WriteAttribute(cppValue, onSuccess->mContext, successFn->mCall, failureFn->mCall, + chip::JniReferences::GetInstance().IntegerToPrimitive(timedWriteTimeoutMs)); + } + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, DemandResponseLoadControlCluster, writeDefaultRandomDurationAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) +{ + chip::DeviceLayer::StackLock lock; + ListFreer listFreer; + using TypeInfo = chip::app::Clusters::DemandResponseLoadControl::Attributes::DefaultRandomDuration::TypeInfo; + TypeInfo::Type cppValue; + + std::vector> cleanupByteArrays; + std::vector> cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + DemandResponseLoadControlCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + if (timedWriteTimeoutMs == nullptr) + { + err = cppCluster->WriteAttribute(cppValue, onSuccess->mContext, successFn->mCall, failureFn->mCall); + } + else + { + err = cppCluster->WriteAttribute(cppValue, onSuccess->mContext, successFn->mCall, failureFn->mCall, + chip::JniReferences::GetInstance().IntegerToPrimitive(timedWriteTimeoutMs)); + } + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + JNI_METHOD(void, DoorLockCluster, writeDoorOpenEventsAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { diff --git a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp index 91be522bc20fe7..f00d93faa06214 100644 --- a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp @@ -3457,6 +3457,471 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & } break; } + case app::Clusters::DemandResponseLoadControl::Id: { + using namespace app::Clusters::DemandResponseLoadControl; + switch (aPath.mEventId) + { + case Events::LoadControlEventStatusChange::Id: { + Events::LoadControlEventStatusChange::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value_eventID; + jbyteArray value_eventIDByteArray = env->NewByteArray(static_cast(cppValue.eventID.size())); + env->SetByteArrayRegion(value_eventIDByteArray, 0, static_cast(cppValue.eventID.size()), + reinterpret_cast(cppValue.eventID.data())); + value_eventID = value_eventIDByteArray; + + jobject value_transitionIndex; + if (cppValue.transitionIndex.IsNull()) + { + value_transitionIndex = nullptr; + } + else + { + std::string value_transitionIndexClassName = "java/lang/Integer"; + std::string value_transitionIndexCtorSignature = "(I)V"; + jint jnivalue_transitionIndex = static_cast(cppValue.transitionIndex.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(value_transitionIndexClassName.c_str(), + value_transitionIndexCtorSignature.c_str(), + jnivalue_transitionIndex, value_transitionIndex); + } + + jobject value_status; + std::string value_statusClassName = "java/lang/Integer"; + std::string value_statusCtorSignature = "(I)V"; + jint jnivalue_status = static_cast(cppValue.status); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_statusClassName.c_str(), value_statusCtorSignature.c_str(), jnivalue_status, value_status); + + jobject value_criticality; + std::string value_criticalityClassName = "java/lang/Integer"; + std::string value_criticalityCtorSignature = "(I)V"; + jint jnivalue_criticality = static_cast(cppValue.criticality); + chip::JniReferences::GetInstance().CreateBoxedObject(value_criticalityClassName.c_str(), + value_criticalityCtorSignature.c_str(), jnivalue_criticality, + value_criticality); + + jobject value_control; + std::string value_controlClassName = "java/lang/Integer"; + std::string value_controlCtorSignature = "(I)V"; + jint jnivalue_control = static_cast(cppValue.control.Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_controlClassName.c_str(), value_controlCtorSignature.c_str(), jnivalue_control, value_control); + + jobject value_temperatureControl; + if (!cppValue.temperatureControl.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_temperatureControl); + } + else + { + jobject value_temperatureControlInsideOptional; + if (cppValue.temperatureControl.Value().IsNull()) + { + value_temperatureControlInsideOptional = nullptr; + } + else + { + jobject value_temperatureControlInsideOptional_coolingTempOffset; + if (!cppValue.temperatureControl.Value().Value().coolingTempOffset.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, + value_temperatureControlInsideOptional_coolingTempOffset); + } + else + { + jobject value_temperatureControlInsideOptional_coolingTempOffsetInsideOptional; + if (cppValue.temperatureControl.Value().Value().coolingTempOffset.Value().IsNull()) + { + value_temperatureControlInsideOptional_coolingTempOffsetInsideOptional = nullptr; + } + else + { + std::string value_temperatureControlInsideOptional_coolingTempOffsetInsideOptionalClassName = + "java/lang/Integer"; + std::string value_temperatureControlInsideOptional_coolingTempOffsetInsideOptionalCtorSignature = + "(I)V"; + jint jnivalue_temperatureControlInsideOptional_coolingTempOffsetInsideOptional = + static_cast(cppValue.temperatureControl.Value().Value().coolingTempOffset.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_temperatureControlInsideOptional_coolingTempOffsetInsideOptionalClassName.c_str(), + value_temperatureControlInsideOptional_coolingTempOffsetInsideOptionalCtorSignature.c_str(), + jnivalue_temperatureControlInsideOptional_coolingTempOffsetInsideOptional, + value_temperatureControlInsideOptional_coolingTempOffsetInsideOptional); + } + chip::JniReferences::GetInstance().CreateOptional( + value_temperatureControlInsideOptional_coolingTempOffsetInsideOptional, + value_temperatureControlInsideOptional_coolingTempOffset); + } + jobject value_temperatureControlInsideOptional_heatingtTempOffset; + if (!cppValue.temperatureControl.Value().Value().heatingtTempOffset.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional( + nullptr, value_temperatureControlInsideOptional_heatingtTempOffset); + } + else + { + jobject value_temperatureControlInsideOptional_heatingtTempOffsetInsideOptional; + if (cppValue.temperatureControl.Value().Value().heatingtTempOffset.Value().IsNull()) + { + value_temperatureControlInsideOptional_heatingtTempOffsetInsideOptional = nullptr; + } + else + { + std::string value_temperatureControlInsideOptional_heatingtTempOffsetInsideOptionalClassName = + "java/lang/Integer"; + std::string value_temperatureControlInsideOptional_heatingtTempOffsetInsideOptionalCtorSignature = + "(I)V"; + jint jnivalue_temperatureControlInsideOptional_heatingtTempOffsetInsideOptional = + static_cast(cppValue.temperatureControl.Value().Value().heatingtTempOffset.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_temperatureControlInsideOptional_heatingtTempOffsetInsideOptionalClassName.c_str(), + value_temperatureControlInsideOptional_heatingtTempOffsetInsideOptionalCtorSignature.c_str(), + jnivalue_temperatureControlInsideOptional_heatingtTempOffsetInsideOptional, + value_temperatureControlInsideOptional_heatingtTempOffsetInsideOptional); + } + chip::JniReferences::GetInstance().CreateOptional( + value_temperatureControlInsideOptional_heatingtTempOffsetInsideOptional, + value_temperatureControlInsideOptional_heatingtTempOffset); + } + jobject value_temperatureControlInsideOptional_coolingTempSetpoint; + if (!cppValue.temperatureControl.Value().Value().coolingTempSetpoint.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional( + nullptr, value_temperatureControlInsideOptional_coolingTempSetpoint); + } + else + { + jobject value_temperatureControlInsideOptional_coolingTempSetpointInsideOptional; + if (cppValue.temperatureControl.Value().Value().coolingTempSetpoint.Value().IsNull()) + { + value_temperatureControlInsideOptional_coolingTempSetpointInsideOptional = nullptr; + } + else + { + std::string value_temperatureControlInsideOptional_coolingTempSetpointInsideOptionalClassName = + "java/lang/Integer"; + std::string value_temperatureControlInsideOptional_coolingTempSetpointInsideOptionalCtorSignature = + "(I)V"; + jint jnivalue_temperatureControlInsideOptional_coolingTempSetpointInsideOptional = + static_cast(cppValue.temperatureControl.Value().Value().coolingTempSetpoint.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_temperatureControlInsideOptional_coolingTempSetpointInsideOptionalClassName.c_str(), + value_temperatureControlInsideOptional_coolingTempSetpointInsideOptionalCtorSignature.c_str(), + jnivalue_temperatureControlInsideOptional_coolingTempSetpointInsideOptional, + value_temperatureControlInsideOptional_coolingTempSetpointInsideOptional); + } + chip::JniReferences::GetInstance().CreateOptional( + value_temperatureControlInsideOptional_coolingTempSetpointInsideOptional, + value_temperatureControlInsideOptional_coolingTempSetpoint); + } + jobject value_temperatureControlInsideOptional_heatingTempSetpoint; + if (!cppValue.temperatureControl.Value().Value().heatingTempSetpoint.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional( + nullptr, value_temperatureControlInsideOptional_heatingTempSetpoint); + } + else + { + jobject value_temperatureControlInsideOptional_heatingTempSetpointInsideOptional; + if (cppValue.temperatureControl.Value().Value().heatingTempSetpoint.Value().IsNull()) + { + value_temperatureControlInsideOptional_heatingTempSetpointInsideOptional = nullptr; + } + else + { + std::string value_temperatureControlInsideOptional_heatingTempSetpointInsideOptionalClassName = + "java/lang/Integer"; + std::string value_temperatureControlInsideOptional_heatingTempSetpointInsideOptionalCtorSignature = + "(I)V"; + jint jnivalue_temperatureControlInsideOptional_heatingTempSetpointInsideOptional = + static_cast(cppValue.temperatureControl.Value().Value().heatingTempSetpoint.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_temperatureControlInsideOptional_heatingTempSetpointInsideOptionalClassName.c_str(), + value_temperatureControlInsideOptional_heatingTempSetpointInsideOptionalCtorSignature.c_str(), + jnivalue_temperatureControlInsideOptional_heatingTempSetpointInsideOptional, + value_temperatureControlInsideOptional_heatingTempSetpointInsideOptional); + } + chip::JniReferences::GetInstance().CreateOptional( + value_temperatureControlInsideOptional_heatingTempSetpointInsideOptional, + value_temperatureControlInsideOptional_heatingTempSetpoint); + } + + jclass temperatureControlStructStructClass_2; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterTemperatureControlStruct", + temperatureControlStructStructClass_2); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, + "Could not find class ChipStructs$DemandResponseLoadControlClusterTemperatureControlStruct"); + return nullptr; + } + jmethodID temperatureControlStructStructCtor_2 = + env->GetMethodID(temperatureControlStructStructClass_2, "", + "(Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V"); + if (temperatureControlStructStructCtor_2 == nullptr) + { + ChipLogError( + Zcl, "Could not find ChipStructs$DemandResponseLoadControlClusterTemperatureControlStruct constructor"); + return nullptr; + } + + value_temperatureControlInsideOptional = + env->NewObject(temperatureControlStructStructClass_2, temperatureControlStructStructCtor_2, + value_temperatureControlInsideOptional_coolingTempOffset, + value_temperatureControlInsideOptional_heatingtTempOffset, + value_temperatureControlInsideOptional_coolingTempSetpoint, + value_temperatureControlInsideOptional_heatingTempSetpoint); + } + chip::JniReferences::GetInstance().CreateOptional(value_temperatureControlInsideOptional, value_temperatureControl); + } + + jobject value_averageLoadControl; + if (!cppValue.averageLoadControl.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_averageLoadControl); + } + else + { + jobject value_averageLoadControlInsideOptional; + if (cppValue.averageLoadControl.Value().IsNull()) + { + value_averageLoadControlInsideOptional = nullptr; + } + else + { + jobject value_averageLoadControlInsideOptional_loadAdjustment; + std::string value_averageLoadControlInsideOptional_loadAdjustmentClassName = "java/lang/Integer"; + std::string value_averageLoadControlInsideOptional_loadAdjustmentCtorSignature = "(I)V"; + jint jnivalue_averageLoadControlInsideOptional_loadAdjustment = + static_cast(cppValue.averageLoadControl.Value().Value().loadAdjustment); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_averageLoadControlInsideOptional_loadAdjustmentClassName.c_str(), + value_averageLoadControlInsideOptional_loadAdjustmentCtorSignature.c_str(), + jnivalue_averageLoadControlInsideOptional_loadAdjustment, + value_averageLoadControlInsideOptional_loadAdjustment); + + jclass averageLoadControlStructStructClass_2; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterAverageLoadControlStruct", + averageLoadControlStructStructClass_2); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, + "Could not find class ChipStructs$DemandResponseLoadControlClusterAverageLoadControlStruct"); + return nullptr; + } + jmethodID averageLoadControlStructStructCtor_2 = + env->GetMethodID(averageLoadControlStructStructClass_2, "", "(Ljava/lang/Integer;)V"); + if (averageLoadControlStructStructCtor_2 == nullptr) + { + ChipLogError( + Zcl, "Could not find ChipStructs$DemandResponseLoadControlClusterAverageLoadControlStruct constructor"); + return nullptr; + } + + value_averageLoadControlInsideOptional = + env->NewObject(averageLoadControlStructStructClass_2, averageLoadControlStructStructCtor_2, + value_averageLoadControlInsideOptional_loadAdjustment); + } + chip::JniReferences::GetInstance().CreateOptional(value_averageLoadControlInsideOptional, value_averageLoadControl); + } + + jobject value_dutyCycleControl; + if (!cppValue.dutyCycleControl.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_dutyCycleControl); + } + else + { + jobject value_dutyCycleControlInsideOptional; + if (cppValue.dutyCycleControl.Value().IsNull()) + { + value_dutyCycleControlInsideOptional = nullptr; + } + else + { + jobject value_dutyCycleControlInsideOptional_dutyCycle; + std::string value_dutyCycleControlInsideOptional_dutyCycleClassName = "java/lang/Integer"; + std::string value_dutyCycleControlInsideOptional_dutyCycleCtorSignature = "(I)V"; + jint jnivalue_dutyCycleControlInsideOptional_dutyCycle = + static_cast(cppValue.dutyCycleControl.Value().Value().dutyCycle); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dutyCycleControlInsideOptional_dutyCycleClassName.c_str(), + value_dutyCycleControlInsideOptional_dutyCycleCtorSignature.c_str(), + jnivalue_dutyCycleControlInsideOptional_dutyCycle, value_dutyCycleControlInsideOptional_dutyCycle); + + jclass dutyCycleControlStructStructClass_2; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterDutyCycleControlStruct", + dutyCycleControlStructStructClass_2); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, + "Could not find class ChipStructs$DemandResponseLoadControlClusterDutyCycleControlStruct"); + return nullptr; + } + jmethodID dutyCycleControlStructStructCtor_2 = + env->GetMethodID(dutyCycleControlStructStructClass_2, "", "(Ljava/lang/Integer;)V"); + if (dutyCycleControlStructStructCtor_2 == nullptr) + { + ChipLogError( + Zcl, "Could not find ChipStructs$DemandResponseLoadControlClusterDutyCycleControlStruct constructor"); + return nullptr; + } + + value_dutyCycleControlInsideOptional = + env->NewObject(dutyCycleControlStructStructClass_2, dutyCycleControlStructStructCtor_2, + value_dutyCycleControlInsideOptional_dutyCycle); + } + chip::JniReferences::GetInstance().CreateOptional(value_dutyCycleControlInsideOptional, value_dutyCycleControl); + } + + jobject value_powerSavingsControl; + if (!cppValue.powerSavingsControl.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_powerSavingsControl); + } + else + { + jobject value_powerSavingsControlInsideOptional; + if (cppValue.powerSavingsControl.Value().IsNull()) + { + value_powerSavingsControlInsideOptional = nullptr; + } + else + { + jobject value_powerSavingsControlInsideOptional_powerSavings; + std::string value_powerSavingsControlInsideOptional_powerSavingsClassName = "java/lang/Integer"; + std::string value_powerSavingsControlInsideOptional_powerSavingsCtorSignature = "(I)V"; + jint jnivalue_powerSavingsControlInsideOptional_powerSavings = + static_cast(cppValue.powerSavingsControl.Value().Value().powerSavings); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_powerSavingsControlInsideOptional_powerSavingsClassName.c_str(), + value_powerSavingsControlInsideOptional_powerSavingsCtorSignature.c_str(), + jnivalue_powerSavingsControlInsideOptional_powerSavings, + value_powerSavingsControlInsideOptional_powerSavings); + + jclass powerSavingsControlStructStructClass_2; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterPowerSavingsControlStruct", + powerSavingsControlStructStructClass_2); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, + "Could not find class ChipStructs$DemandResponseLoadControlClusterPowerSavingsControlStruct"); + return nullptr; + } + jmethodID powerSavingsControlStructStructCtor_2 = + env->GetMethodID(powerSavingsControlStructStructClass_2, "", "(Ljava/lang/Integer;)V"); + if (powerSavingsControlStructStructCtor_2 == nullptr) + { + ChipLogError( + Zcl, + "Could not find ChipStructs$DemandResponseLoadControlClusterPowerSavingsControlStruct constructor"); + return nullptr; + } + + value_powerSavingsControlInsideOptional = + env->NewObject(powerSavingsControlStructStructClass_2, powerSavingsControlStructStructCtor_2, + value_powerSavingsControlInsideOptional_powerSavings); + } + chip::JniReferences::GetInstance().CreateOptional(value_powerSavingsControlInsideOptional, + value_powerSavingsControl); + } + + jobject value_heatingSourceControl; + if (!cppValue.heatingSourceControl.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_heatingSourceControl); + } + else + { + jobject value_heatingSourceControlInsideOptional; + if (cppValue.heatingSourceControl.Value().IsNull()) + { + value_heatingSourceControlInsideOptional = nullptr; + } + else + { + jobject value_heatingSourceControlInsideOptional_heatingSource; + std::string value_heatingSourceControlInsideOptional_heatingSourceClassName = "java/lang/Integer"; + std::string value_heatingSourceControlInsideOptional_heatingSourceCtorSignature = "(I)V"; + jint jnivalue_heatingSourceControlInsideOptional_heatingSource = + static_cast(cppValue.heatingSourceControl.Value().Value().heatingSource); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_heatingSourceControlInsideOptional_heatingSourceClassName.c_str(), + value_heatingSourceControlInsideOptional_heatingSourceCtorSignature.c_str(), + jnivalue_heatingSourceControlInsideOptional_heatingSource, + value_heatingSourceControlInsideOptional_heatingSource); + + jclass heatingSourceControlStructStructClass_2; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterHeatingSourceControlStruct", + heatingSourceControlStructStructClass_2); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, + "Could not find class ChipStructs$DemandResponseLoadControlClusterHeatingSourceControlStruct"); + return nullptr; + } + jmethodID heatingSourceControlStructStructCtor_2 = + env->GetMethodID(heatingSourceControlStructStructClass_2, "", "(Ljava/lang/Integer;)V"); + if (heatingSourceControlStructStructCtor_2 == nullptr) + { + ChipLogError( + Zcl, + "Could not find ChipStructs$DemandResponseLoadControlClusterHeatingSourceControlStruct constructor"); + return nullptr; + } + + value_heatingSourceControlInsideOptional = + env->NewObject(heatingSourceControlStructStructClass_2, heatingSourceControlStructStructCtor_2, + value_heatingSourceControlInsideOptional_heatingSource); + } + chip::JniReferences::GetInstance().CreateOptional(value_heatingSourceControlInsideOptional, + value_heatingSourceControl); + } + + jclass loadControlEventStatusChangeStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipEventStructs$DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent", + loadControlEventStatusChangeStructClass); + if (err != CHIP_NO_ERROR) + { + ChipLogError( + Zcl, "Could not find class ChipEventStructs$DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent"); + return nullptr; + } + jmethodID loadControlEventStatusChangeStructCtor = + env->GetMethodID(loadControlEventStatusChangeStructClass, "", + "([BLjava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/util/" + "Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V"); + if (loadControlEventStatusChangeStructCtor == nullptr) + { + ChipLogError(Zcl, + "Could not find ChipEventStructs$DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent " + "constructor"); + return nullptr; + } + + jobject value = env->NewObject(loadControlEventStatusChangeStructClass, loadControlEventStatusChangeStructCtor, + value_eventID, value_transitionIndex, value_status, value_criticality, value_control, + value_temperatureControl, value_averageLoadControl, value_dutyCycleControl, + value_powerSavingsControl, value_heatingSourceControl); + + return value; + } + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + break; + } + break; + } case app::Clusters::DoorLock::Id: { using namespace app::Clusters::DoorLock; switch (aPath.mEventId) diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp index e8ccdb55aa6e12..a432363b6915a8 100644 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp @@ -27999,6 +27999,1531 @@ void CHIPActivatedCarbonFilterMonitoringAttributeListAttributeCallback::Callback env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); } +CHIPDemandResponseLoadControlLoadControlProgramsAttributeCallback:: +CHIPDemandResponseLoadControlLoadControlProgramsAttributeCallback(jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), + keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPDemandResponseLoadControlLoadControlProgramsAttributeCallback::~ +CHIPDemandResponseLoadControlLoadControlProgramsAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPDemandResponseLoadControlLoadControlProgramsAttributeCallback::CallbackFn( + void * context, + const chip::app::DataModel::DecodableList< + chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlProgramStruct::DecodableType> & list) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_programID; + jbyteArray newElement_0_programIDByteArray = env->NewByteArray(static_cast(entry_0.programID.size())); + env->SetByteArrayRegion(newElement_0_programIDByteArray, 0, static_cast(entry_0.programID.size()), + reinterpret_cast(entry_0.programID.data())); + newElement_0_programID = newElement_0_programIDByteArray; + jobject newElement_0_name; + LogErrorOnFailure(chip::JniReferences::GetInstance().CharToStringUTF(entry_0.name, newElement_0_name)); + jobject newElement_0_enrollmentGroup; + if (entry_0.enrollmentGroup.IsNull()) + { + newElement_0_enrollmentGroup = nullptr; + } + else + { + std::string newElement_0_enrollmentGroupClassName = "java/lang/Integer"; + std::string newElement_0_enrollmentGroupCtorSignature = "(I)V"; + jint jninewElement_0_enrollmentGroup = static_cast(entry_0.enrollmentGroup.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_enrollmentGroupClassName.c_str(), newElement_0_enrollmentGroupCtorSignature.c_str(), + jninewElement_0_enrollmentGroup, newElement_0_enrollmentGroup); + } + jobject newElement_0_randomStartMinutes; + if (entry_0.randomStartMinutes.IsNull()) + { + newElement_0_randomStartMinutes = nullptr; + } + else + { + std::string newElement_0_randomStartMinutesClassName = "java/lang/Integer"; + std::string newElement_0_randomStartMinutesCtorSignature = "(I)V"; + jint jninewElement_0_randomStartMinutes = static_cast(entry_0.randomStartMinutes.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_randomStartMinutesClassName.c_str(), newElement_0_randomStartMinutesCtorSignature.c_str(), + jninewElement_0_randomStartMinutes, newElement_0_randomStartMinutes); + } + jobject newElement_0_randomDurationMinutes; + if (entry_0.randomDurationMinutes.IsNull()) + { + newElement_0_randomDurationMinutes = nullptr; + } + else + { + std::string newElement_0_randomDurationMinutesClassName = "java/lang/Integer"; + std::string newElement_0_randomDurationMinutesCtorSignature = "(I)V"; + jint jninewElement_0_randomDurationMinutes = static_cast(entry_0.randomDurationMinutes.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_randomDurationMinutesClassName.c_str(), newElement_0_randomDurationMinutesCtorSignature.c_str(), + jninewElement_0_randomDurationMinutes, newElement_0_randomDurationMinutes); + } + + jclass loadControlProgramStructStructClass_1; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterLoadControlProgramStruct", + loadControlProgramStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$DemandResponseLoadControlClusterLoadControlProgramStruct"); + return; + } + jmethodID loadControlProgramStructStructCtor_1 = + env->GetMethodID(loadControlProgramStructStructClass_1, "", + "([BLjava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V"); + if (loadControlProgramStructStructCtor_1 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$DemandResponseLoadControlClusterLoadControlProgramStruct constructor"); + return; + } + + newElement_0 = env->NewObject(loadControlProgramStructStructClass_1, loadControlProgramStructStructCtor_1, + newElement_0_programID, newElement_0_name, newElement_0_enrollmentGroup, + newElement_0_randomStartMinutes, newElement_0_randomDurationMinutes); + chip::JniReferences::GetInstance().AddToList(arrayListObj, newElement_0); + } + + env->ExceptionClear(); + env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); +} + +CHIPDemandResponseLoadControlEventsAttributeCallback::CHIPDemandResponseLoadControlEventsAttributeCallback(jobject javaCallback, + bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), + keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPDemandResponseLoadControlEventsAttributeCallback::~CHIPDemandResponseLoadControlEventsAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPDemandResponseLoadControlEventsAttributeCallback::CallbackFn( + void * context, + const chip::app::DataModel::DecodableList< + chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlEventStruct::DecodableType> & list) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_eventID; + jbyteArray newElement_0_eventIDByteArray = env->NewByteArray(static_cast(entry_0.eventID.size())); + env->SetByteArrayRegion(newElement_0_eventIDByteArray, 0, static_cast(entry_0.eventID.size()), + reinterpret_cast(entry_0.eventID.data())); + newElement_0_eventID = newElement_0_eventIDByteArray; + jobject newElement_0_programID; + if (entry_0.programID.IsNull()) + { + newElement_0_programID = nullptr; + } + else + { + jbyteArray newElement_0_programIDByteArray = env->NewByteArray(static_cast(entry_0.programID.Value().size())); + env->SetByteArrayRegion(newElement_0_programIDByteArray, 0, static_cast(entry_0.programID.Value().size()), + reinterpret_cast(entry_0.programID.Value().data())); + newElement_0_programID = newElement_0_programIDByteArray; + } + jobject newElement_0_control; + std::string newElement_0_controlClassName = "java/lang/Integer"; + std::string newElement_0_controlCtorSignature = "(I)V"; + jint jninewElement_0_control = static_cast(entry_0.control.Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_controlClassName.c_str(), + newElement_0_controlCtorSignature.c_str(), + jninewElement_0_control, newElement_0_control); + jobject newElement_0_deviceClass; + std::string newElement_0_deviceClassClassName = "java/lang/Long"; + std::string newElement_0_deviceClassCtorSignature = "(J)V"; + jlong jninewElement_0_deviceClass = static_cast(entry_0.deviceClass.Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_deviceClassClassName.c_str(), + newElement_0_deviceClassCtorSignature.c_str(), + jninewElement_0_deviceClass, newElement_0_deviceClass); + jobject newElement_0_enrollmentGroup; + if (!entry_0.enrollmentGroup.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_enrollmentGroup); + } + else + { + jobject newElement_0_enrollmentGroupInsideOptional; + std::string newElement_0_enrollmentGroupInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_0_enrollmentGroupInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_0_enrollmentGroupInsideOptional = static_cast(entry_0.enrollmentGroup.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_enrollmentGroupInsideOptionalClassName.c_str(), + newElement_0_enrollmentGroupInsideOptionalCtorSignature.c_str(), jninewElement_0_enrollmentGroupInsideOptional, + newElement_0_enrollmentGroupInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_enrollmentGroupInsideOptional, + newElement_0_enrollmentGroup); + } + jobject newElement_0_criticality; + std::string newElement_0_criticalityClassName = "java/lang/Integer"; + std::string newElement_0_criticalityCtorSignature = "(I)V"; + jint jninewElement_0_criticality = static_cast(entry_0.criticality); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_criticalityClassName.c_str(), + newElement_0_criticalityCtorSignature.c_str(), + jninewElement_0_criticality, newElement_0_criticality); + jobject newElement_0_startTime; + if (entry_0.startTime.IsNull()) + { + newElement_0_startTime = nullptr; + } + else + { + std::string newElement_0_startTimeClassName = "java/lang/Long"; + std::string newElement_0_startTimeCtorSignature = "(J)V"; + jlong jninewElement_0_startTime = static_cast(entry_0.startTime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_startTimeClassName.c_str(), + newElement_0_startTimeCtorSignature.c_str(), + jninewElement_0_startTime, newElement_0_startTime); + } + jobject newElement_0_transitions; + chip::JniReferences::GetInstance().CreateArrayList(newElement_0_transitions); + + auto iter_newElement_0_transitions_2 = entry_0.transitions.begin(); + while (iter_newElement_0_transitions_2.Next()) + { + auto & entry_2 = iter_newElement_0_transitions_2.GetValue(); + jobject newElement_2; + jobject newElement_2_duration; + std::string newElement_2_durationClassName = "java/lang/Integer"; + std::string newElement_2_durationCtorSignature = "(I)V"; + jint jninewElement_2_duration = static_cast(entry_2.duration); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_2_durationClassName.c_str(), + newElement_2_durationCtorSignature.c_str(), + jninewElement_2_duration, newElement_2_duration); + jobject newElement_2_control; + std::string newElement_2_controlClassName = "java/lang/Integer"; + std::string newElement_2_controlCtorSignature = "(I)V"; + jint jninewElement_2_control = static_cast(entry_2.control.Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_2_controlClassName.c_str(), + newElement_2_controlCtorSignature.c_str(), + jninewElement_2_control, newElement_2_control); + jobject newElement_2_temperatureControl; + if (!entry_2.temperatureControl.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_temperatureControl); + } + else + { + jobject newElement_2_temperatureControlInsideOptional; + jobject newElement_2_temperatureControlInsideOptional_coolingTempOffset; + if (!entry_2.temperatureControl.Value().coolingTempOffset.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional( + nullptr, newElement_2_temperatureControlInsideOptional_coolingTempOffset); + } + else + { + jobject newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptional; + if (entry_2.temperatureControl.Value().coolingTempOffset.Value().IsNull()) + { + newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptional = nullptr; + } + else + { + std::string newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptionalClassName = + "java/lang/Integer"; + std::string newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptionalCtorSignature = + "(I)V"; + jint jninewElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptional = + static_cast(entry_2.temperatureControl.Value().coolingTempOffset.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptionalClassName.c_str(), + newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptionalCtorSignature.c_str(), + jninewElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptional, + newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptional); + } + chip::JniReferences::GetInstance().CreateOptional( + newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptional, + newElement_2_temperatureControlInsideOptional_coolingTempOffset); + } + jobject newElement_2_temperatureControlInsideOptional_heatingtTempOffset; + if (!entry_2.temperatureControl.Value().heatingtTempOffset.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional( + nullptr, newElement_2_temperatureControlInsideOptional_heatingtTempOffset); + } + else + { + jobject newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptional; + if (entry_2.temperatureControl.Value().heatingtTempOffset.Value().IsNull()) + { + newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptional = nullptr; + } + else + { + std::string newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptionalClassName = + "java/lang/Integer"; + std::string newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptionalCtorSignature = + "(I)V"; + jint jninewElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptional = + static_cast(entry_2.temperatureControl.Value().heatingtTempOffset.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptionalClassName.c_str(), + newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptionalCtorSignature.c_str(), + jninewElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptional, + newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptional); + } + chip::JniReferences::GetInstance().CreateOptional( + newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptional, + newElement_2_temperatureControlInsideOptional_heatingtTempOffset); + } + jobject newElement_2_temperatureControlInsideOptional_coolingTempSetpoint; + if (!entry_2.temperatureControl.Value().coolingTempSetpoint.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional( + nullptr, newElement_2_temperatureControlInsideOptional_coolingTempSetpoint); + } + else + { + jobject newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptional; + if (entry_2.temperatureControl.Value().coolingTempSetpoint.Value().IsNull()) + { + newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptional = nullptr; + } + else + { + std::string newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptionalClassName = + "java/lang/Integer"; + std::string newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptionalCtorSignature = + "(I)V"; + jint jninewElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptional = + static_cast(entry_2.temperatureControl.Value().coolingTempSetpoint.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptionalClassName.c_str(), + newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptionalCtorSignature.c_str(), + jninewElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptional, + newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptional); + } + chip::JniReferences::GetInstance().CreateOptional( + newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptional, + newElement_2_temperatureControlInsideOptional_coolingTempSetpoint); + } + jobject newElement_2_temperatureControlInsideOptional_heatingTempSetpoint; + if (!entry_2.temperatureControl.Value().heatingTempSetpoint.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional( + nullptr, newElement_2_temperatureControlInsideOptional_heatingTempSetpoint); + } + else + { + jobject newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptional; + if (entry_2.temperatureControl.Value().heatingTempSetpoint.Value().IsNull()) + { + newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptional = nullptr; + } + else + { + std::string newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptionalClassName = + "java/lang/Integer"; + std::string newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptionalCtorSignature = + "(I)V"; + jint jninewElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptional = + static_cast(entry_2.temperatureControl.Value().heatingTempSetpoint.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptionalClassName.c_str(), + newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptionalCtorSignature.c_str(), + jninewElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptional, + newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptional); + } + chip::JniReferences::GetInstance().CreateOptional( + newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptional, + newElement_2_temperatureControlInsideOptional_heatingTempSetpoint); + } + + jclass temperatureControlStructStructClass_5; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterTemperatureControlStruct", + temperatureControlStructStructClass_5); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$DemandResponseLoadControlClusterTemperatureControlStruct"); + return; + } + jmethodID temperatureControlStructStructCtor_5 = + env->GetMethodID(temperatureControlStructStructClass_5, "", + "(Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V"); + if (temperatureControlStructStructCtor_5 == nullptr) + { + ChipLogError(Zcl, + "Could not find ChipStructs$DemandResponseLoadControlClusterTemperatureControlStruct constructor"); + return; + } + + newElement_2_temperatureControlInsideOptional = + env->NewObject(temperatureControlStructStructClass_5, temperatureControlStructStructCtor_5, + newElement_2_temperatureControlInsideOptional_coolingTempOffset, + newElement_2_temperatureControlInsideOptional_heatingtTempOffset, + newElement_2_temperatureControlInsideOptional_coolingTempSetpoint, + newElement_2_temperatureControlInsideOptional_heatingTempSetpoint); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_temperatureControlInsideOptional, + newElement_2_temperatureControl); + } + jobject newElement_2_averageLoadControl; + if (!entry_2.averageLoadControl.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_averageLoadControl); + } + else + { + jobject newElement_2_averageLoadControlInsideOptional; + jobject newElement_2_averageLoadControlInsideOptional_loadAdjustment; + std::string newElement_2_averageLoadControlInsideOptional_loadAdjustmentClassName = "java/lang/Integer"; + std::string newElement_2_averageLoadControlInsideOptional_loadAdjustmentCtorSignature = "(I)V"; + jint jninewElement_2_averageLoadControlInsideOptional_loadAdjustment = + static_cast(entry_2.averageLoadControl.Value().loadAdjustment); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_averageLoadControlInsideOptional_loadAdjustmentClassName.c_str(), + newElement_2_averageLoadControlInsideOptional_loadAdjustmentCtorSignature.c_str(), + jninewElement_2_averageLoadControlInsideOptional_loadAdjustment, + newElement_2_averageLoadControlInsideOptional_loadAdjustment); + + jclass averageLoadControlStructStructClass_5; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterAverageLoadControlStruct", + averageLoadControlStructStructClass_5); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$DemandResponseLoadControlClusterAverageLoadControlStruct"); + return; + } + jmethodID averageLoadControlStructStructCtor_5 = + env->GetMethodID(averageLoadControlStructStructClass_5, "", "(Ljava/lang/Integer;)V"); + if (averageLoadControlStructStructCtor_5 == nullptr) + { + ChipLogError(Zcl, + "Could not find ChipStructs$DemandResponseLoadControlClusterAverageLoadControlStruct constructor"); + return; + } + + newElement_2_averageLoadControlInsideOptional = + env->NewObject(averageLoadControlStructStructClass_5, averageLoadControlStructStructCtor_5, + newElement_2_averageLoadControlInsideOptional_loadAdjustment); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_averageLoadControlInsideOptional, + newElement_2_averageLoadControl); + } + jobject newElement_2_dutyCycleControl; + if (!entry_2.dutyCycleControl.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_dutyCycleControl); + } + else + { + jobject newElement_2_dutyCycleControlInsideOptional; + jobject newElement_2_dutyCycleControlInsideOptional_dutyCycle; + std::string newElement_2_dutyCycleControlInsideOptional_dutyCycleClassName = "java/lang/Integer"; + std::string newElement_2_dutyCycleControlInsideOptional_dutyCycleCtorSignature = "(I)V"; + jint jninewElement_2_dutyCycleControlInsideOptional_dutyCycle = + static_cast(entry_2.dutyCycleControl.Value().dutyCycle); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_dutyCycleControlInsideOptional_dutyCycleClassName.c_str(), + newElement_2_dutyCycleControlInsideOptional_dutyCycleCtorSignature.c_str(), + jninewElement_2_dutyCycleControlInsideOptional_dutyCycle, + newElement_2_dutyCycleControlInsideOptional_dutyCycle); + + jclass dutyCycleControlStructStructClass_5; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterDutyCycleControlStruct", + dutyCycleControlStructStructClass_5); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$DemandResponseLoadControlClusterDutyCycleControlStruct"); + return; + } + jmethodID dutyCycleControlStructStructCtor_5 = + env->GetMethodID(dutyCycleControlStructStructClass_5, "", "(Ljava/lang/Integer;)V"); + if (dutyCycleControlStructStructCtor_5 == nullptr) + { + ChipLogError(Zcl, + "Could not find ChipStructs$DemandResponseLoadControlClusterDutyCycleControlStruct constructor"); + return; + } + + newElement_2_dutyCycleControlInsideOptional = + env->NewObject(dutyCycleControlStructStructClass_5, dutyCycleControlStructStructCtor_5, + newElement_2_dutyCycleControlInsideOptional_dutyCycle); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_dutyCycleControlInsideOptional, + newElement_2_dutyCycleControl); + } + jobject newElement_2_powerSavingsControl; + if (!entry_2.powerSavingsControl.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_powerSavingsControl); + } + else + { + jobject newElement_2_powerSavingsControlInsideOptional; + jobject newElement_2_powerSavingsControlInsideOptional_powerSavings; + std::string newElement_2_powerSavingsControlInsideOptional_powerSavingsClassName = "java/lang/Integer"; + std::string newElement_2_powerSavingsControlInsideOptional_powerSavingsCtorSignature = "(I)V"; + jint jninewElement_2_powerSavingsControlInsideOptional_powerSavings = + static_cast(entry_2.powerSavingsControl.Value().powerSavings); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_powerSavingsControlInsideOptional_powerSavingsClassName.c_str(), + newElement_2_powerSavingsControlInsideOptional_powerSavingsCtorSignature.c_str(), + jninewElement_2_powerSavingsControlInsideOptional_powerSavings, + newElement_2_powerSavingsControlInsideOptional_powerSavings); + + jclass powerSavingsControlStructStructClass_5; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterPowerSavingsControlStruct", + powerSavingsControlStructStructClass_5); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$DemandResponseLoadControlClusterPowerSavingsControlStruct"); + return; + } + jmethodID powerSavingsControlStructStructCtor_5 = + env->GetMethodID(powerSavingsControlStructStructClass_5, "", "(Ljava/lang/Integer;)V"); + if (powerSavingsControlStructStructCtor_5 == nullptr) + { + ChipLogError( + Zcl, "Could not find ChipStructs$DemandResponseLoadControlClusterPowerSavingsControlStruct constructor"); + return; + } + + newElement_2_powerSavingsControlInsideOptional = + env->NewObject(powerSavingsControlStructStructClass_5, powerSavingsControlStructStructCtor_5, + newElement_2_powerSavingsControlInsideOptional_powerSavings); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_powerSavingsControlInsideOptional, + newElement_2_powerSavingsControl); + } + jobject newElement_2_heatingSourceControl; + if (!entry_2.heatingSourceControl.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_heatingSourceControl); + } + else + { + jobject newElement_2_heatingSourceControlInsideOptional; + jobject newElement_2_heatingSourceControlInsideOptional_heatingSource; + std::string newElement_2_heatingSourceControlInsideOptional_heatingSourceClassName = "java/lang/Integer"; + std::string newElement_2_heatingSourceControlInsideOptional_heatingSourceCtorSignature = "(I)V"; + jint jninewElement_2_heatingSourceControlInsideOptional_heatingSource = + static_cast(entry_2.heatingSourceControl.Value().heatingSource); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_heatingSourceControlInsideOptional_heatingSourceClassName.c_str(), + newElement_2_heatingSourceControlInsideOptional_heatingSourceCtorSignature.c_str(), + jninewElement_2_heatingSourceControlInsideOptional_heatingSource, + newElement_2_heatingSourceControlInsideOptional_heatingSource); + + jclass heatingSourceControlStructStructClass_5; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterHeatingSourceControlStruct", + heatingSourceControlStructStructClass_5); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, + "Could not find class ChipStructs$DemandResponseLoadControlClusterHeatingSourceControlStruct"); + return; + } + jmethodID heatingSourceControlStructStructCtor_5 = + env->GetMethodID(heatingSourceControlStructStructClass_5, "", "(Ljava/lang/Integer;)V"); + if (heatingSourceControlStructStructCtor_5 == nullptr) + { + ChipLogError( + Zcl, "Could not find ChipStructs$DemandResponseLoadControlClusterHeatingSourceControlStruct constructor"); + return; + } + + newElement_2_heatingSourceControlInsideOptional = + env->NewObject(heatingSourceControlStructStructClass_5, heatingSourceControlStructStructCtor_5, + newElement_2_heatingSourceControlInsideOptional_heatingSource); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_heatingSourceControlInsideOptional, + newElement_2_heatingSourceControl); + } + + jclass loadControlEventTransitionStructStructClass_3; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterLoadControlEventTransitionStruct", + loadControlEventTransitionStructStructClass_3); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, + "Could not find class ChipStructs$DemandResponseLoadControlClusterLoadControlEventTransitionStruct"); + return; + } + jmethodID loadControlEventTransitionStructStructCtor_3 = + env->GetMethodID(loadControlEventTransitionStructStructClass_3, "", + "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/" + "Optional;Ljava/util/Optional;Ljava/util/Optional;)V"); + if (loadControlEventTransitionStructStructCtor_3 == nullptr) + { + ChipLogError( + Zcl, "Could not find ChipStructs$DemandResponseLoadControlClusterLoadControlEventTransitionStruct constructor"); + return; + } + + newElement_2 = env->NewObject( + loadControlEventTransitionStructStructClass_3, loadControlEventTransitionStructStructCtor_3, newElement_2_duration, + newElement_2_control, newElement_2_temperatureControl, newElement_2_averageLoadControl, + newElement_2_dutyCycleControl, newElement_2_powerSavingsControl, newElement_2_heatingSourceControl); + chip::JniReferences::GetInstance().AddToList(newElement_0_transitions, newElement_2); + } + + jclass loadControlEventStructStructClass_1; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterLoadControlEventStruct", + loadControlEventStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$DemandResponseLoadControlClusterLoadControlEventStruct"); + return; + } + jmethodID loadControlEventStructStructCtor_1 = + env->GetMethodID(loadControlEventStructStructClass_1, "", + "([B[BLjava/lang/Integer;Ljava/lang/Long;Ljava/util/Optional;Ljava/lang/Integer;Ljava/lang/Long;Ljava/" + "util/ArrayList;)V"); + if (loadControlEventStructStructCtor_1 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$DemandResponseLoadControlClusterLoadControlEventStruct constructor"); + return; + } + + newElement_0 = + env->NewObject(loadControlEventStructStructClass_1, loadControlEventStructStructCtor_1, newElement_0_eventID, + newElement_0_programID, newElement_0_control, newElement_0_deviceClass, newElement_0_enrollmentGroup, + newElement_0_criticality, newElement_0_startTime, newElement_0_transitions); + chip::JniReferences::GetInstance().AddToList(arrayListObj, newElement_0); + } + + env->ExceptionClear(); + env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); +} + +CHIPDemandResponseLoadControlActiveEventsAttributeCallback::CHIPDemandResponseLoadControlActiveEventsAttributeCallback( + jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), + keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPDemandResponseLoadControlActiveEventsAttributeCallback::~CHIPDemandResponseLoadControlActiveEventsAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPDemandResponseLoadControlActiveEventsAttributeCallback::CallbackFn( + void * context, + const chip::app::DataModel::DecodableList< + chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlEventStruct::DecodableType> & list) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + jobject newElement_0_eventID; + jbyteArray newElement_0_eventIDByteArray = env->NewByteArray(static_cast(entry_0.eventID.size())); + env->SetByteArrayRegion(newElement_0_eventIDByteArray, 0, static_cast(entry_0.eventID.size()), + reinterpret_cast(entry_0.eventID.data())); + newElement_0_eventID = newElement_0_eventIDByteArray; + jobject newElement_0_programID; + if (entry_0.programID.IsNull()) + { + newElement_0_programID = nullptr; + } + else + { + jbyteArray newElement_0_programIDByteArray = env->NewByteArray(static_cast(entry_0.programID.Value().size())); + env->SetByteArrayRegion(newElement_0_programIDByteArray, 0, static_cast(entry_0.programID.Value().size()), + reinterpret_cast(entry_0.programID.Value().data())); + newElement_0_programID = newElement_0_programIDByteArray; + } + jobject newElement_0_control; + std::string newElement_0_controlClassName = "java/lang/Integer"; + std::string newElement_0_controlCtorSignature = "(I)V"; + jint jninewElement_0_control = static_cast(entry_0.control.Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_controlClassName.c_str(), + newElement_0_controlCtorSignature.c_str(), + jninewElement_0_control, newElement_0_control); + jobject newElement_0_deviceClass; + std::string newElement_0_deviceClassClassName = "java/lang/Long"; + std::string newElement_0_deviceClassCtorSignature = "(J)V"; + jlong jninewElement_0_deviceClass = static_cast(entry_0.deviceClass.Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_deviceClassClassName.c_str(), + newElement_0_deviceClassCtorSignature.c_str(), + jninewElement_0_deviceClass, newElement_0_deviceClass); + jobject newElement_0_enrollmentGroup; + if (!entry_0.enrollmentGroup.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_enrollmentGroup); + } + else + { + jobject newElement_0_enrollmentGroupInsideOptional; + std::string newElement_0_enrollmentGroupInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_0_enrollmentGroupInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_0_enrollmentGroupInsideOptional = static_cast(entry_0.enrollmentGroup.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_enrollmentGroupInsideOptionalClassName.c_str(), + newElement_0_enrollmentGroupInsideOptionalCtorSignature.c_str(), jninewElement_0_enrollmentGroupInsideOptional, + newElement_0_enrollmentGroupInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_enrollmentGroupInsideOptional, + newElement_0_enrollmentGroup); + } + jobject newElement_0_criticality; + std::string newElement_0_criticalityClassName = "java/lang/Integer"; + std::string newElement_0_criticalityCtorSignature = "(I)V"; + jint jninewElement_0_criticality = static_cast(entry_0.criticality); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_criticalityClassName.c_str(), + newElement_0_criticalityCtorSignature.c_str(), + jninewElement_0_criticality, newElement_0_criticality); + jobject newElement_0_startTime; + if (entry_0.startTime.IsNull()) + { + newElement_0_startTime = nullptr; + } + else + { + std::string newElement_0_startTimeClassName = "java/lang/Long"; + std::string newElement_0_startTimeCtorSignature = "(J)V"; + jlong jninewElement_0_startTime = static_cast(entry_0.startTime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_startTimeClassName.c_str(), + newElement_0_startTimeCtorSignature.c_str(), + jninewElement_0_startTime, newElement_0_startTime); + } + jobject newElement_0_transitions; + chip::JniReferences::GetInstance().CreateArrayList(newElement_0_transitions); + + auto iter_newElement_0_transitions_2 = entry_0.transitions.begin(); + while (iter_newElement_0_transitions_2.Next()) + { + auto & entry_2 = iter_newElement_0_transitions_2.GetValue(); + jobject newElement_2; + jobject newElement_2_duration; + std::string newElement_2_durationClassName = "java/lang/Integer"; + std::string newElement_2_durationCtorSignature = "(I)V"; + jint jninewElement_2_duration = static_cast(entry_2.duration); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_2_durationClassName.c_str(), + newElement_2_durationCtorSignature.c_str(), + jninewElement_2_duration, newElement_2_duration); + jobject newElement_2_control; + std::string newElement_2_controlClassName = "java/lang/Integer"; + std::string newElement_2_controlCtorSignature = "(I)V"; + jint jninewElement_2_control = static_cast(entry_2.control.Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_2_controlClassName.c_str(), + newElement_2_controlCtorSignature.c_str(), + jninewElement_2_control, newElement_2_control); + jobject newElement_2_temperatureControl; + if (!entry_2.temperatureControl.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_temperatureControl); + } + else + { + jobject newElement_2_temperatureControlInsideOptional; + jobject newElement_2_temperatureControlInsideOptional_coolingTempOffset; + if (!entry_2.temperatureControl.Value().coolingTempOffset.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional( + nullptr, newElement_2_temperatureControlInsideOptional_coolingTempOffset); + } + else + { + jobject newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptional; + if (entry_2.temperatureControl.Value().coolingTempOffset.Value().IsNull()) + { + newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptional = nullptr; + } + else + { + std::string newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptionalClassName = + "java/lang/Integer"; + std::string newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptionalCtorSignature = + "(I)V"; + jint jninewElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptional = + static_cast(entry_2.temperatureControl.Value().coolingTempOffset.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptionalClassName.c_str(), + newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptionalCtorSignature.c_str(), + jninewElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptional, + newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptional); + } + chip::JniReferences::GetInstance().CreateOptional( + newElement_2_temperatureControlInsideOptional_coolingTempOffsetInsideOptional, + newElement_2_temperatureControlInsideOptional_coolingTempOffset); + } + jobject newElement_2_temperatureControlInsideOptional_heatingtTempOffset; + if (!entry_2.temperatureControl.Value().heatingtTempOffset.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional( + nullptr, newElement_2_temperatureControlInsideOptional_heatingtTempOffset); + } + else + { + jobject newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptional; + if (entry_2.temperatureControl.Value().heatingtTempOffset.Value().IsNull()) + { + newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptional = nullptr; + } + else + { + std::string newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptionalClassName = + "java/lang/Integer"; + std::string newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptionalCtorSignature = + "(I)V"; + jint jninewElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptional = + static_cast(entry_2.temperatureControl.Value().heatingtTempOffset.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptionalClassName.c_str(), + newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptionalCtorSignature.c_str(), + jninewElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptional, + newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptional); + } + chip::JniReferences::GetInstance().CreateOptional( + newElement_2_temperatureControlInsideOptional_heatingtTempOffsetInsideOptional, + newElement_2_temperatureControlInsideOptional_heatingtTempOffset); + } + jobject newElement_2_temperatureControlInsideOptional_coolingTempSetpoint; + if (!entry_2.temperatureControl.Value().coolingTempSetpoint.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional( + nullptr, newElement_2_temperatureControlInsideOptional_coolingTempSetpoint); + } + else + { + jobject newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptional; + if (entry_2.temperatureControl.Value().coolingTempSetpoint.Value().IsNull()) + { + newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptional = nullptr; + } + else + { + std::string newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptionalClassName = + "java/lang/Integer"; + std::string newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptionalCtorSignature = + "(I)V"; + jint jninewElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptional = + static_cast(entry_2.temperatureControl.Value().coolingTempSetpoint.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptionalClassName.c_str(), + newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptionalCtorSignature.c_str(), + jninewElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptional, + newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptional); + } + chip::JniReferences::GetInstance().CreateOptional( + newElement_2_temperatureControlInsideOptional_coolingTempSetpointInsideOptional, + newElement_2_temperatureControlInsideOptional_coolingTempSetpoint); + } + jobject newElement_2_temperatureControlInsideOptional_heatingTempSetpoint; + if (!entry_2.temperatureControl.Value().heatingTempSetpoint.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional( + nullptr, newElement_2_temperatureControlInsideOptional_heatingTempSetpoint); + } + else + { + jobject newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptional; + if (entry_2.temperatureControl.Value().heatingTempSetpoint.Value().IsNull()) + { + newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptional = nullptr; + } + else + { + std::string newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptionalClassName = + "java/lang/Integer"; + std::string newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptionalCtorSignature = + "(I)V"; + jint jninewElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptional = + static_cast(entry_2.temperatureControl.Value().heatingTempSetpoint.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptionalClassName.c_str(), + newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptionalCtorSignature.c_str(), + jninewElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptional, + newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptional); + } + chip::JniReferences::GetInstance().CreateOptional( + newElement_2_temperatureControlInsideOptional_heatingTempSetpointInsideOptional, + newElement_2_temperatureControlInsideOptional_heatingTempSetpoint); + } + + jclass temperatureControlStructStructClass_5; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterTemperatureControlStruct", + temperatureControlStructStructClass_5); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$DemandResponseLoadControlClusterTemperatureControlStruct"); + return; + } + jmethodID temperatureControlStructStructCtor_5 = + env->GetMethodID(temperatureControlStructStructClass_5, "", + "(Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V"); + if (temperatureControlStructStructCtor_5 == nullptr) + { + ChipLogError(Zcl, + "Could not find ChipStructs$DemandResponseLoadControlClusterTemperatureControlStruct constructor"); + return; + } + + newElement_2_temperatureControlInsideOptional = + env->NewObject(temperatureControlStructStructClass_5, temperatureControlStructStructCtor_5, + newElement_2_temperatureControlInsideOptional_coolingTempOffset, + newElement_2_temperatureControlInsideOptional_heatingtTempOffset, + newElement_2_temperatureControlInsideOptional_coolingTempSetpoint, + newElement_2_temperatureControlInsideOptional_heatingTempSetpoint); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_temperatureControlInsideOptional, + newElement_2_temperatureControl); + } + jobject newElement_2_averageLoadControl; + if (!entry_2.averageLoadControl.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_averageLoadControl); + } + else + { + jobject newElement_2_averageLoadControlInsideOptional; + jobject newElement_2_averageLoadControlInsideOptional_loadAdjustment; + std::string newElement_2_averageLoadControlInsideOptional_loadAdjustmentClassName = "java/lang/Integer"; + std::string newElement_2_averageLoadControlInsideOptional_loadAdjustmentCtorSignature = "(I)V"; + jint jninewElement_2_averageLoadControlInsideOptional_loadAdjustment = + static_cast(entry_2.averageLoadControl.Value().loadAdjustment); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_averageLoadControlInsideOptional_loadAdjustmentClassName.c_str(), + newElement_2_averageLoadControlInsideOptional_loadAdjustmentCtorSignature.c_str(), + jninewElement_2_averageLoadControlInsideOptional_loadAdjustment, + newElement_2_averageLoadControlInsideOptional_loadAdjustment); + + jclass averageLoadControlStructStructClass_5; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterAverageLoadControlStruct", + averageLoadControlStructStructClass_5); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$DemandResponseLoadControlClusterAverageLoadControlStruct"); + return; + } + jmethodID averageLoadControlStructStructCtor_5 = + env->GetMethodID(averageLoadControlStructStructClass_5, "", "(Ljava/lang/Integer;)V"); + if (averageLoadControlStructStructCtor_5 == nullptr) + { + ChipLogError(Zcl, + "Could not find ChipStructs$DemandResponseLoadControlClusterAverageLoadControlStruct constructor"); + return; + } + + newElement_2_averageLoadControlInsideOptional = + env->NewObject(averageLoadControlStructStructClass_5, averageLoadControlStructStructCtor_5, + newElement_2_averageLoadControlInsideOptional_loadAdjustment); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_averageLoadControlInsideOptional, + newElement_2_averageLoadControl); + } + jobject newElement_2_dutyCycleControl; + if (!entry_2.dutyCycleControl.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_dutyCycleControl); + } + else + { + jobject newElement_2_dutyCycleControlInsideOptional; + jobject newElement_2_dutyCycleControlInsideOptional_dutyCycle; + std::string newElement_2_dutyCycleControlInsideOptional_dutyCycleClassName = "java/lang/Integer"; + std::string newElement_2_dutyCycleControlInsideOptional_dutyCycleCtorSignature = "(I)V"; + jint jninewElement_2_dutyCycleControlInsideOptional_dutyCycle = + static_cast(entry_2.dutyCycleControl.Value().dutyCycle); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_dutyCycleControlInsideOptional_dutyCycleClassName.c_str(), + newElement_2_dutyCycleControlInsideOptional_dutyCycleCtorSignature.c_str(), + jninewElement_2_dutyCycleControlInsideOptional_dutyCycle, + newElement_2_dutyCycleControlInsideOptional_dutyCycle); + + jclass dutyCycleControlStructStructClass_5; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterDutyCycleControlStruct", + dutyCycleControlStructStructClass_5); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$DemandResponseLoadControlClusterDutyCycleControlStruct"); + return; + } + jmethodID dutyCycleControlStructStructCtor_5 = + env->GetMethodID(dutyCycleControlStructStructClass_5, "", "(Ljava/lang/Integer;)V"); + if (dutyCycleControlStructStructCtor_5 == nullptr) + { + ChipLogError(Zcl, + "Could not find ChipStructs$DemandResponseLoadControlClusterDutyCycleControlStruct constructor"); + return; + } + + newElement_2_dutyCycleControlInsideOptional = + env->NewObject(dutyCycleControlStructStructClass_5, dutyCycleControlStructStructCtor_5, + newElement_2_dutyCycleControlInsideOptional_dutyCycle); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_dutyCycleControlInsideOptional, + newElement_2_dutyCycleControl); + } + jobject newElement_2_powerSavingsControl; + if (!entry_2.powerSavingsControl.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_powerSavingsControl); + } + else + { + jobject newElement_2_powerSavingsControlInsideOptional; + jobject newElement_2_powerSavingsControlInsideOptional_powerSavings; + std::string newElement_2_powerSavingsControlInsideOptional_powerSavingsClassName = "java/lang/Integer"; + std::string newElement_2_powerSavingsControlInsideOptional_powerSavingsCtorSignature = "(I)V"; + jint jninewElement_2_powerSavingsControlInsideOptional_powerSavings = + static_cast(entry_2.powerSavingsControl.Value().powerSavings); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_powerSavingsControlInsideOptional_powerSavingsClassName.c_str(), + newElement_2_powerSavingsControlInsideOptional_powerSavingsCtorSignature.c_str(), + jninewElement_2_powerSavingsControlInsideOptional_powerSavings, + newElement_2_powerSavingsControlInsideOptional_powerSavings); + + jclass powerSavingsControlStructStructClass_5; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterPowerSavingsControlStruct", + powerSavingsControlStructStructClass_5); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$DemandResponseLoadControlClusterPowerSavingsControlStruct"); + return; + } + jmethodID powerSavingsControlStructStructCtor_5 = + env->GetMethodID(powerSavingsControlStructStructClass_5, "", "(Ljava/lang/Integer;)V"); + if (powerSavingsControlStructStructCtor_5 == nullptr) + { + ChipLogError( + Zcl, "Could not find ChipStructs$DemandResponseLoadControlClusterPowerSavingsControlStruct constructor"); + return; + } + + newElement_2_powerSavingsControlInsideOptional = + env->NewObject(powerSavingsControlStructStructClass_5, powerSavingsControlStructStructCtor_5, + newElement_2_powerSavingsControlInsideOptional_powerSavings); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_powerSavingsControlInsideOptional, + newElement_2_powerSavingsControl); + } + jobject newElement_2_heatingSourceControl; + if (!entry_2.heatingSourceControl.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_heatingSourceControl); + } + else + { + jobject newElement_2_heatingSourceControlInsideOptional; + jobject newElement_2_heatingSourceControlInsideOptional_heatingSource; + std::string newElement_2_heatingSourceControlInsideOptional_heatingSourceClassName = "java/lang/Integer"; + std::string newElement_2_heatingSourceControlInsideOptional_heatingSourceCtorSignature = "(I)V"; + jint jninewElement_2_heatingSourceControlInsideOptional_heatingSource = + static_cast(entry_2.heatingSourceControl.Value().heatingSource); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_heatingSourceControlInsideOptional_heatingSourceClassName.c_str(), + newElement_2_heatingSourceControlInsideOptional_heatingSourceCtorSignature.c_str(), + jninewElement_2_heatingSourceControlInsideOptional_heatingSource, + newElement_2_heatingSourceControlInsideOptional_heatingSource); + + jclass heatingSourceControlStructStructClass_5; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterHeatingSourceControlStruct", + heatingSourceControlStructStructClass_5); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, + "Could not find class ChipStructs$DemandResponseLoadControlClusterHeatingSourceControlStruct"); + return; + } + jmethodID heatingSourceControlStructStructCtor_5 = + env->GetMethodID(heatingSourceControlStructStructClass_5, "", "(Ljava/lang/Integer;)V"); + if (heatingSourceControlStructStructCtor_5 == nullptr) + { + ChipLogError( + Zcl, "Could not find ChipStructs$DemandResponseLoadControlClusterHeatingSourceControlStruct constructor"); + return; + } + + newElement_2_heatingSourceControlInsideOptional = + env->NewObject(heatingSourceControlStructStructClass_5, heatingSourceControlStructStructCtor_5, + newElement_2_heatingSourceControlInsideOptional_heatingSource); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_heatingSourceControlInsideOptional, + newElement_2_heatingSourceControl); + } + + jclass loadControlEventTransitionStructStructClass_3; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterLoadControlEventTransitionStruct", + loadControlEventTransitionStructStructClass_3); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, + "Could not find class ChipStructs$DemandResponseLoadControlClusterLoadControlEventTransitionStruct"); + return; + } + jmethodID loadControlEventTransitionStructStructCtor_3 = + env->GetMethodID(loadControlEventTransitionStructStructClass_3, "", + "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/" + "Optional;Ljava/util/Optional;Ljava/util/Optional;)V"); + if (loadControlEventTransitionStructStructCtor_3 == nullptr) + { + ChipLogError( + Zcl, "Could not find ChipStructs$DemandResponseLoadControlClusterLoadControlEventTransitionStruct constructor"); + return; + } + + newElement_2 = env->NewObject( + loadControlEventTransitionStructStructClass_3, loadControlEventTransitionStructStructCtor_3, newElement_2_duration, + newElement_2_control, newElement_2_temperatureControl, newElement_2_averageLoadControl, + newElement_2_dutyCycleControl, newElement_2_powerSavingsControl, newElement_2_heatingSourceControl); + chip::JniReferences::GetInstance().AddToList(newElement_0_transitions, newElement_2); + } + + jclass loadControlEventStructStructClass_1; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$DemandResponseLoadControlClusterLoadControlEventStruct", + loadControlEventStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$DemandResponseLoadControlClusterLoadControlEventStruct"); + return; + } + jmethodID loadControlEventStructStructCtor_1 = + env->GetMethodID(loadControlEventStructStructClass_1, "", + "([B[BLjava/lang/Integer;Ljava/lang/Long;Ljava/util/Optional;Ljava/lang/Integer;Ljava/lang/Long;Ljava/" + "util/ArrayList;)V"); + if (loadControlEventStructStructCtor_1 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$DemandResponseLoadControlClusterLoadControlEventStruct constructor"); + return; + } + + newElement_0 = + env->NewObject(loadControlEventStructStructClass_1, loadControlEventStructStructCtor_1, newElement_0_eventID, + newElement_0_programID, newElement_0_control, newElement_0_deviceClass, newElement_0_enrollmentGroup, + newElement_0_criticality, newElement_0_startTime, newElement_0_transitions); + chip::JniReferences::GetInstance().AddToList(arrayListObj, newElement_0); + } + + env->ExceptionClear(); + env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); +} + +CHIPDemandResponseLoadControlGeneratedCommandListAttributeCallback:: +CHIPDemandResponseLoadControlGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), + keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPDemandResponseLoadControlGeneratedCommandListAttributeCallback::~ +CHIPDemandResponseLoadControlGeneratedCommandListAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPDemandResponseLoadControlGeneratedCommandListAttributeCallback::CallbackFn( + void * context, const chip::app::DataModel::DecodableList & list) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_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(arrayListObj, newElement_0); + } + + env->ExceptionClear(); + env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); +} + +CHIPDemandResponseLoadControlAcceptedCommandListAttributeCallback:: +CHIPDemandResponseLoadControlAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), + keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPDemandResponseLoadControlAcceptedCommandListAttributeCallback::~ +CHIPDemandResponseLoadControlAcceptedCommandListAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPDemandResponseLoadControlAcceptedCommandListAttributeCallback::CallbackFn( + void * context, const chip::app::DataModel::DecodableList & list) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_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(arrayListObj, newElement_0); + } + + env->ExceptionClear(); + env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); +} + +CHIPDemandResponseLoadControlEventListAttributeCallback::CHIPDemandResponseLoadControlEventListAttributeCallback( + jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), + keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPDemandResponseLoadControlEventListAttributeCallback::~CHIPDemandResponseLoadControlEventListAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPDemandResponseLoadControlEventListAttributeCallback::CallbackFn( + void * context, const chip::app::DataModel::DecodableList & list) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_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(arrayListObj, newElement_0); + } + + env->ExceptionClear(); + env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); +} + +CHIPDemandResponseLoadControlAttributeListAttributeCallback::CHIPDemandResponseLoadControlAttributeListAttributeCallback( + jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), + keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPDemandResponseLoadControlAttributeListAttributeCallback::~CHIPDemandResponseLoadControlAttributeListAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPDemandResponseLoadControlAttributeListAttributeCallback::CallbackFn( + void * context, const chip::app::DataModel::DecodableList & list) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_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(arrayListObj, newElement_0); + } + + env->ExceptionClear(); + env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); +} + CHIPDoorLockLockStateAttributeCallback::CHIPDoorLockLockStateAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 7308340fb55727..cd139cb683e6e4 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -5885,6 +5885,141 @@ class ChipClusters: }, }, } + _DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER_INFO = { + "clusterName": "DemandResponseLoadControl", + "clusterId": 0x00000096, + "commands": { + 0x00000000: { + "commandId": 0x00000000, + "commandName": "RegisterLoadControlProgramRequest", + "args": { + "loadControlProgram": "LoadControlProgramStruct", + }, + }, + 0x00000001: { + "commandId": 0x00000001, + "commandName": "UnregisterLoadControlProgramRequest", + "args": { + "loadControlProgramID": "bytes", + }, + }, + 0x00000002: { + "commandId": 0x00000002, + "commandName": "AddLoadControlEventRequest", + "args": { + "event": "LoadControlEventStruct", + }, + }, + 0x00000003: { + "commandId": 0x00000003, + "commandName": "RemoveLoadControlEventRequest", + "args": { + "eventID": "bytes", + "cancelControl": "int", + }, + }, + 0x00000004: { + "commandId": 0x00000004, + "commandName": "ClearLoadControlEventsRequest", + "args": { + }, + }, + }, + "attributes": { + 0x00000000: { + "attributeName": "DeviceClass", + "attributeId": 0x00000000, + "type": "int", + "reportable": True, + }, + 0x00000001: { + "attributeName": "LoadControlPrograms", + "attributeId": 0x00000001, + "type": "", + "reportable": True, + }, + 0x00000002: { + "attributeName": "NumberOfLoadControlPrograms", + "attributeId": 0x00000002, + "type": "int", + "reportable": True, + }, + 0x00000003: { + "attributeName": "Events", + "attributeId": 0x00000003, + "type": "", + "reportable": True, + }, + 0x00000004: { + "attributeName": "ActiveEvents", + "attributeId": 0x00000004, + "type": "", + "reportable": True, + }, + 0x00000005: { + "attributeName": "NumberOfEventsPerProgram", + "attributeId": 0x00000005, + "type": "int", + "reportable": True, + }, + 0x00000006: { + "attributeName": "NumberOfTransistions", + "attributeId": 0x00000006, + "type": "int", + "reportable": True, + }, + 0x00000007: { + "attributeName": "DefaultRandomStart", + "attributeId": 0x00000007, + "type": "int", + "reportable": True, + "writable": True, + }, + 0x00000008: { + "attributeName": "DefaultRandomDuration", + "attributeId": 0x00000008, + "type": "int", + "reportable": True, + "writable": 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, + }, + }, + } _DOOR_LOCK_CLUSTER_INFO = { "clusterName": "DoorLock", "clusterId": 0x00000101, @@ -12498,6 +12633,7 @@ class ChipClusters: 0x00000061: _RVC_OPERATIONAL_STATE_CLUSTER_INFO, 0x00000071: _HEPA_FILTER_MONITORING_CLUSTER_INFO, 0x00000072: _ACTIVATED_CARBON_FILTER_MONITORING_CLUSTER_INFO, + 0x00000096: _DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER_INFO, 0x00000101: _DOOR_LOCK_CLUSTER_INFO, 0x00000102: _WINDOW_COVERING_CLUSTER_INFO, 0x00000103: _BARRIER_CONTROL_CLUSTER_INFO, @@ -12602,6 +12738,7 @@ class ChipClusters: "RvcOperationalState": _RVC_OPERATIONAL_STATE_CLUSTER_INFO, "HepaFilterMonitoring": _HEPA_FILTER_MONITORING_CLUSTER_INFO, "ActivatedCarbonFilterMonitoring": _ACTIVATED_CARBON_FILTER_MONITORING_CLUSTER_INFO, + "DemandResponseLoadControl": _DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER_INFO, "DoorLock": _DOOR_LOCK_CLUSTER_INFO, "WindowCovering": _WINDOW_COVERING_CLUSTER_INFO, "BarrierControl": _BARRIER_CONTROL_CLUSTER_INFO, diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index efbbda0897abed..fe2586fdef9168 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -20567,6 +20567,642 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'uint' = 0 +@dataclass +class DemandResponseLoadControl(Cluster): + id: typing.ClassVar[int] = 0x00000096 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="deviceClass", Tag=0x00000000, Type=uint), + ClusterObjectFieldDescriptor(Label="loadControlPrograms", Tag=0x00000001, Type=typing.List[DemandResponseLoadControl.Structs.LoadControlProgramStruct]), + ClusterObjectFieldDescriptor(Label="numberOfLoadControlPrograms", Tag=0x00000002, Type=uint), + ClusterObjectFieldDescriptor(Label="events", Tag=0x00000003, Type=typing.List[DemandResponseLoadControl.Structs.LoadControlEventStruct]), + ClusterObjectFieldDescriptor(Label="activeEvents", Tag=0x00000004, Type=typing.List[DemandResponseLoadControl.Structs.LoadControlEventStruct]), + ClusterObjectFieldDescriptor(Label="numberOfEventsPerProgram", Tag=0x00000005, Type=uint), + ClusterObjectFieldDescriptor(Label="numberOfTransistions", Tag=0x00000006, Type=uint), + ClusterObjectFieldDescriptor(Label="defaultRandomStart", Tag=0x00000007, Type=uint), + ClusterObjectFieldDescriptor(Label="defaultRandomDuration", Tag=0x00000008, Type=uint), + 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), + ]) + + deviceClass: 'uint' = None + loadControlPrograms: 'typing.List[DemandResponseLoadControl.Structs.LoadControlProgramStruct]' = None + numberOfLoadControlPrograms: 'uint' = None + events: 'typing.List[DemandResponseLoadControl.Structs.LoadControlEventStruct]' = None + activeEvents: 'typing.List[DemandResponseLoadControl.Structs.LoadControlEventStruct]' = None + numberOfEventsPerProgram: 'uint' = None + numberOfTransistions: 'uint' = None + defaultRandomStart: 'uint' = None + defaultRandomDuration: 'uint' = 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 CriticalityLevelEnum(MatterIntEnum): + kUnknown = 0x00 + kGreen = 0x01 + kLevel1 = 0x02 + kLevel2 = 0x03 + kLevel3 = 0x04 + kLevel4 = 0x05 + kLevel5 = 0x06 + kEmergency = 0x07 + kPlannedOutage = 0x08 + kServiceDisconnect = 0x09 + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving and unknown + # enum value. This specific should never be transmitted. + kUnknownEnumValue = 10, + + class HeatingSourceEnum(MatterIntEnum): + kAny = 0x00 + kElectric = 0x01 + kNonElectric = 0x02 + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving and unknown + # enum value. This specific should never be transmitted. + kUnknownEnumValue = 3, + + class LoadControlEventChangeSourceEnum(MatterIntEnum): + kAutomatic = 0x00 + kUserAction = 0x01 + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving and unknown + # enum value. This specific should never be transmitted. + kUnknownEnumValue = 2, + + class LoadControlEventStatusEnum(MatterIntEnum): + kUnknown = 0x00 + kReceived = 0x01 + kInProgress = 0x02 + kCompleted = 0x03 + kOptedOut = 0x04 + kOptedIn = 0x05 + kCanceled = 0x06 + kSuperseded = 0x07 + kPartialOptedOut = 0x08 + kPartialOptedIn = 0x09 + kNoParticipation = 0x0A + kUnavailable = 0x0B + kFailed = 0x0C + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving and unknown + # enum value. This specific should never be transmitted. + kUnknownEnumValue = 13, + + class PowerSavingsEnum(MatterIntEnum): + kLow = 0x00 + kMedium = 0x01 + kHigh = 0x02 + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving and unknown + # enum value. This specific should never be transmitted. + kUnknownEnumValue = 3, + + class Bitmaps: + class CancelControlBitmap(IntFlag): + kRandomEnd = 0x1 + + class DeviceClassBitmap(IntFlag): + kHvac = 0x1 + kStripHeater = 0x2 + kWaterHeater = 0x4 + kPoolPump = 0x8 + kSmartAppliance = 0x10 + kIrrigationPump = 0x20 + kCommercialLoad = 0x40 + kResidentialLoad = 0x80 + kExteriorLighting = 0x100 + kInteriorLighting = 0x200 + kEv = 0x400 + kGenerationSystem = 0x800 + kSmartInverter = 0x1000 + kEvse = 0x2000 + kResu = 0x4000 + kEms = 0x8000 + kSem = 0x10000 + + class EventControlBitmap(IntFlag): + kRandomStart = 0x1 + + class EventTransitionControlBitmap(IntFlag): + kRandomDuration = 0x1 + kIgnoreOptOut = 0x2 + + class Feature(IntFlag): + kEnrollmentGroups = 0x1 + kTemperatureOffset = 0x2 + kTemperatureSetpoint = 0x4 + kLoadAdjustment = 0x8 + kDutyCycle = 0x10 + kPowerSavings = 0x20 + kHeatingSource = 0x40 + + class Structs: + @dataclass + class HeatingSourceControlStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="heatingSource", Tag=0, Type=DemandResponseLoadControl.Enums.HeatingSourceEnum), + ]) + + heatingSource: 'DemandResponseLoadControl.Enums.HeatingSourceEnum' = 0 + + @dataclass + class PowerSavingsControlStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="powerSavings", Tag=0, Type=DemandResponseLoadControl.Enums.PowerSavingsEnum), + ]) + + powerSavings: 'DemandResponseLoadControl.Enums.PowerSavingsEnum' = 0 + + @dataclass + class DutyCycleControlStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="dutyCycle", Tag=0, Type=uint), + ]) + + dutyCycle: 'uint' = 0 + + @dataclass + class AverageLoadControlStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="loadAdjustment", Tag=0, Type=int), + ]) + + loadAdjustment: 'int' = 0 + + @dataclass + class TemperatureControlStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="coolingTempOffset", Tag=0, Type=typing.Union[None, Nullable, uint]), + ClusterObjectFieldDescriptor(Label="heatingtTempOffset", Tag=1, Type=typing.Union[None, Nullable, uint]), + ClusterObjectFieldDescriptor(Label="coolingTempSetpoint", Tag=2, Type=typing.Union[None, Nullable, int]), + ClusterObjectFieldDescriptor(Label="heatingTempSetpoint", Tag=3, Type=typing.Union[None, Nullable, int]), + ]) + + coolingTempOffset: 'typing.Union[None, Nullable, uint]' = None + heatingtTempOffset: 'typing.Union[None, Nullable, uint]' = None + coolingTempSetpoint: 'typing.Union[None, Nullable, int]' = None + heatingTempSetpoint: 'typing.Union[None, Nullable, int]' = None + + @dataclass + class LoadControlEventTransitionStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="duration", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="control", Tag=1, Type=uint), + ClusterObjectFieldDescriptor(Label="temperatureControl", Tag=2, Type=typing.Optional[DemandResponseLoadControl.Structs.TemperatureControlStruct]), + ClusterObjectFieldDescriptor(Label="averageLoadControl", Tag=3, Type=typing.Optional[DemandResponseLoadControl.Structs.AverageLoadControlStruct]), + ClusterObjectFieldDescriptor(Label="dutyCycleControl", Tag=4, Type=typing.Optional[DemandResponseLoadControl.Structs.DutyCycleControlStruct]), + ClusterObjectFieldDescriptor(Label="powerSavingsControl", Tag=5, Type=typing.Optional[DemandResponseLoadControl.Structs.PowerSavingsControlStruct]), + ClusterObjectFieldDescriptor(Label="heatingSourceControl", Tag=6, Type=typing.Optional[DemandResponseLoadControl.Structs.HeatingSourceControlStruct]), + ]) + + duration: 'uint' = 0 + control: 'uint' = 0 + temperatureControl: 'typing.Optional[DemandResponseLoadControl.Structs.TemperatureControlStruct]' = None + averageLoadControl: 'typing.Optional[DemandResponseLoadControl.Structs.AverageLoadControlStruct]' = None + dutyCycleControl: 'typing.Optional[DemandResponseLoadControl.Structs.DutyCycleControlStruct]' = None + powerSavingsControl: 'typing.Optional[DemandResponseLoadControl.Structs.PowerSavingsControlStruct]' = None + heatingSourceControl: 'typing.Optional[DemandResponseLoadControl.Structs.HeatingSourceControlStruct]' = None + + @dataclass + class LoadControlEventStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="eventID", Tag=0, Type=bytes), + ClusterObjectFieldDescriptor(Label="programID", Tag=1, Type=typing.Union[Nullable, bytes]), + ClusterObjectFieldDescriptor(Label="control", Tag=2, Type=uint), + ClusterObjectFieldDescriptor(Label="deviceClass", Tag=3, Type=uint), + ClusterObjectFieldDescriptor(Label="enrollmentGroup", Tag=4, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="criticality", Tag=5, Type=DemandResponseLoadControl.Enums.CriticalityLevelEnum), + ClusterObjectFieldDescriptor(Label="startTime", Tag=6, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="transitions", Tag=7, Type=typing.List[DemandResponseLoadControl.Structs.LoadControlEventTransitionStruct]), + ]) + + eventID: 'bytes' = b"" + programID: 'typing.Union[Nullable, bytes]' = NullValue + control: 'uint' = 0 + deviceClass: 'uint' = 0 + enrollmentGroup: 'typing.Optional[uint]' = None + criticality: 'DemandResponseLoadControl.Enums.CriticalityLevelEnum' = 0 + startTime: 'typing.Union[Nullable, uint]' = NullValue + transitions: 'typing.List[DemandResponseLoadControl.Structs.LoadControlEventTransitionStruct]' = field(default_factory=lambda: []) + + @dataclass + class LoadControlProgramStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="programID", Tag=0, Type=bytes), + ClusterObjectFieldDescriptor(Label="name", Tag=1, Type=str), + ClusterObjectFieldDescriptor(Label="enrollmentGroup", Tag=2, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="randomStartMinutes", Tag=3, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="randomDurationMinutes", Tag=4, Type=typing.Union[Nullable, uint]), + ]) + + programID: 'bytes' = b"" + name: 'str' = "" + enrollmentGroup: 'typing.Union[Nullable, uint]' = NullValue + randomStartMinutes: 'typing.Union[Nullable, uint]' = NullValue + randomDurationMinutes: 'typing.Union[Nullable, uint]' = NullValue + + class Commands: + @dataclass + class RegisterLoadControlProgramRequest(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x00000096 + command_id: typing.ClassVar[int] = 0x00000000 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[str] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="loadControlProgram", Tag=0, Type=DemandResponseLoadControl.Structs.LoadControlProgramStruct), + ]) + + loadControlProgram: 'DemandResponseLoadControl.Structs.LoadControlProgramStruct' = field(default_factory=lambda: DemandResponseLoadControl.Structs.LoadControlProgramStruct()) + + @dataclass + class UnregisterLoadControlProgramRequest(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x00000096 + command_id: typing.ClassVar[int] = 0x00000001 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[str] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="loadControlProgramID", Tag=0, Type=bytes), + ]) + + loadControlProgramID: 'bytes' = b"" + + @dataclass + class AddLoadControlEventRequest(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x00000096 + command_id: typing.ClassVar[int] = 0x00000002 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[str] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="event", Tag=0, Type=DemandResponseLoadControl.Structs.LoadControlEventStruct), + ]) + + event: 'DemandResponseLoadControl.Structs.LoadControlEventStruct' = field(default_factory=lambda: DemandResponseLoadControl.Structs.LoadControlEventStruct()) + + @dataclass + class RemoveLoadControlEventRequest(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x00000096 + command_id: typing.ClassVar[int] = 0x00000003 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[str] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="eventID", Tag=0, Type=bytes), + ClusterObjectFieldDescriptor(Label="cancelControl", Tag=1, Type=uint), + ]) + + eventID: 'bytes' = b"" + cancelControl: 'uint' = 0 + + @dataclass + class ClearLoadControlEventsRequest(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x00000096 + command_id: typing.ClassVar[int] = 0x00000004 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[str] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ]) + + class Attributes: + @dataclass + class DeviceClass(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000096 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000000 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + @dataclass + class LoadControlPrograms(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000096 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000001 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[DemandResponseLoadControl.Structs.LoadControlProgramStruct]) + + value: 'typing.List[DemandResponseLoadControl.Structs.LoadControlProgramStruct]' = field(default_factory=lambda: []) + + @dataclass + class NumberOfLoadControlPrograms(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000096 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000002 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + @dataclass + class Events(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000096 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000003 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[DemandResponseLoadControl.Structs.LoadControlEventStruct]) + + value: 'typing.List[DemandResponseLoadControl.Structs.LoadControlEventStruct]' = field(default_factory=lambda: []) + + @dataclass + class ActiveEvents(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000096 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000004 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[DemandResponseLoadControl.Structs.LoadControlEventStruct]) + + value: 'typing.List[DemandResponseLoadControl.Structs.LoadControlEventStruct]' = field(default_factory=lambda: []) + + @dataclass + class NumberOfEventsPerProgram(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000096 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000005 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + @dataclass + class NumberOfTransistions(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000096 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000006 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + @dataclass + class DefaultRandomStart(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000096 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000007 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + @dataclass + class DefaultRandomDuration(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000096 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000008 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + @dataclass + class GeneratedCommandList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000096 + + @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 0x00000096 + + @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 0x00000096 + + @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 0x00000096 + + @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 0x00000096 + + @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 0x00000096 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFD + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + class Events: + @dataclass + class LoadControlEventStatusChange(ClusterEvent): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000096 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000000 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="eventID", Tag=0, Type=bytes), + ClusterObjectFieldDescriptor(Label="transitionIndex", Tag=1, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="status", Tag=2, Type=DemandResponseLoadControl.Enums.LoadControlEventStatusEnum), + ClusterObjectFieldDescriptor(Label="criticality", Tag=3, Type=DemandResponseLoadControl.Enums.CriticalityLevelEnum), + ClusterObjectFieldDescriptor(Label="control", Tag=4, Type=uint), + ClusterObjectFieldDescriptor(Label="temperatureControl", Tag=5, Type=typing.Union[None, Nullable, DemandResponseLoadControl.Structs.TemperatureControlStruct]), + ClusterObjectFieldDescriptor(Label="averageLoadControl", Tag=6, Type=typing.Union[None, Nullable, DemandResponseLoadControl.Structs.AverageLoadControlStruct]), + ClusterObjectFieldDescriptor(Label="dutyCycleControl", Tag=7, Type=typing.Union[None, Nullable, DemandResponseLoadControl.Structs.DutyCycleControlStruct]), + ClusterObjectFieldDescriptor(Label="powerSavingsControl", Tag=8, Type=typing.Union[None, Nullable, DemandResponseLoadControl.Structs.PowerSavingsControlStruct]), + ClusterObjectFieldDescriptor(Label="heatingSourceControl", Tag=9, Type=typing.Union[None, Nullable, DemandResponseLoadControl.Structs.HeatingSourceControlStruct]), + ]) + + eventID: 'bytes' = b"" + transitionIndex: 'typing.Union[Nullable, uint]' = NullValue + status: 'DemandResponseLoadControl.Enums.LoadControlEventStatusEnum' = 0 + criticality: 'DemandResponseLoadControl.Enums.CriticalityLevelEnum' = 0 + control: 'uint' = 0 + temperatureControl: 'typing.Union[None, Nullable, DemandResponseLoadControl.Structs.TemperatureControlStruct]' = None + averageLoadControl: 'typing.Union[None, Nullable, DemandResponseLoadControl.Structs.AverageLoadControlStruct]' = None + dutyCycleControl: 'typing.Union[None, Nullable, DemandResponseLoadControl.Structs.DutyCycleControlStruct]' = None + powerSavingsControl: 'typing.Union[None, Nullable, DemandResponseLoadControl.Structs.PowerSavingsControlStruct]' = None + heatingSourceControl: 'typing.Union[None, Nullable, DemandResponseLoadControl.Structs.HeatingSourceControlStruct]' = None + + @dataclass class DoorLock(Cluster): id: typing.ClassVar[int] = 0x00000101 diff --git a/src/darwin/Framework/CHIP/templates/availability.yaml b/src/darwin/Framework/CHIP/templates/availability.yaml index f046ecb8528793..3e8c376c9d4651 100644 --- a/src/darwin/Framework/CHIP/templates/availability.yaml +++ b/src/darwin/Framework/CHIP/templates/availability.yaml @@ -7833,6 +7833,7 @@ # Targeting Spring 2024 Matter release - MicrowaveOvenControl - MicrowaveOvenMode + - DemandResponseLoadControl attributes: NetworkCommissioning: # Targeting Spring 2024 Matter release diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm index 0350044cdea5e8..949803a3e07a23 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm @@ -2696,6 +2696,60 @@ static BOOL AttributeIsSpecifiedInActivatedCarbonFilterMonitoringCluster(Attribu } } } +static BOOL AttributeIsSpecifiedInDemandResponseLoadControlCluster(AttributeId aAttributeId) +{ + using namespace Clusters::DemandResponseLoadControl; + switch (aAttributeId) { + case Attributes::DeviceClass::Id: { + return YES; + } + case Attributes::LoadControlPrograms::Id: { + return YES; + } + case Attributes::NumberOfLoadControlPrograms::Id: { + return YES; + } + case Attributes::Events::Id: { + return YES; + } + case Attributes::ActiveEvents::Id: { + return YES; + } + case Attributes::NumberOfEventsPerProgram::Id: { + return YES; + } + case Attributes::NumberOfTransistions::Id: { + return YES; + } + case Attributes::DefaultRandomStart::Id: { + return YES; + } + case Attributes::DefaultRandomDuration::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 AttributeIsSpecifiedInDoorLockCluster(AttributeId aAttributeId) { using namespace Clusters::DoorLock; @@ -5781,6 +5835,9 @@ BOOL MTRAttributeIsSpecified(ClusterId aClusterId, AttributeId aAttributeId) case Clusters::ActivatedCarbonFilterMonitoring::Id: { return AttributeIsSpecifiedInActivatedCarbonFilterMonitoringCluster(aAttributeId); } + case Clusters::DemandResponseLoadControl::Id: { + return AttributeIsSpecifiedInDemandResponseLoadControlCluster(aAttributeId); + } case Clusters::DoorLock::Id: { return AttributeIsSpecifiedInDoorLockCluster(aAttributeId); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index 7107984b77c73a..11504f0e1ae195 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -7020,6 +7020,388 @@ static id _Nullable DecodeAttributeValueForActivatedCarbonFilterMonitoringCluste *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; return nil; } +static id _Nullable DecodeAttributeValueForDemandResponseLoadControlCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::DemandResponseLoadControl; + switch (aAttributeId) { + case Attributes::DeviceClass::Id: { + using TypeInfo = Attributes::DeviceClass::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue.Raw()]; + return value; + } + case Attributes::LoadControlPrograms::Id: { + using TypeInfo = Attributes::LoadControlPrograms::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRDemandResponseLoadControlClusterLoadControlProgramStruct * newElement_0; + newElement_0 = [MTRDemandResponseLoadControlClusterLoadControlProgramStruct new]; + newElement_0.programID = AsData(entry_0.programID); + newElement_0.name = AsString(entry_0.name); + if (newElement_0.name == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } + if (entry_0.enrollmentGroup.IsNull()) { + newElement_0.enrollmentGroup = nil; + } else { + newElement_0.enrollmentGroup = [NSNumber numberWithUnsignedChar:entry_0.enrollmentGroup.Value()]; + } + if (entry_0.randomStartMinutes.IsNull()) { + newElement_0.randomStartMinutes = nil; + } else { + newElement_0.randomStartMinutes = [NSNumber numberWithUnsignedChar:entry_0.randomStartMinutes.Value()]; + } + if (entry_0.randomDurationMinutes.IsNull()) { + newElement_0.randomDurationMinutes = nil; + } else { + newElement_0.randomDurationMinutes = [NSNumber numberWithUnsignedChar:entry_0.randomDurationMinutes.Value()]; + } + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::NumberOfLoadControlPrograms::Id: { + using TypeInfo = Attributes::NumberOfLoadControlPrograms::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::Events::Id: { + using TypeInfo = Attributes::Events::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRDemandResponseLoadControlClusterLoadControlEventStruct * newElement_0; + newElement_0 = [MTRDemandResponseLoadControlClusterLoadControlEventStruct new]; + newElement_0.eventID = AsData(entry_0.eventID); + if (entry_0.programID.IsNull()) { + newElement_0.programID = nil; + } else { + newElement_0.programID = AsData(entry_0.programID.Value()); + } + newElement_0.control = [NSNumber numberWithUnsignedShort:entry_0.control.Raw()]; + newElement_0.deviceClass = [NSNumber numberWithUnsignedInt:entry_0.deviceClass.Raw()]; + if (entry_0.enrollmentGroup.HasValue()) { + newElement_0.enrollmentGroup = [NSNumber numberWithUnsignedChar:entry_0.enrollmentGroup.Value()]; + } else { + newElement_0.enrollmentGroup = nil; + } + newElement_0.criticality = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.criticality)]; + if (entry_0.startTime.IsNull()) { + newElement_0.startTime = nil; + } else { + newElement_0.startTime = [NSNumber numberWithUnsignedInt:entry_0.startTime.Value()]; + } + { // Scope for our temporary variables + auto * array_2 = [NSMutableArray new]; + auto iter_2 = entry_0.transitions.begin(); + while (iter_2.Next()) { + auto & entry_2 = iter_2.GetValue(); + MTRDemandResponseLoadControlClusterLoadControlEventTransitionStruct * newElement_2; + newElement_2 = [MTRDemandResponseLoadControlClusterLoadControlEventTransitionStruct new]; + newElement_2.duration = [NSNumber numberWithUnsignedShort:entry_2.duration]; + newElement_2.control = [NSNumber numberWithUnsignedShort:entry_2.control.Raw()]; + if (entry_2.temperatureControl.HasValue()) { + newElement_2.temperatureControl = [MTRDemandResponseLoadControlClusterTemperatureControlStruct new]; + if (entry_2.temperatureControl.Value().coolingTempOffset.HasValue()) { + if (entry_2.temperatureControl.Value().coolingTempOffset.Value().IsNull()) { + newElement_2.temperatureControl.coolingTempOffset = nil; + } else { + newElement_2.temperatureControl.coolingTempOffset = [NSNumber numberWithUnsignedShort:entry_2.temperatureControl.Value().coolingTempOffset.Value().Value()]; + } + } else { + newElement_2.temperatureControl.coolingTempOffset = nil; + } + if (entry_2.temperatureControl.Value().heatingtTempOffset.HasValue()) { + if (entry_2.temperatureControl.Value().heatingtTempOffset.Value().IsNull()) { + newElement_2.temperatureControl.heatingtTempOffset = nil; + } else { + newElement_2.temperatureControl.heatingtTempOffset = [NSNumber numberWithUnsignedShort:entry_2.temperatureControl.Value().heatingtTempOffset.Value().Value()]; + } + } else { + newElement_2.temperatureControl.heatingtTempOffset = nil; + } + if (entry_2.temperatureControl.Value().coolingTempSetpoint.HasValue()) { + if (entry_2.temperatureControl.Value().coolingTempSetpoint.Value().IsNull()) { + newElement_2.temperatureControl.coolingTempSetpoint = nil; + } else { + newElement_2.temperatureControl.coolingTempSetpoint = [NSNumber numberWithShort:entry_2.temperatureControl.Value().coolingTempSetpoint.Value().Value()]; + } + } else { + newElement_2.temperatureControl.coolingTempSetpoint = nil; + } + if (entry_2.temperatureControl.Value().heatingTempSetpoint.HasValue()) { + if (entry_2.temperatureControl.Value().heatingTempSetpoint.Value().IsNull()) { + newElement_2.temperatureControl.heatingTempSetpoint = nil; + } else { + newElement_2.temperatureControl.heatingTempSetpoint = [NSNumber numberWithShort:entry_2.temperatureControl.Value().heatingTempSetpoint.Value().Value()]; + } + } else { + newElement_2.temperatureControl.heatingTempSetpoint = nil; + } + } else { + newElement_2.temperatureControl = nil; + } + if (entry_2.averageLoadControl.HasValue()) { + newElement_2.averageLoadControl = [MTRDemandResponseLoadControlClusterAverageLoadControlStruct new]; + newElement_2.averageLoadControl.loadAdjustment = [NSNumber numberWithChar:entry_2.averageLoadControl.Value().loadAdjustment]; + } else { + newElement_2.averageLoadControl = nil; + } + if (entry_2.dutyCycleControl.HasValue()) { + newElement_2.dutyCycleControl = [MTRDemandResponseLoadControlClusterDutyCycleControlStruct new]; + newElement_2.dutyCycleControl.dutyCycle = [NSNumber numberWithUnsignedChar:entry_2.dutyCycleControl.Value().dutyCycle]; + } else { + newElement_2.dutyCycleControl = nil; + } + if (entry_2.powerSavingsControl.HasValue()) { + newElement_2.powerSavingsControl = [MTRDemandResponseLoadControlClusterPowerSavingsControlStruct new]; + newElement_2.powerSavingsControl.powerSavings = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_2.powerSavingsControl.Value().powerSavings)]; + } else { + newElement_2.powerSavingsControl = nil; + } + if (entry_2.heatingSourceControl.HasValue()) { + newElement_2.heatingSourceControl = [MTRDemandResponseLoadControlClusterHeatingSourceControlStruct new]; + newElement_2.heatingSourceControl.heatingSource = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_2.heatingSourceControl.Value().heatingSource)]; + } else { + newElement_2.heatingSourceControl = nil; + } + [array_2 addObject:newElement_2]; + } + CHIP_ERROR err = iter_2.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + newElement_0.transitions = array_2; + } + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::ActiveEvents::Id: { + using TypeInfo = Attributes::ActiveEvents::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRDemandResponseLoadControlClusterLoadControlEventStruct * newElement_0; + newElement_0 = [MTRDemandResponseLoadControlClusterLoadControlEventStruct new]; + newElement_0.eventID = AsData(entry_0.eventID); + if (entry_0.programID.IsNull()) { + newElement_0.programID = nil; + } else { + newElement_0.programID = AsData(entry_0.programID.Value()); + } + newElement_0.control = [NSNumber numberWithUnsignedShort:entry_0.control.Raw()]; + newElement_0.deviceClass = [NSNumber numberWithUnsignedInt:entry_0.deviceClass.Raw()]; + if (entry_0.enrollmentGroup.HasValue()) { + newElement_0.enrollmentGroup = [NSNumber numberWithUnsignedChar:entry_0.enrollmentGroup.Value()]; + } else { + newElement_0.enrollmentGroup = nil; + } + newElement_0.criticality = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.criticality)]; + if (entry_0.startTime.IsNull()) { + newElement_0.startTime = nil; + } else { + newElement_0.startTime = [NSNumber numberWithUnsignedInt:entry_0.startTime.Value()]; + } + { // Scope for our temporary variables + auto * array_2 = [NSMutableArray new]; + auto iter_2 = entry_0.transitions.begin(); + while (iter_2.Next()) { + auto & entry_2 = iter_2.GetValue(); + MTRDemandResponseLoadControlClusterLoadControlEventTransitionStruct * newElement_2; + newElement_2 = [MTRDemandResponseLoadControlClusterLoadControlEventTransitionStruct new]; + newElement_2.duration = [NSNumber numberWithUnsignedShort:entry_2.duration]; + newElement_2.control = [NSNumber numberWithUnsignedShort:entry_2.control.Raw()]; + if (entry_2.temperatureControl.HasValue()) { + newElement_2.temperatureControl = [MTRDemandResponseLoadControlClusterTemperatureControlStruct new]; + if (entry_2.temperatureControl.Value().coolingTempOffset.HasValue()) { + if (entry_2.temperatureControl.Value().coolingTempOffset.Value().IsNull()) { + newElement_2.temperatureControl.coolingTempOffset = nil; + } else { + newElement_2.temperatureControl.coolingTempOffset = [NSNumber numberWithUnsignedShort:entry_2.temperatureControl.Value().coolingTempOffset.Value().Value()]; + } + } else { + newElement_2.temperatureControl.coolingTempOffset = nil; + } + if (entry_2.temperatureControl.Value().heatingtTempOffset.HasValue()) { + if (entry_2.temperatureControl.Value().heatingtTempOffset.Value().IsNull()) { + newElement_2.temperatureControl.heatingtTempOffset = nil; + } else { + newElement_2.temperatureControl.heatingtTempOffset = [NSNumber numberWithUnsignedShort:entry_2.temperatureControl.Value().heatingtTempOffset.Value().Value()]; + } + } else { + newElement_2.temperatureControl.heatingtTempOffset = nil; + } + if (entry_2.temperatureControl.Value().coolingTempSetpoint.HasValue()) { + if (entry_2.temperatureControl.Value().coolingTempSetpoint.Value().IsNull()) { + newElement_2.temperatureControl.coolingTempSetpoint = nil; + } else { + newElement_2.temperatureControl.coolingTempSetpoint = [NSNumber numberWithShort:entry_2.temperatureControl.Value().coolingTempSetpoint.Value().Value()]; + } + } else { + newElement_2.temperatureControl.coolingTempSetpoint = nil; + } + if (entry_2.temperatureControl.Value().heatingTempSetpoint.HasValue()) { + if (entry_2.temperatureControl.Value().heatingTempSetpoint.Value().IsNull()) { + newElement_2.temperatureControl.heatingTempSetpoint = nil; + } else { + newElement_2.temperatureControl.heatingTempSetpoint = [NSNumber numberWithShort:entry_2.temperatureControl.Value().heatingTempSetpoint.Value().Value()]; + } + } else { + newElement_2.temperatureControl.heatingTempSetpoint = nil; + } + } else { + newElement_2.temperatureControl = nil; + } + if (entry_2.averageLoadControl.HasValue()) { + newElement_2.averageLoadControl = [MTRDemandResponseLoadControlClusterAverageLoadControlStruct new]; + newElement_2.averageLoadControl.loadAdjustment = [NSNumber numberWithChar:entry_2.averageLoadControl.Value().loadAdjustment]; + } else { + newElement_2.averageLoadControl = nil; + } + if (entry_2.dutyCycleControl.HasValue()) { + newElement_2.dutyCycleControl = [MTRDemandResponseLoadControlClusterDutyCycleControlStruct new]; + newElement_2.dutyCycleControl.dutyCycle = [NSNumber numberWithUnsignedChar:entry_2.dutyCycleControl.Value().dutyCycle]; + } else { + newElement_2.dutyCycleControl = nil; + } + if (entry_2.powerSavingsControl.HasValue()) { + newElement_2.powerSavingsControl = [MTRDemandResponseLoadControlClusterPowerSavingsControlStruct new]; + newElement_2.powerSavingsControl.powerSavings = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_2.powerSavingsControl.Value().powerSavings)]; + } else { + newElement_2.powerSavingsControl = nil; + } + if (entry_2.heatingSourceControl.HasValue()) { + newElement_2.heatingSourceControl = [MTRDemandResponseLoadControlClusterHeatingSourceControlStruct new]; + newElement_2.heatingSourceControl.heatingSource = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_2.heatingSourceControl.Value().heatingSource)]; + } else { + newElement_2.heatingSourceControl = nil; + } + [array_2 addObject:newElement_2]; + } + CHIP_ERROR err = iter_2.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + newElement_0.transitions = array_2; + } + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::NumberOfEventsPerProgram::Id: { + using TypeInfo = Attributes::NumberOfEventsPerProgram::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::NumberOfTransistions::Id: { + using TypeInfo = Attributes::NumberOfTransistions::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::DefaultRandomStart::Id: { + using TypeInfo = Attributes::DefaultRandomStart::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::DefaultRandomDuration::Id: { + using TypeInfo = Attributes::DefaultRandomDuration::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} static id _Nullable DecodeAttributeValueForDoorLockCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) { using namespace Clusters::DoorLock; @@ -15718,6 +16100,9 @@ id _Nullable MTRDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::T case Clusters::ActivatedCarbonFilterMonitoring::Id: { return DecodeAttributeValueForActivatedCarbonFilterMonitoringCluster(aPath.mAttributeId, aReader, aError); } + case Clusters::DemandResponseLoadControl::Id: { + return DecodeAttributeValueForDemandResponseLoadControlCluster(aPath.mAttributeId, aReader, aError); + } case Clusters::DoorLock::Id: { return DecodeAttributeValueForDoorLockCluster(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 9bad6f8fea86a0..b1a1d7b9bfeae1 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -6669,6 +6669,158 @@ MTR_PROVISIONALLY_AVAILABLE @end +/** + * Cluster Demand Response Load Control + * + * This cluster provides an interface to the functionality of Smart Energy Demand Response and Load Control. + */ +MTR_PROVISIONALLY_AVAILABLE +@interface MTRBaseClusterDemandResponseLoadControl : MTRGenericBaseCluster + +/** + * Command RegisterLoadControlProgramRequest + * + * Upon receipt, this SHALL insert a new LoadControlProgramStruct into LoadControlPrograms, or if the ProgramID matches an existing LoadControlProgramStruct, then the provider SHALL be updated with the provided values. + */ +- (void)registerLoadControlProgramRequestWithParams:(MTRDemandResponseLoadControlClusterRegisterLoadControlProgramRequestParams *)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +/** + * Command UnregisterLoadControlProgramRequest + * + * Upon receipt, this SHALL remove a the LoadControlProgramStruct from LoadControlPrograms with the matching ProgramID. + */ +- (void)unregisterLoadControlProgramRequestWithParams:(MTRDemandResponseLoadControlClusterUnregisterLoadControlProgramRequestParams *)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +/** + * Command AddLoadControlEventRequest + * + * On receipt of the AddLoadControlEventsRequest command, the server SHALL add a load control event. + */ +- (void)addLoadControlEventRequestWithParams:(MTRDemandResponseLoadControlClusterAddLoadControlEventRequestParams *)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +/** + * Command RemoveLoadControlEventRequest + * + * Upon receipt, this SHALL remove the LoadControlEventStruct with the matching EventID from LoadEventPrograms. + */ +- (void)removeLoadControlEventRequestWithParams:(MTRDemandResponseLoadControlClusterRemoveLoadControlEventRequestParams *)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +/** + * Command ClearLoadControlEventsRequest + * + * Upon receipt, this SHALL clear all the load control events. + */ +- (void)clearLoadControlEventsRequestWithParams:(MTRDemandResponseLoadControlClusterClearLoadControlEventsRequestParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)clearLoadControlEventsRequestWithCompletion:(MTRStatusCompletion)completion + MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeDeviceClassWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeDeviceClassWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeDeviceClassWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeLoadControlProgramsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeLoadControlProgramsWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeLoadControlProgramsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeNumberOfLoadControlProgramsWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeNumberOfLoadControlProgramsWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeNumberOfLoadControlProgramsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeEventsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeEventsWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeEventsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeActiveEventsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeActiveEventsWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeActiveEventsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeNumberOfEventsPerProgramWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeNumberOfEventsPerProgramWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeNumberOfEventsPerProgramWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeNumberOfTransistionsWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeNumberOfTransistionsWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeNumberOfTransistionsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeDefaultRandomStartWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeDefaultRandomStartWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeDefaultRandomStartWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeDefaultRandomStartWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeDefaultRandomStartWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeDefaultRandomDurationWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeDefaultRandomDurationWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeDefaultRandomDurationWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeDefaultRandomDurationWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeDefaultRandomDurationWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _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 MTRBaseClusterDemandResponseLoadControl (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 Door Lock * @@ -15246,6 +15398,95 @@ typedef NS_OPTIONS(uint32_t, MTRActivatedCarbonFilterMonitoringFeature) { MTRActivatedCarbonFilterMonitoringFeatureReplacementProductList MTR_PROVISIONALLY_AVAILABLE = 0x4, } MTR_PROVISIONALLY_AVAILABLE; +typedef NS_ENUM(uint8_t, MTRDemandResponseLoadControlCriticalityLevel) { + MTRDemandResponseLoadControlCriticalityLevelUnknown MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRDemandResponseLoadControlCriticalityLevelGreen MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRDemandResponseLoadControlCriticalityLevelLevel1 MTR_PROVISIONALLY_AVAILABLE = 0x02, + MTRDemandResponseLoadControlCriticalityLevelLevel2 MTR_PROVISIONALLY_AVAILABLE = 0x03, + MTRDemandResponseLoadControlCriticalityLevelLevel3 MTR_PROVISIONALLY_AVAILABLE = 0x04, + MTRDemandResponseLoadControlCriticalityLevelLevel4 MTR_PROVISIONALLY_AVAILABLE = 0x05, + MTRDemandResponseLoadControlCriticalityLevelLevel5 MTR_PROVISIONALLY_AVAILABLE = 0x06, + MTRDemandResponseLoadControlCriticalityLevelEmergency MTR_PROVISIONALLY_AVAILABLE = 0x07, + MTRDemandResponseLoadControlCriticalityLevelPlannedOutage MTR_PROVISIONALLY_AVAILABLE = 0x08, + MTRDemandResponseLoadControlCriticalityLevelServiceDisconnect MTR_PROVISIONALLY_AVAILABLE = 0x09, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_ENUM(uint8_t, MTRDemandResponseLoadControlHeatingSource) { + MTRDemandResponseLoadControlHeatingSourceAny MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRDemandResponseLoadControlHeatingSourceElectric MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRDemandResponseLoadControlHeatingSourceNonElectric MTR_PROVISIONALLY_AVAILABLE = 0x02, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_ENUM(uint8_t, MTRDemandResponseLoadControlLoadControlEventChangeSource) { + MTRDemandResponseLoadControlLoadControlEventChangeSourceAutomatic MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRDemandResponseLoadControlLoadControlEventChangeSourceUserAction MTR_PROVISIONALLY_AVAILABLE = 0x01, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_ENUM(uint8_t, MTRDemandResponseLoadControlLoadControlEventStatus) { + MTRDemandResponseLoadControlLoadControlEventStatusUnknown MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRDemandResponseLoadControlLoadControlEventStatusReceived MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRDemandResponseLoadControlLoadControlEventStatusInProgress MTR_PROVISIONALLY_AVAILABLE = 0x02, + MTRDemandResponseLoadControlLoadControlEventStatusCompleted MTR_PROVISIONALLY_AVAILABLE = 0x03, + MTRDemandResponseLoadControlLoadControlEventStatusOptedOut MTR_PROVISIONALLY_AVAILABLE = 0x04, + MTRDemandResponseLoadControlLoadControlEventStatusOptedIn MTR_PROVISIONALLY_AVAILABLE = 0x05, + MTRDemandResponseLoadControlLoadControlEventStatusCanceled MTR_PROVISIONALLY_AVAILABLE = 0x06, + MTRDemandResponseLoadControlLoadControlEventStatusSuperseded MTR_PROVISIONALLY_AVAILABLE = 0x07, + MTRDemandResponseLoadControlLoadControlEventStatusPartialOptedOut MTR_PROVISIONALLY_AVAILABLE = 0x08, + MTRDemandResponseLoadControlLoadControlEventStatusPartialOptedIn MTR_PROVISIONALLY_AVAILABLE = 0x09, + MTRDemandResponseLoadControlLoadControlEventStatusNoParticipation MTR_PROVISIONALLY_AVAILABLE = 0x0A, + MTRDemandResponseLoadControlLoadControlEventStatusUnavailable MTR_PROVISIONALLY_AVAILABLE = 0x0B, + MTRDemandResponseLoadControlLoadControlEventStatusFailed MTR_PROVISIONALLY_AVAILABLE = 0x0C, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_ENUM(uint8_t, MTRDemandResponseLoadControlPowerSavings) { + MTRDemandResponseLoadControlPowerSavingsLow MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRDemandResponseLoadControlPowerSavingsMedium MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRDemandResponseLoadControlPowerSavingsHigh MTR_PROVISIONALLY_AVAILABLE = 0x02, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_OPTIONS(uint16_t, MTRDemandResponseLoadControlCancelControlBitmap) { + MTRDemandResponseLoadControlCancelControlBitmapRandomEnd MTR_PROVISIONALLY_AVAILABLE = 0x1, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_OPTIONS(uint32_t, MTRDemandResponseLoadControlDeviceClassBitmap) { + MTRDemandResponseLoadControlDeviceClassBitmapHVAC MTR_PROVISIONALLY_AVAILABLE = 0x1, + MTRDemandResponseLoadControlDeviceClassBitmapStripHeater MTR_PROVISIONALLY_AVAILABLE = 0x2, + MTRDemandResponseLoadControlDeviceClassBitmapWaterHeater MTR_PROVISIONALLY_AVAILABLE = 0x4, + MTRDemandResponseLoadControlDeviceClassBitmapPoolPump MTR_PROVISIONALLY_AVAILABLE = 0x8, + MTRDemandResponseLoadControlDeviceClassBitmapSmartAppliance MTR_PROVISIONALLY_AVAILABLE = 0x10, + MTRDemandResponseLoadControlDeviceClassBitmapIrrigationPump MTR_PROVISIONALLY_AVAILABLE = 0x20, + MTRDemandResponseLoadControlDeviceClassBitmapCommercialLoad MTR_PROVISIONALLY_AVAILABLE = 0x40, + MTRDemandResponseLoadControlDeviceClassBitmapResidentialLoad MTR_PROVISIONALLY_AVAILABLE = 0x80, + MTRDemandResponseLoadControlDeviceClassBitmapExteriorLighting MTR_PROVISIONALLY_AVAILABLE = 0x100, + MTRDemandResponseLoadControlDeviceClassBitmapInteriorLighting MTR_PROVISIONALLY_AVAILABLE = 0x200, + MTRDemandResponseLoadControlDeviceClassBitmapEV MTR_PROVISIONALLY_AVAILABLE = 0x400, + MTRDemandResponseLoadControlDeviceClassBitmapGenerationSystem MTR_PROVISIONALLY_AVAILABLE = 0x800, + MTRDemandResponseLoadControlDeviceClassBitmapSmartInverter MTR_PROVISIONALLY_AVAILABLE = 0x1000, + MTRDemandResponseLoadControlDeviceClassBitmapEVSE MTR_PROVISIONALLY_AVAILABLE = 0x2000, + MTRDemandResponseLoadControlDeviceClassBitmapRESU MTR_PROVISIONALLY_AVAILABLE = 0x4000, + MTRDemandResponseLoadControlDeviceClassBitmapEMS MTR_PROVISIONALLY_AVAILABLE = 0x8000, + MTRDemandResponseLoadControlDeviceClassBitmapSEM MTR_PROVISIONALLY_AVAILABLE = 0x10000, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_OPTIONS(uint16_t, MTRDemandResponseLoadControlEventControlBitmap) { + MTRDemandResponseLoadControlEventControlBitmapRandomStart MTR_PROVISIONALLY_AVAILABLE = 0x1, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_OPTIONS(uint16_t, MTRDemandResponseLoadControlEventTransitionControlBitmap) { + MTRDemandResponseLoadControlEventTransitionControlBitmapRandomDuration MTR_PROVISIONALLY_AVAILABLE = 0x1, + MTRDemandResponseLoadControlEventTransitionControlBitmapIgnoreOptOut MTR_PROVISIONALLY_AVAILABLE = 0x2, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_OPTIONS(uint32_t, MTRDemandResponseLoadControlFeature) { + MTRDemandResponseLoadControlFeatureEnrollmentGroups MTR_PROVISIONALLY_AVAILABLE = 0x1, + MTRDemandResponseLoadControlFeatureTemperatureOffset MTR_PROVISIONALLY_AVAILABLE = 0x2, + MTRDemandResponseLoadControlFeatureTemperatureSetpoint MTR_PROVISIONALLY_AVAILABLE = 0x4, + MTRDemandResponseLoadControlFeatureLoadAdjustment MTR_PROVISIONALLY_AVAILABLE = 0x8, + MTRDemandResponseLoadControlFeatureDutyCycle MTR_PROVISIONALLY_AVAILABLE = 0x10, + MTRDemandResponseLoadControlFeaturePowerSavings MTR_PROVISIONALLY_AVAILABLE = 0x20, + MTRDemandResponseLoadControlFeatureHeatingSource MTR_PROVISIONALLY_AVAILABLE = 0x40, +} MTR_PROVISIONALLY_AVAILABLE; + typedef NS_ENUM(uint8_t, MTRDoorLockAlarmCode) { MTRDoorLockAlarmCodeLockJammed MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00, MTRDoorLockAlarmCodeLockFactoryReset MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x01, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index d4e9ba79818af0..e8ae86dd32952e 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -47681,6 +47681,731 @@ + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheC @end +@implementation MTRBaseClusterDemandResponseLoadControl + +- (void)registerLoadControlProgramRequestWithParams:(MTRDemandResponseLoadControlClusterRegisterLoadControlProgramRequestParams *)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRDemandResponseLoadControlClusterRegisterLoadControlProgramRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = DemandResponseLoadControl::Commands::RegisterLoadControlProgramRequest::Type; + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} +- (void)unregisterLoadControlProgramRequestWithParams:(MTRDemandResponseLoadControlClusterUnregisterLoadControlProgramRequestParams *)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRDemandResponseLoadControlClusterUnregisterLoadControlProgramRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = DemandResponseLoadControl::Commands::UnregisterLoadControlProgramRequest::Type; + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} +- (void)addLoadControlEventRequestWithParams:(MTRDemandResponseLoadControlClusterAddLoadControlEventRequestParams *)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRDemandResponseLoadControlClusterAddLoadControlEventRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = DemandResponseLoadControl::Commands::AddLoadControlEventRequest::Type; + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} +- (void)removeLoadControlEventRequestWithParams:(MTRDemandResponseLoadControlClusterRemoveLoadControlEventRequestParams *)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRDemandResponseLoadControlClusterRemoveLoadControlEventRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = DemandResponseLoadControl::Commands::RemoveLoadControlEventRequest::Type; + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} +- (void)clearLoadControlEventsRequestWithCompletion:(MTRStatusCompletion)completion +{ + [self clearLoadControlEventsRequestWithParams:nil completion:completion]; +} +- (void)clearLoadControlEventsRequestWithParams:(MTRDemandResponseLoadControlClusterClearLoadControlEventsRequestParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRDemandResponseLoadControlClusterClearLoadControlEventsRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = DemandResponseLoadControl::Commands::ClearLoadControlEventsRequest::Type; + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} + +- (void)readAttributeDeviceClassWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DemandResponseLoadControl::Attributes::DeviceClass::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeDeviceClassWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = DemandResponseLoadControl::Attributes::DeviceClass::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeDeviceClassWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DemandResponseLoadControl::Attributes::DeviceClass::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeLoadControlProgramsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DemandResponseLoadControl::Attributes::LoadControlPrograms::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeLoadControlProgramsWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = DemandResponseLoadControl::Attributes::LoadControlPrograms::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeLoadControlProgramsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DemandResponseLoadControl::Attributes::LoadControlPrograms::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeNumberOfLoadControlProgramsWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DemandResponseLoadControl::Attributes::NumberOfLoadControlPrograms::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeNumberOfLoadControlProgramsWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = DemandResponseLoadControl::Attributes::NumberOfLoadControlPrograms::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeNumberOfLoadControlProgramsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DemandResponseLoadControl::Attributes::NumberOfLoadControlPrograms::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeEventsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DemandResponseLoadControl::Attributes::Events::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeEventsWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = DemandResponseLoadControl::Attributes::Events::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeEventsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DemandResponseLoadControl::Attributes::Events::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeActiveEventsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DemandResponseLoadControl::Attributes::ActiveEvents::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeActiveEventsWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = DemandResponseLoadControl::Attributes::ActiveEvents::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeActiveEventsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DemandResponseLoadControl::Attributes::ActiveEvents::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeNumberOfEventsPerProgramWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DemandResponseLoadControl::Attributes::NumberOfEventsPerProgram::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeNumberOfEventsPerProgramWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = DemandResponseLoadControl::Attributes::NumberOfEventsPerProgram::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeNumberOfEventsPerProgramWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DemandResponseLoadControl::Attributes::NumberOfEventsPerProgram::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeNumberOfTransistionsWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DemandResponseLoadControl::Attributes::NumberOfTransistions::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeNumberOfTransistionsWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = DemandResponseLoadControl::Attributes::NumberOfTransistions::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeNumberOfTransistionsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DemandResponseLoadControl::Attributes::NumberOfTransistions::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeDefaultRandomStartWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DemandResponseLoadControl::Attributes::DefaultRandomStart::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)writeAttributeDefaultRandomStartWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion +{ + [self writeAttributeDefaultRandomStartWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; +} +- (void)writeAttributeDefaultRandomStartWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + // Make a copy of params before we go async. + params = [params copy]; + value = [value copy]; + + auto * bridge = new MTRDefaultSuccessCallbackBridge(self.callbackQueue, ^(id _Nullable ignored, NSError * _Nullable error) { completion(error); }, ^(ExchangeManager & exchangeManager, const SessionHandle & session, DefaultSuccessCallbackType successCb, MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { + chip::Optional timedWriteTimeout; + if (params != nil) { + if (params.timedWriteTimeout != nil){ + timedWriteTimeout.SetValue(params.timedWriteTimeout.unsignedShortValue); + } + } + + ListFreer listFreer; + using TypeInfo = DemandResponseLoadControl::Attributes::DefaultRandomStart::TypeInfo; + TypeInfo::Type cppValue; + cppValue = value.unsignedCharValue; + + chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpoint); + return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); + std::move(*bridge).DispatchAction(self.device); +} + +- (void)subscribeAttributeDefaultRandomStartWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = DemandResponseLoadControl::Attributes::DefaultRandomStart::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeDefaultRandomStartWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DemandResponseLoadControl::Attributes::DefaultRandomStart::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeDefaultRandomDurationWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DemandResponseLoadControl::Attributes::DefaultRandomDuration::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)writeAttributeDefaultRandomDurationWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion +{ + [self writeAttributeDefaultRandomDurationWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; +} +- (void)writeAttributeDefaultRandomDurationWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + // Make a copy of params before we go async. + params = [params copy]; + value = [value copy]; + + auto * bridge = new MTRDefaultSuccessCallbackBridge(self.callbackQueue, ^(id _Nullable ignored, NSError * _Nullable error) { completion(error); }, ^(ExchangeManager & exchangeManager, const SessionHandle & session, DefaultSuccessCallbackType successCb, MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { + chip::Optional timedWriteTimeout; + if (params != nil) { + if (params.timedWriteTimeout != nil){ + timedWriteTimeout.SetValue(params.timedWriteTimeout.unsignedShortValue); + } + } + + ListFreer listFreer; + using TypeInfo = DemandResponseLoadControl::Attributes::DefaultRandomDuration::TypeInfo; + TypeInfo::Type cppValue; + cppValue = value.unsignedCharValue; + + chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpoint); + return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); + std::move(*bridge).DispatchAction(self.device); +} + +- (void)subscribeAttributeDefaultRandomDurationWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = DemandResponseLoadControl::Attributes::DefaultRandomDuration::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeDefaultRandomDurationWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DemandResponseLoadControl::Attributes::DefaultRandomDuration::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 = DemandResponseLoadControl::Attributes::GeneratedCommandList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + 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 = DemandResponseLoadControl::Attributes::GeneratedCommandList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + 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 = DemandResponseLoadControl::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 = DemandResponseLoadControl::Attributes::AcceptedCommandList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + 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 = DemandResponseLoadControl::Attributes::AcceptedCommandList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + 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 = DemandResponseLoadControl::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 = DemandResponseLoadControl::Attributes::EventList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + 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 = DemandResponseLoadControl::Attributes::EventList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + 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 = DemandResponseLoadControl::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 = DemandResponseLoadControl::Attributes::AttributeList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + 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 = DemandResponseLoadControl::Attributes::AttributeList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + 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 = DemandResponseLoadControl::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 = DemandResponseLoadControl::Attributes::FeatureMap::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + 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 = DemandResponseLoadControl::Attributes::FeatureMap::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + 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 = DemandResponseLoadControl::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 = DemandResponseLoadControl::Attributes::ClusterRevision::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + 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 = DemandResponseLoadControl::Attributes::ClusterRevision::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + 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 = DemandResponseLoadControl::Attributes::ClusterRevision::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +@end + @implementation MTRBaseClusterDoorLock - (void)lockDoorWithParams:(MTRDoorLockClusterLockDoorParams * _Nullable)params completion:(MTRStatusCompletion)completion diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index 2067ce8cb163e6..6a10bcbf73ca5e 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -145,6 +145,7 @@ typedef NS_ENUM(uint32_t, MTRClusterIDType) { MTRClusterIDTypeRVCOperationalStateID MTR_PROVISIONALLY_AVAILABLE = 0x00000061, MTRClusterIDTypeHEPAFilterMonitoringID MTR_PROVISIONALLY_AVAILABLE = 0x00000071, MTRClusterIDTypeActivatedCarbonFilterMonitoringID MTR_PROVISIONALLY_AVAILABLE = 0x00000072, + MTRClusterIDTypeDemandResponseLoadControlID MTR_PROVISIONALLY_AVAILABLE = 0x00000096, MTRClusterIDTypeDoorLockID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000101, MTRClusterIDTypeWindowCoveringID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000102, MTRClusterIDTypeBarrierControlID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000103, @@ -2527,6 +2528,23 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterActivatedCarbonFilterMonitoringAttributeFeatureMapID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeFeatureMapID, MTRAttributeIDTypeClusterActivatedCarbonFilterMonitoringAttributeClusterRevisionID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeClusterRevisionID, + // Cluster DemandResponseLoadControl attributes + MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeDeviceClassID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, + MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeLoadControlProgramsID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeNumberOfLoadControlProgramsID MTR_PROVISIONALLY_AVAILABLE = 0x00000002, + MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeEventsID MTR_PROVISIONALLY_AVAILABLE = 0x00000003, + MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeActiveEventsID MTR_PROVISIONALLY_AVAILABLE = 0x00000004, + MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeNumberOfEventsPerProgramID MTR_PROVISIONALLY_AVAILABLE = 0x00000005, + MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeNumberOfTransistionsID MTR_PROVISIONALLY_AVAILABLE = 0x00000006, + MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeDefaultRandomStartID MTR_PROVISIONALLY_AVAILABLE = 0x00000007, + MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeDefaultRandomDurationID MTR_PROVISIONALLY_AVAILABLE = 0x00000008, + MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeGeneratedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID, + MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeAcceptedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID, + MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeEventListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeEventListID, + MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeAttributeListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAttributeListID, + MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeFeatureMapID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeFeatureMapID, + MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeClusterRevisionID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeClusterRevisionID, + // Cluster DoorLock deprecated attribute names MTRClusterDoorLockAttributeLockStateID MTR_DEPRECATED("Please use MTRAttributeIDTypeClusterDoorLockAttributeLockStateID", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)) @@ -6050,6 +6068,13 @@ typedef NS_ENUM(uint32_t, MTRCommandIDType) { // Cluster ActivatedCarbonFilterMonitoring commands MTRCommandIDTypeClusterActivatedCarbonFilterMonitoringCommandResetConditionID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, + // Cluster DemandResponseLoadControl commands + MTRCommandIDTypeClusterDemandResponseLoadControlCommandRegisterLoadControlProgramRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, + MTRCommandIDTypeClusterDemandResponseLoadControlCommandUnregisterLoadControlProgramRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + MTRCommandIDTypeClusterDemandResponseLoadControlCommandAddLoadControlEventRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000002, + MTRCommandIDTypeClusterDemandResponseLoadControlCommandRemoveLoadControlEventRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000003, + MTRCommandIDTypeClusterDemandResponseLoadControlCommandClearLoadControlEventsRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000004, + // Cluster DoorLock deprecated command id names MTRClusterDoorLockCommandLockDoorID MTR_DEPRECATED("Please use MTRCommandIDTypeClusterDoorLockCommandLockDoorID", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)) @@ -6886,6 +6911,9 @@ typedef NS_ENUM(uint32_t, MTREventIDType) { MTREventIDTypeClusterRVCOperationalStateEventOperationalErrorID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, MTREventIDTypeClusterRVCOperationalStateEventOperationCompletionID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + // Cluster DemandResponseLoadControl events + MTREventIDTypeClusterDemandResponseLoadControlEventLoadControlEventStatusChangeID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, + // Cluster DoorLock deprecated event names MTRClusterDoorLockEventDoorLockAlarmID MTR_DEPRECATED("Please use MTREventIDTypeClusterDoorLockEventDoorLockAlarmID", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)) diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index 566c02f1fa0658..574dab0174b722 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -3152,6 +3152,72 @@ MTR_PROVISIONALLY_AVAILABLE @end +/** + * Cluster Demand Response Load Control + * This cluster provides an interface to the functionality of Smart Energy Demand Response and Load Control. + */ +MTR_PROVISIONALLY_AVAILABLE +@interface MTRClusterDemandResponseLoadControl : MTRGenericCluster + +- (void)registerLoadControlProgramRequestWithParams:(MTRDemandResponseLoadControlClusterRegisterLoadControlProgramRequestParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)unregisterLoadControlProgramRequestWithParams:(MTRDemandResponseLoadControlClusterUnregisterLoadControlProgramRequestParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)addLoadControlEventRequestWithParams:(MTRDemandResponseLoadControlClusterAddLoadControlEventRequestParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)removeLoadControlEventRequestWithParams:(MTRDemandResponseLoadControlClusterRemoveLoadControlEventRequestParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)clearLoadControlEventsRequestWithParams:(MTRDemandResponseLoadControlClusterClearLoadControlEventsRequestParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)clearLoadControlEventsRequestWithExpectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion + MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeDeviceClassWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeLoadControlProgramsWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeNumberOfLoadControlProgramsWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeEventsWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeActiveEventsWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeNumberOfEventsPerProgramWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeNumberOfTransistionsWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeDefaultRandomStartWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeDefaultRandomStartWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeDefaultRandomStartWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeDefaultRandomDurationWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeDefaultRandomDurationWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeDefaultRandomDurationWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _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 MTRClusterDemandResponseLoadControl (Availability) + +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ +- (instancetype _Nullable)initWithDevice:(MTRDevice *)device + endpointID:(NSNumber *)endpointID + queue:(dispatch_queue_t)queue MTR_PROVISIONALLY_AVAILABLE; + +@end + /** * Cluster Door Lock * An interface to a generic way to secure a door diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm index 881ec49f2cc4f1..afb24197208ed2 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -8592,6 +8592,246 @@ - (void)writeAttributeLastChangedTimeWithValue:(NSDictionary *)d @end +@implementation MTRClusterDemandResponseLoadControl + +- (void)registerLoadControlProgramRequestWithParams:(MTRDemandResponseLoadControlClusterRegisterLoadControlProgramRequestParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRDemandResponseLoadControlClusterRegisterLoadControlProgramRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = DemandResponseLoadControl::Commands::RegisterLoadControlProgramRequest::Type; + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} + +- (void)unregisterLoadControlProgramRequestWithParams:(MTRDemandResponseLoadControlClusterUnregisterLoadControlProgramRequestParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRDemandResponseLoadControlClusterUnregisterLoadControlProgramRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = DemandResponseLoadControl::Commands::UnregisterLoadControlProgramRequest::Type; + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} + +- (void)addLoadControlEventRequestWithParams:(MTRDemandResponseLoadControlClusterAddLoadControlEventRequestParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRDemandResponseLoadControlClusterAddLoadControlEventRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = DemandResponseLoadControl::Commands::AddLoadControlEventRequest::Type; + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} + +- (void)removeLoadControlEventRequestWithParams:(MTRDemandResponseLoadControlClusterRemoveLoadControlEventRequestParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRDemandResponseLoadControlClusterRemoveLoadControlEventRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = DemandResponseLoadControl::Commands::RemoveLoadControlEventRequest::Type; + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} + +- (void)clearLoadControlEventsRequestWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion +{ + [self clearLoadControlEventsRequestWithParams:nil expectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs completion:completion]; +} +- (void)clearLoadControlEventsRequestWithParams:(MTRDemandResponseLoadControlClusterClearLoadControlEventsRequestParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRDemandResponseLoadControlClusterClearLoadControlEventsRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = DemandResponseLoadControl::Commands::ClearLoadControlEventsRequest::Type; + [self.device _invokeKnownCommandWithEndpointID:@(self.endpoint) + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} + +- (NSDictionary * _Nullable)readAttributeDeviceClassWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeDemandResponseLoadControlID) attributeID:@(MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeDeviceClassID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeLoadControlProgramsWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeDemandResponseLoadControlID) attributeID:@(MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeLoadControlProgramsID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeNumberOfLoadControlProgramsWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeDemandResponseLoadControlID) attributeID:@(MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeNumberOfLoadControlProgramsID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeEventsWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeDemandResponseLoadControlID) attributeID:@(MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeEventsID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeActiveEventsWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeDemandResponseLoadControlID) attributeID:@(MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeActiveEventsID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeNumberOfEventsPerProgramWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeDemandResponseLoadControlID) attributeID:@(MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeNumberOfEventsPerProgramID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeNumberOfTransistionsWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeDemandResponseLoadControlID) attributeID:@(MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeNumberOfTransistionsID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeDefaultRandomStartWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeDemandResponseLoadControlID) attributeID:@(MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeDefaultRandomStartID) params:params]; +} + +- (void)writeAttributeDefaultRandomStartWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs +{ + [self writeAttributeDefaultRandomStartWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; +} +- (void)writeAttributeDefaultRandomStartWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params +{ + NSNumber * timedWriteTimeout = params.timedWriteTimeout; + + [self.device writeAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeDemandResponseLoadControlID) attributeID:@(MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeDefaultRandomStartID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; +} + +- (NSDictionary * _Nullable)readAttributeDefaultRandomDurationWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeDemandResponseLoadControlID) attributeID:@(MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeDefaultRandomDurationID) params:params]; +} + +- (void)writeAttributeDefaultRandomDurationWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs +{ + [self writeAttributeDefaultRandomDurationWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; +} +- (void)writeAttributeDefaultRandomDurationWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params +{ + NSNumber * timedWriteTimeout = params.timedWriteTimeout; + + [self.device writeAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeDemandResponseLoadControlID) attributeID:@(MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeDefaultRandomDurationID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; +} + +- (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeDemandResponseLoadControlID) attributeID:@(MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeGeneratedCommandListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeDemandResponseLoadControlID) attributeID:@(MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeAcceptedCommandListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeEventListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeDemandResponseLoadControlID) attributeID:@(MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeEventListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeDemandResponseLoadControlID) attributeID:@(MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeAttributeListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeDemandResponseLoadControlID) attributeID:@(MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeFeatureMapID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeDemandResponseLoadControlID) attributeID:@(MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeClusterRevisionID) params:params]; +} + +@end + @implementation MTRClusterDoorLock - (void)lockDoorWithParams:(MTRDoorLockClusterLockDoorParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h index cb88ec7557d242..4a697b150ee6d1 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h @@ -5394,6 +5394,156 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTRDemandResponseLoadControlClusterRegisterLoadControlProgramRequestParams : NSObject + +@property (nonatomic, copy) MTRDemandResponseLoadControlClusterLoadControlProgramStruct * _Nonnull loadControlProgram MTR_PROVISIONALLY_AVAILABLE; +/** + * Controls whether the command is a timed command (using Timed Invoke). + * + * If nil (the default value), a regular invoke is done for commands that do + * not require a timed invoke and a timed invoke with some default timed request + * timeout is done for commands that require a timed invoke. + * + * If not nil, a timed invoke is done, with the provided value used as the timed + * request timeout. The value should be chosen small enough to provide the + * desired security properties but large enough that it will allow a round-trip + * from the sever to the client (for the status response and actual invoke + * request) within the timeout window. + * + */ +@property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; + +/** + * Controls how much time, in seconds, we will allow for the server to process the command. + * + * The command will then time out if that much time, plus an allowance for retransmits due to network failures, passes. + * + * If nil, the framework will try to select an appropriate timeout value itself. + */ +@property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRDemandResponseLoadControlClusterUnregisterLoadControlProgramRequestParams : NSObject + +@property (nonatomic, copy) NSData * _Nonnull loadControlProgramID MTR_PROVISIONALLY_AVAILABLE; +/** + * Controls whether the command is a timed command (using Timed Invoke). + * + * If nil (the default value), a regular invoke is done for commands that do + * not require a timed invoke and a timed invoke with some default timed request + * timeout is done for commands that require a timed invoke. + * + * If not nil, a timed invoke is done, with the provided value used as the timed + * request timeout. The value should be chosen small enough to provide the + * desired security properties but large enough that it will allow a round-trip + * from the sever to the client (for the status response and actual invoke + * request) within the timeout window. + * + */ +@property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; + +/** + * Controls how much time, in seconds, we will allow for the server to process the command. + * + * The command will then time out if that much time, plus an allowance for retransmits due to network failures, passes. + * + * If nil, the framework will try to select an appropriate timeout value itself. + */ +@property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRDemandResponseLoadControlClusterAddLoadControlEventRequestParams : NSObject + +@property (nonatomic, copy) MTRDemandResponseLoadControlClusterLoadControlEventStruct * _Nonnull event MTR_PROVISIONALLY_AVAILABLE; +/** + * Controls whether the command is a timed command (using Timed Invoke). + * + * If nil (the default value), a regular invoke is done for commands that do + * not require a timed invoke and a timed invoke with some default timed request + * timeout is done for commands that require a timed invoke. + * + * If not nil, a timed invoke is done, with the provided value used as the timed + * request timeout. The value should be chosen small enough to provide the + * desired security properties but large enough that it will allow a round-trip + * from the sever to the client (for the status response and actual invoke + * request) within the timeout window. + * + */ +@property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; + +/** + * Controls how much time, in seconds, we will allow for the server to process the command. + * + * The command will then time out if that much time, plus an allowance for retransmits due to network failures, passes. + * + * If nil, the framework will try to select an appropriate timeout value itself. + */ +@property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRDemandResponseLoadControlClusterRemoveLoadControlEventRequestParams : NSObject + +@property (nonatomic, copy) NSData * _Nonnull eventID MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSNumber * _Nonnull cancelControl MTR_PROVISIONALLY_AVAILABLE; +/** + * Controls whether the command is a timed command (using Timed Invoke). + * + * If nil (the default value), a regular invoke is done for commands that do + * not require a timed invoke and a timed invoke with some default timed request + * timeout is done for commands that require a timed invoke. + * + * If not nil, a timed invoke is done, with the provided value used as the timed + * request timeout. The value should be chosen small enough to provide the + * desired security properties but large enough that it will allow a round-trip + * from the sever to the client (for the status response and actual invoke + * request) within the timeout window. + * + */ +@property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; + +/** + * Controls how much time, in seconds, we will allow for the server to process the command. + * + * The command will then time out if that much time, plus an allowance for retransmits due to network failures, passes. + * + * If nil, the framework will try to select an appropriate timeout value itself. + */ +@property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRDemandResponseLoadControlClusterClearLoadControlEventsRequestParams : NSObject +/** + * Controls whether the command is a timed command (using Timed Invoke). + * + * If nil (the default value), a regular invoke is done for commands that do + * not require a timed invoke and a timed invoke with some default timed request + * timeout is done for commands that require a timed invoke. + * + * If not nil, a timed invoke is done, with the provided value used as the timed + * request timeout. The value should be chosen small enough to provide the + * desired security properties but large enough that it will allow a round-trip + * from the sever to the client (for the status response and actual invoke + * request) within the timeout window. + * + */ +@property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; + +/** + * Controls how much time, in seconds, we will allow for the server to process the command. + * + * The command will then time out if that much time, plus an allowance for retransmits due to network failures, passes. + * + * If nil, the framework will try to select an appropriate timeout value itself. + */ +@property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; +@end + MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRDoorLockClusterLockDoorParams : NSObject diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index 051c07adb0971a..2bda728e8cd493 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -14741,6 +14741,517 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader } @end +@implementation MTRDemandResponseLoadControlClusterRegisterLoadControlProgramRequestParams +- (instancetype)init +{ + if (self = [super init]) { + + _loadControlProgram = [MTRDemandResponseLoadControlClusterLoadControlProgramStruct new]; + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRDemandResponseLoadControlClusterRegisterLoadControlProgramRequestParams alloc] init]; + + other.loadControlProgram = self.loadControlProgram; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: loadControlProgram:%@; >", NSStringFromClass([self class]), _loadControlProgram]; + return descriptionString; +} + +@end + +@implementation MTRDemandResponseLoadControlClusterRegisterLoadControlProgramRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::DemandResponseLoadControl::Commands::RegisterLoadControlProgramRequest::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.loadControlProgram.programID = AsByteSpan(self.loadControlProgram.programID); + encodableStruct.loadControlProgram.name = AsCharSpan(self.loadControlProgram.name); + if (self.loadControlProgram.enrollmentGroup == nil) { + encodableStruct.loadControlProgram.enrollmentGroup.SetNull(); + } else { + auto & nonNullValue_1 = encodableStruct.loadControlProgram.enrollmentGroup.SetNonNull(); + nonNullValue_1 = self.loadControlProgram.enrollmentGroup.unsignedCharValue; + } + if (self.loadControlProgram.randomStartMinutes == nil) { + encodableStruct.loadControlProgram.randomStartMinutes.SetNull(); + } else { + auto & nonNullValue_1 = encodableStruct.loadControlProgram.randomStartMinutes.SetNonNull(); + nonNullValue_1 = self.loadControlProgram.randomStartMinutes.unsignedCharValue; + } + if (self.loadControlProgram.randomDurationMinutes == nil) { + encodableStruct.loadControlProgram.randomDurationMinutes.SetNull(); + } else { + auto & nonNullValue_1 = encodableStruct.loadControlProgram.randomDurationMinutes.SetNonNull(); + nonNullValue_1 = self.loadControlProgram.randomDurationMinutes.unsignedCharValue; + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + +@implementation MTRDemandResponseLoadControlClusterUnregisterLoadControlProgramRequestParams +- (instancetype)init +{ + if (self = [super init]) { + + _loadControlProgramID = [NSData data]; + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRDemandResponseLoadControlClusterUnregisterLoadControlProgramRequestParams alloc] init]; + + other.loadControlProgramID = self.loadControlProgramID; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: loadControlProgramID:%@; >", NSStringFromClass([self class]), [_loadControlProgramID base64EncodedStringWithOptions:0]]; + return descriptionString; +} + +@end + +@implementation MTRDemandResponseLoadControlClusterUnregisterLoadControlProgramRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::DemandResponseLoadControl::Commands::UnregisterLoadControlProgramRequest::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.loadControlProgramID = AsByteSpan(self.loadControlProgramID); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + +@implementation MTRDemandResponseLoadControlClusterAddLoadControlEventRequestParams +- (instancetype)init +{ + if (self = [super init]) { + + _event = [MTRDemandResponseLoadControlClusterLoadControlEventStruct new]; + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRDemandResponseLoadControlClusterAddLoadControlEventRequestParams alloc] init]; + + other.event = self.event; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: event:%@; >", NSStringFromClass([self class]), _event]; + return descriptionString; +} + +@end + +@implementation MTRDemandResponseLoadControlClusterAddLoadControlEventRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::DemandResponseLoadControl::Commands::AddLoadControlEventRequest::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.event.eventID = AsByteSpan(self.event.eventID); + if (self.event.programID == nil) { + encodableStruct.event.programID.SetNull(); + } else { + auto & nonNullValue_1 = encodableStruct.event.programID.SetNonNull(); + nonNullValue_1 = AsByteSpan(self.event.programID); + } + encodableStruct.event.control = static_cast>(self.event.control.unsignedShortValue); + encodableStruct.event.deviceClass = static_cast>(self.event.deviceClass.unsignedIntValue); + if (self.event.enrollmentGroup != nil) { + auto & definedValue_1 = encodableStruct.event.enrollmentGroup.Emplace(); + definedValue_1 = self.event.enrollmentGroup.unsignedCharValue; + } + encodableStruct.event.criticality = static_cast>(self.event.criticality.unsignedCharValue); + if (self.event.startTime == nil) { + encodableStruct.event.startTime.SetNull(); + } else { + auto & nonNullValue_1 = encodableStruct.event.startTime.SetNonNull(); + nonNullValue_1 = self.event.startTime.unsignedIntValue; + } + { + using ListType_1 = std::remove_reference_t; + using ListMemberType_1 = ListMemberTypeGetter::Type; + if (self.event.transitions.count != 0) { + auto * listHolder_1 = new ListHolder(self.event.transitions.count); + if (listHolder_1 == nullptr || listHolder_1->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_1); + for (size_t i_1 = 0; i_1 < self.event.transitions.count; ++i_1) { + if (![self.event.transitions[i_1] isKindOfClass:[MTRDemandResponseLoadControlClusterLoadControlEventTransitionStruct class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_1 = (MTRDemandResponseLoadControlClusterLoadControlEventTransitionStruct *) self.event.transitions[i_1]; + listHolder_1->mList[i_1].duration = element_1.duration.unsignedShortValue; + listHolder_1->mList[i_1].control = static_castmList[i_1].control)>>(element_1.control.unsignedShortValue); + if (element_1.temperatureControl != nil) { + auto & definedValue_3 = listHolder_1->mList[i_1].temperatureControl.Emplace(); + if (element_1.temperatureControl.coolingTempOffset != nil) { + auto & definedValue_5 = definedValue_3.coolingTempOffset.Emplace(); + if (element_1.temperatureControl.coolingTempOffset == nil) { + definedValue_5.SetNull(); + } else { + auto & nonNullValue_6 = definedValue_5.SetNonNull(); + nonNullValue_6 = element_1.temperatureControl.coolingTempOffset.unsignedShortValue; + } + } + if (element_1.temperatureControl.heatingtTempOffset != nil) { + auto & definedValue_5 = definedValue_3.heatingtTempOffset.Emplace(); + if (element_1.temperatureControl.heatingtTempOffset == nil) { + definedValue_5.SetNull(); + } else { + auto & nonNullValue_6 = definedValue_5.SetNonNull(); + nonNullValue_6 = element_1.temperatureControl.heatingtTempOffset.unsignedShortValue; + } + } + if (element_1.temperatureControl.coolingTempSetpoint != nil) { + auto & definedValue_5 = definedValue_3.coolingTempSetpoint.Emplace(); + if (element_1.temperatureControl.coolingTempSetpoint == nil) { + definedValue_5.SetNull(); + } else { + auto & nonNullValue_6 = definedValue_5.SetNonNull(); + nonNullValue_6 = element_1.temperatureControl.coolingTempSetpoint.shortValue; + } + } + if (element_1.temperatureControl.heatingTempSetpoint != nil) { + auto & definedValue_5 = definedValue_3.heatingTempSetpoint.Emplace(); + if (element_1.temperatureControl.heatingTempSetpoint == nil) { + definedValue_5.SetNull(); + } else { + auto & nonNullValue_6 = definedValue_5.SetNonNull(); + nonNullValue_6 = element_1.temperatureControl.heatingTempSetpoint.shortValue; + } + } + } + if (element_1.averageLoadControl != nil) { + auto & definedValue_3 = listHolder_1->mList[i_1].averageLoadControl.Emplace(); + definedValue_3.loadAdjustment = element_1.averageLoadControl.loadAdjustment.charValue; + } + if (element_1.dutyCycleControl != nil) { + auto & definedValue_3 = listHolder_1->mList[i_1].dutyCycleControl.Emplace(); + definedValue_3.dutyCycle = element_1.dutyCycleControl.dutyCycle.unsignedCharValue; + } + if (element_1.powerSavingsControl != nil) { + auto & definedValue_3 = listHolder_1->mList[i_1].powerSavingsControl.Emplace(); + definedValue_3.powerSavings = static_cast>(element_1.powerSavingsControl.powerSavings.unsignedCharValue); + } + if (element_1.heatingSourceControl != nil) { + auto & definedValue_3 = listHolder_1->mList[i_1].heatingSourceControl.Emplace(); + definedValue_3.heatingSource = static_cast>(element_1.heatingSourceControl.heatingSource.unsignedCharValue); + } + } + encodableStruct.event.transitions = ListType_1(listHolder_1->mList, self.event.transitions.count); + } else { + encodableStruct.event.transitions = ListType_1(); + } + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + +@implementation MTRDemandResponseLoadControlClusterRemoveLoadControlEventRequestParams +- (instancetype)init +{ + if (self = [super init]) { + + _eventID = [NSData data]; + + _cancelControl = @(0); + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRDemandResponseLoadControlClusterRemoveLoadControlEventRequestParams alloc] init]; + + other.eventID = self.eventID; + other.cancelControl = self.cancelControl; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: eventID:%@; cancelControl:%@; >", NSStringFromClass([self class]), [_eventID base64EncodedStringWithOptions:0], _cancelControl]; + return descriptionString; +} + +@end + +@implementation MTRDemandResponseLoadControlClusterRemoveLoadControlEventRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::DemandResponseLoadControl::Commands::RemoveLoadControlEventRequest::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.eventID = AsByteSpan(self.eventID); + } + { + encodableStruct.cancelControl = static_cast>(self.cancelControl.unsignedShortValue); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + +@implementation MTRDemandResponseLoadControlClusterClearLoadControlEventsRequestParams +- (instancetype)init +{ + if (self = [super init]) { + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRDemandResponseLoadControlClusterClearLoadControlEventsRequestParams alloc] init]; + + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: >", NSStringFromClass([self class])]; + return descriptionString; +} + +@end + +@implementation MTRDemandResponseLoadControlClusterClearLoadControlEventsRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::DemandResponseLoadControl::Commands::ClearLoadControlEventsRequest::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRDoorLockClusterLockDoorParams - (instancetype)init { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h index 79a2f8b2e546ef..720131619d587b 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h @@ -946,6 +946,36 @@ NS_ASSUME_NONNULL_BEGIN @end +@interface MTRDemandResponseLoadControlClusterRegisterLoadControlProgramRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRDemandResponseLoadControlClusterUnregisterLoadControlProgramRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRDemandResponseLoadControlClusterAddLoadControlEventRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRDemandResponseLoadControlClusterRemoveLoadControlEventRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRDemandResponseLoadControlClusterClearLoadControlEventsRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + @interface MTRDoorLockClusterLockDoorParams (InternalMethods) - (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm index f36d2afa08e004..68e801089297d2 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm @@ -545,6 +545,15 @@ static BOOL CommandNeedsTimedInvokeInActivatedCarbonFilterMonitoringCluster(Attr } } } +static BOOL CommandNeedsTimedInvokeInDemandResponseLoadControlCluster(AttributeId aAttributeId) +{ + using namespace Clusters::DemandResponseLoadControl; + switch (aAttributeId) { + default: { + return NO; + } + } +} static BOOL CommandNeedsTimedInvokeInDoorLockCluster(AttributeId aAttributeId) { using namespace Clusters::DoorLock; @@ -1119,6 +1128,9 @@ BOOL MTRCommandNeedsTimedInvoke(NSNumber * _Nonnull aClusterID, NSNumber * _Nonn case Clusters::ActivatedCarbonFilterMonitoring::Id: { return CommandNeedsTimedInvokeInActivatedCarbonFilterMonitoringCluster(commandID); } + case Clusters::DemandResponseLoadControl::Id: { + return CommandNeedsTimedInvokeInDemandResponseLoadControlCluster(commandID); + } case Clusters::DoorLock::Id: { return CommandNeedsTimedInvokeInDoorLockCluster(commandID); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm index a1cc9c4eea8b93..a7e313fec476a2 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm @@ -2249,6 +2249,164 @@ static id _Nullable DecodeEventPayloadForActivatedCarbonFilterMonitoringCluster( *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; return nil; } +static id _Nullable DecodeEventPayloadForDemandResponseLoadControlCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::DemandResponseLoadControl; + switch (aEventId) { + case Events::LoadControlEventStatusChange::Id: { + Events::LoadControlEventStatusChange::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTRDemandResponseLoadControlClusterLoadControlEventStatusChangeEvent new]; + + do { + NSData * _Nonnull memberValue; + memberValue = AsData(cppValue.eventID); + value.eventID = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.transitionIndex.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedChar:cppValue.transitionIndex.Value()]; + } + value.transitionIndex = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.status)]; + value.status = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.criticality)]; + value.criticality = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedShort:cppValue.control.Raw()]; + value.control = memberValue; + } while (0); + do { + MTRDemandResponseLoadControlClusterTemperatureControlStruct * _Nullable memberValue; + if (cppValue.temperatureControl.HasValue()) { + if (cppValue.temperatureControl.Value().IsNull()) { + memberValue = nil; + } else { + memberValue = [MTRDemandResponseLoadControlClusterTemperatureControlStruct new]; + if (cppValue.temperatureControl.Value().Value().coolingTempOffset.HasValue()) { + if (cppValue.temperatureControl.Value().Value().coolingTempOffset.Value().IsNull()) { + memberValue.coolingTempOffset = nil; + } else { + memberValue.coolingTempOffset = [NSNumber numberWithUnsignedShort:cppValue.temperatureControl.Value().Value().coolingTempOffset.Value().Value()]; + } + } else { + memberValue.coolingTempOffset = nil; + } + if (cppValue.temperatureControl.Value().Value().heatingtTempOffset.HasValue()) { + if (cppValue.temperatureControl.Value().Value().heatingtTempOffset.Value().IsNull()) { + memberValue.heatingtTempOffset = nil; + } else { + memberValue.heatingtTempOffset = [NSNumber numberWithUnsignedShort:cppValue.temperatureControl.Value().Value().heatingtTempOffset.Value().Value()]; + } + } else { + memberValue.heatingtTempOffset = nil; + } + if (cppValue.temperatureControl.Value().Value().coolingTempSetpoint.HasValue()) { + if (cppValue.temperatureControl.Value().Value().coolingTempSetpoint.Value().IsNull()) { + memberValue.coolingTempSetpoint = nil; + } else { + memberValue.coolingTempSetpoint = [NSNumber numberWithShort:cppValue.temperatureControl.Value().Value().coolingTempSetpoint.Value().Value()]; + } + } else { + memberValue.coolingTempSetpoint = nil; + } + if (cppValue.temperatureControl.Value().Value().heatingTempSetpoint.HasValue()) { + if (cppValue.temperatureControl.Value().Value().heatingTempSetpoint.Value().IsNull()) { + memberValue.heatingTempSetpoint = nil; + } else { + memberValue.heatingTempSetpoint = [NSNumber numberWithShort:cppValue.temperatureControl.Value().Value().heatingTempSetpoint.Value().Value()]; + } + } else { + memberValue.heatingTempSetpoint = nil; + } + } + } else { + memberValue = nil; + } + value.temperatureControl = memberValue; + } while (0); + do { + MTRDemandResponseLoadControlClusterAverageLoadControlStruct * _Nullable memberValue; + if (cppValue.averageLoadControl.HasValue()) { + if (cppValue.averageLoadControl.Value().IsNull()) { + memberValue = nil; + } else { + memberValue = [MTRDemandResponseLoadControlClusterAverageLoadControlStruct new]; + memberValue.loadAdjustment = [NSNumber numberWithChar:cppValue.averageLoadControl.Value().Value().loadAdjustment]; + } + } else { + memberValue = nil; + } + value.averageLoadControl = memberValue; + } while (0); + do { + MTRDemandResponseLoadControlClusterDutyCycleControlStruct * _Nullable memberValue; + if (cppValue.dutyCycleControl.HasValue()) { + if (cppValue.dutyCycleControl.Value().IsNull()) { + memberValue = nil; + } else { + memberValue = [MTRDemandResponseLoadControlClusterDutyCycleControlStruct new]; + memberValue.dutyCycle = [NSNumber numberWithUnsignedChar:cppValue.dutyCycleControl.Value().Value().dutyCycle]; + } + } else { + memberValue = nil; + } + value.dutyCycleControl = memberValue; + } while (0); + do { + MTRDemandResponseLoadControlClusterPowerSavingsControlStruct * _Nullable memberValue; + if (cppValue.powerSavingsControl.HasValue()) { + if (cppValue.powerSavingsControl.Value().IsNull()) { + memberValue = nil; + } else { + memberValue = [MTRDemandResponseLoadControlClusterPowerSavingsControlStruct new]; + memberValue.powerSavings = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.powerSavingsControl.Value().Value().powerSavings)]; + } + } else { + memberValue = nil; + } + value.powerSavingsControl = memberValue; + } while (0); + do { + MTRDemandResponseLoadControlClusterHeatingSourceControlStruct * _Nullable memberValue; + if (cppValue.heatingSourceControl.HasValue()) { + if (cppValue.heatingSourceControl.Value().IsNull()) { + memberValue = nil; + } else { + memberValue = [MTRDemandResponseLoadControlClusterHeatingSourceControlStruct new]; + memberValue.heatingSource = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.heatingSourceControl.Value().Value().heatingSource)]; + } + } else { + memberValue = nil; + } + value.heatingSourceControl = memberValue; + } while (0); + + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} static id _Nullable DecodeEventPayloadForDoorLockCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) { using namespace Clusters::DoorLock; @@ -3466,6 +3624,9 @@ id _Nullable MTRDecodeEventPayload(const ConcreteEventPath & aPath, TLV::TLVRead case Clusters::ActivatedCarbonFilterMonitoring::Id: { return DecodeEventPayloadForActivatedCarbonFilterMonitoringCluster(aPath.mEventId, aReader, aError); } + case Clusters::DemandResponseLoadControl::Id: { + return DecodeEventPayloadForDemandResponseLoadControlCluster(aPath.mEventId, aReader, aError); + } case Clusters::DoorLock::Id: { return DecodeEventPayloadForDoorLockCluster(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 14c0317f342ab1..9533374a866d00 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -1004,6 +1004,80 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy) NSString * _Nonnull productIdentifierValue MTR_PROVISIONALLY_AVAILABLE; @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTRDemandResponseLoadControlClusterHeatingSourceControlStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull heatingSource MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRDemandResponseLoadControlClusterPowerSavingsControlStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull powerSavings MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRDemandResponseLoadControlClusterDutyCycleControlStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull dutyCycle MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRDemandResponseLoadControlClusterAverageLoadControlStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull loadAdjustment MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRDemandResponseLoadControlClusterTemperatureControlStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nullable coolingTempOffset MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable heatingtTempOffset MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable coolingTempSetpoint MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable heatingTempSetpoint MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRDemandResponseLoadControlClusterLoadControlEventTransitionStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull duration MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull control MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) MTRDemandResponseLoadControlClusterTemperatureControlStruct * _Nullable temperatureControl MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) MTRDemandResponseLoadControlClusterAverageLoadControlStruct * _Nullable averageLoadControl MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) MTRDemandResponseLoadControlClusterDutyCycleControlStruct * _Nullable dutyCycleControl MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) MTRDemandResponseLoadControlClusterPowerSavingsControlStruct * _Nullable powerSavingsControl MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) MTRDemandResponseLoadControlClusterHeatingSourceControlStruct * _Nullable heatingSourceControl MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRDemandResponseLoadControlClusterLoadControlEventStruct : NSObject +@property (nonatomic, copy) NSData * _Nonnull eventID MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSData * _Nullable programID MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull control MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull deviceClass MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable enrollmentGroup MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull criticality MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable startTime MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSArray * _Nonnull transitions MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRDemandResponseLoadControlClusterLoadControlProgramStruct : NSObject +@property (nonatomic, copy) NSData * _Nonnull programID MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSString * _Nonnull name MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable enrollmentGroup MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable randomStartMinutes MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable randomDurationMinutes MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRDemandResponseLoadControlClusterLoadControlEventStatusChangeEvent : NSObject +@property (nonatomic, copy) NSData * _Nonnull eventID MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable transitionIndex MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull status MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull criticality MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull control MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) MTRDemandResponseLoadControlClusterTemperatureControlStruct * _Nullable temperatureControl MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) MTRDemandResponseLoadControlClusterAverageLoadControlStruct * _Nullable averageLoadControl MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) MTRDemandResponseLoadControlClusterDutyCycleControlStruct * _Nullable dutyCycleControl MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) MTRDemandResponseLoadControlClusterPowerSavingsControlStruct * _Nullable powerSavingsControl MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) MTRDemandResponseLoadControlClusterHeatingSourceControlStruct * _Nullable heatingSourceControl MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) @interface MTRDoorLockClusterCredentialStruct : NSObject @property (nonatomic, copy) NSNumber * _Nonnull credentialType MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index 5bb226b973dfd7..46dcf3cef0b058 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -3975,6 +3975,336 @@ - (NSString *)description @end +@implementation MTRDemandResponseLoadControlClusterHeatingSourceControlStruct +- (instancetype)init +{ + if (self = [super init]) { + + _heatingSource = @(0); + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRDemandResponseLoadControlClusterHeatingSourceControlStruct alloc] init]; + + other.heatingSource = self.heatingSource; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: heatingSource:%@; >", NSStringFromClass([self class]), _heatingSource]; + return descriptionString; +} + +@end + +@implementation MTRDemandResponseLoadControlClusterPowerSavingsControlStruct +- (instancetype)init +{ + if (self = [super init]) { + + _powerSavings = @(0); + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRDemandResponseLoadControlClusterPowerSavingsControlStruct alloc] init]; + + other.powerSavings = self.powerSavings; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: powerSavings:%@; >", NSStringFromClass([self class]), _powerSavings]; + return descriptionString; +} + +@end + +@implementation MTRDemandResponseLoadControlClusterDutyCycleControlStruct +- (instancetype)init +{ + if (self = [super init]) { + + _dutyCycle = @(0); + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRDemandResponseLoadControlClusterDutyCycleControlStruct alloc] init]; + + other.dutyCycle = self.dutyCycle; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: dutyCycle:%@; >", NSStringFromClass([self class]), _dutyCycle]; + return descriptionString; +} + +@end + +@implementation MTRDemandResponseLoadControlClusterAverageLoadControlStruct +- (instancetype)init +{ + if (self = [super init]) { + + _loadAdjustment = @(0); + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRDemandResponseLoadControlClusterAverageLoadControlStruct alloc] init]; + + other.loadAdjustment = self.loadAdjustment; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: loadAdjustment:%@; >", NSStringFromClass([self class]), _loadAdjustment]; + return descriptionString; +} + +@end + +@implementation MTRDemandResponseLoadControlClusterTemperatureControlStruct +- (instancetype)init +{ + if (self = [super init]) { + + _coolingTempOffset = nil; + + _heatingtTempOffset = nil; + + _coolingTempSetpoint = nil; + + _heatingTempSetpoint = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRDemandResponseLoadControlClusterTemperatureControlStruct alloc] init]; + + other.coolingTempOffset = self.coolingTempOffset; + other.heatingtTempOffset = self.heatingtTempOffset; + other.coolingTempSetpoint = self.coolingTempSetpoint; + other.heatingTempSetpoint = self.heatingTempSetpoint; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: coolingTempOffset:%@; heatingtTempOffset:%@; coolingTempSetpoint:%@; heatingTempSetpoint:%@; >", NSStringFromClass([self class]), _coolingTempOffset, _heatingtTempOffset, _coolingTempSetpoint, _heatingTempSetpoint]; + return descriptionString; +} + +@end + +@implementation MTRDemandResponseLoadControlClusterLoadControlEventTransitionStruct +- (instancetype)init +{ + if (self = [super init]) { + + _duration = @(0); + + _control = @(0); + + _temperatureControl = nil; + + _averageLoadControl = nil; + + _dutyCycleControl = nil; + + _powerSavingsControl = nil; + + _heatingSourceControl = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRDemandResponseLoadControlClusterLoadControlEventTransitionStruct alloc] init]; + + other.duration = self.duration; + other.control = self.control; + other.temperatureControl = self.temperatureControl; + other.averageLoadControl = self.averageLoadControl; + other.dutyCycleControl = self.dutyCycleControl; + other.powerSavingsControl = self.powerSavingsControl; + other.heatingSourceControl = self.heatingSourceControl; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: duration:%@; control:%@; temperatureControl:%@; averageLoadControl:%@; dutyCycleControl:%@; powerSavingsControl:%@; heatingSourceControl:%@; >", NSStringFromClass([self class]), _duration, _control, _temperatureControl, _averageLoadControl, _dutyCycleControl, _powerSavingsControl, _heatingSourceControl]; + return descriptionString; +} + +@end + +@implementation MTRDemandResponseLoadControlClusterLoadControlEventStruct +- (instancetype)init +{ + if (self = [super init]) { + + _eventID = [NSData data]; + + _programID = nil; + + _control = @(0); + + _deviceClass = @(0); + + _enrollmentGroup = nil; + + _criticality = @(0); + + _startTime = nil; + + _transitions = [NSArray array]; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRDemandResponseLoadControlClusterLoadControlEventStruct alloc] init]; + + other.eventID = self.eventID; + other.programID = self.programID; + other.control = self.control; + other.deviceClass = self.deviceClass; + other.enrollmentGroup = self.enrollmentGroup; + other.criticality = self.criticality; + other.startTime = self.startTime; + other.transitions = self.transitions; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: eventID:%@; programID:%@; control:%@; deviceClass:%@; enrollmentGroup:%@; criticality:%@; startTime:%@; transitions:%@; >", NSStringFromClass([self class]), [_eventID base64EncodedStringWithOptions:0], [_programID base64EncodedStringWithOptions:0], _control, _deviceClass, _enrollmentGroup, _criticality, _startTime, _transitions]; + return descriptionString; +} + +@end + +@implementation MTRDemandResponseLoadControlClusterLoadControlProgramStruct +- (instancetype)init +{ + if (self = [super init]) { + + _programID = [NSData data]; + + _name = @""; + + _enrollmentGroup = nil; + + _randomStartMinutes = nil; + + _randomDurationMinutes = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRDemandResponseLoadControlClusterLoadControlProgramStruct alloc] init]; + + other.programID = self.programID; + other.name = self.name; + other.enrollmentGroup = self.enrollmentGroup; + other.randomStartMinutes = self.randomStartMinutes; + other.randomDurationMinutes = self.randomDurationMinutes; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: programID:%@; name:%@; enrollmentGroup:%@; randomStartMinutes:%@; randomDurationMinutes:%@; >", NSStringFromClass([self class]), [_programID base64EncodedStringWithOptions:0], _name, _enrollmentGroup, _randomStartMinutes, _randomDurationMinutes]; + return descriptionString; +} + +@end + +@implementation MTRDemandResponseLoadControlClusterLoadControlEventStatusChangeEvent +- (instancetype)init +{ + if (self = [super init]) { + + _eventID = [NSData data]; + + _transitionIndex = nil; + + _status = @(0); + + _criticality = @(0); + + _control = @(0); + + _temperatureControl = nil; + + _averageLoadControl = nil; + + _dutyCycleControl = nil; + + _powerSavingsControl = nil; + + _heatingSourceControl = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRDemandResponseLoadControlClusterLoadControlEventStatusChangeEvent alloc] init]; + + other.eventID = self.eventID; + other.transitionIndex = self.transitionIndex; + other.status = self.status; + other.criticality = self.criticality; + other.control = self.control; + other.temperatureControl = self.temperatureControl; + other.averageLoadControl = self.averageLoadControl; + other.dutyCycleControl = self.dutyCycleControl; + other.powerSavingsControl = self.powerSavingsControl; + other.heatingSourceControl = self.heatingSourceControl; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: eventID:%@; transitionIndex:%@; status:%@; criticality:%@; control:%@; temperatureControl:%@; averageLoadControl:%@; dutyCycleControl:%@; powerSavingsControl:%@; heatingSourceControl:%@; >", NSStringFromClass([self class]), [_eventID base64EncodedStringWithOptions:0], _transitionIndex, _status, _criticality, _control, _temperatureControl, _averageLoadControl, _dutyCycleControl, _powerSavingsControl, _heatingSourceControl]; + return descriptionString; +} + +@end + @implementation MTRDoorLockClusterCredentialStruct - (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 e6b2e229c9cb4c..98e554668e1ed6 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 @@ -8948,6 +8948,261 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) } // namespace Attributes } // namespace ActivatedCarbonFilterMonitoring +namespace DemandResponseLoadControl { +namespace Attributes { + +namespace DeviceClass { + +EmberAfStatus Get(chip::EndpointId endpoint, + chip::BitMask * value) +{ + using Traits = NumericAttributeTraits>; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::DemandResponseLoadControl::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + *value = Traits::StorageToWorking(temp); + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitMask value) +{ + using Traits = NumericAttributeTraits>; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::DemandResponseLoadControl::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); +} + +} // namespace DeviceClass + +namespace NumberOfLoadControlPrograms { + +EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::DemandResponseLoadControl::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + *value = Traits::StorageToWorking(temp); + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::DemandResponseLoadControl::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); +} + +} // namespace NumberOfLoadControlPrograms + +namespace NumberOfEventsPerProgram { + +EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::DemandResponseLoadControl::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + *value = Traits::StorageToWorking(temp); + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::DemandResponseLoadControl::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); +} + +} // namespace NumberOfEventsPerProgram + +namespace NumberOfTransistions { + +EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::DemandResponseLoadControl::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + *value = Traits::StorageToWorking(temp); + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::DemandResponseLoadControl::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); +} + +} // namespace NumberOfTransistions + +namespace DefaultRandomStart { + +EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::DemandResponseLoadControl::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + *value = Traits::StorageToWorking(temp); + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::DemandResponseLoadControl::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); +} + +} // namespace DefaultRandomStart + +namespace DefaultRandomDuration { + +EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::DemandResponseLoadControl::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + *value = Traits::StorageToWorking(temp); + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::DemandResponseLoadControl::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); +} + +} // namespace DefaultRandomDuration + +namespace FeatureMap { + +EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::DemandResponseLoadControl::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + *value = Traits::StorageToWorking(temp); + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::DemandResponseLoadControl::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); +} + +} // namespace FeatureMap + +namespace ClusterRevision { + +EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::DemandResponseLoadControl::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + *value = Traits::StorageToWorking(temp); + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::DemandResponseLoadControl::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); +} + +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace DemandResponseLoadControl + namespace DoorLock { 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 25d1fc449e46c9..cb636d81838895 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 @@ -1751,6 +1751,54 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); } // namespace Attributes } // namespace ActivatedCarbonFilterMonitoring +namespace DemandResponseLoadControl { +namespace Attributes { + +namespace DeviceClass { +EmberAfStatus Get(chip::EndpointId endpoint, + chip::BitMask * value); // DeviceClassBitmap +EmberAfStatus Set(chip::EndpointId endpoint, + chip::BitMask value); +} // namespace DeviceClass + +namespace NumberOfLoadControlPrograms { +EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // int8u +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); +} // namespace NumberOfLoadControlPrograms + +namespace NumberOfEventsPerProgram { +EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // int8u +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); +} // namespace NumberOfEventsPerProgram + +namespace NumberOfTransistions { +EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // int8u +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); +} // namespace NumberOfTransistions + +namespace DefaultRandomStart { +EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // int8u +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); +} // namespace DefaultRandomStart + +namespace DefaultRandomDuration { +EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // int8u +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); +} // namespace DefaultRandomDuration + +namespace FeatureMap { +EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 +EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u +EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace DemandResponseLoadControl + namespace DoorLock { 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 1be74b67d57c29..c3e928f001d2b5 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callback.h +++ b/zzz_generated/app-common/app-common/zap-generated/callback.h @@ -513,6 +513,14 @@ void emberAfHepaFilterMonitoringClusterInitCallback(chip::EndpointId endpoint); */ void emberAfActivatedCarbonFilterMonitoringClusterInitCallback(chip::EndpointId endpoint); +/** @brief Demand Response Load Control Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfDemandResponseLoadControlClusterInitCallback(chip::EndpointId endpoint); + /** @brief Door Lock Cluster Init * * Cluster Init @@ -5474,6 +5482,82 @@ void emberAfActivatedCarbonFilterMonitoringClusterServerTickCallback(chip::Endpo */ void emberAfActivatedCarbonFilterMonitoringClusterClientTickCallback(chip::EndpointId endpoint); +// +// Demand Response Load Control Cluster +// + +/** @brief Demand Response Load Control Cluster Server Init + * + * Server Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfDemandResponseLoadControlClusterServerInitCallback(chip::EndpointId endpoint); + +/** @brief Demand Response Load Control Cluster Server Shutdown + * + * Server Shutdown + * + * @param endpoint Endpoint that is being shutdown + */ +void MatterDemandResponseLoadControlClusterServerShutdownCallback(chip::EndpointId endpoint); + +/** @brief Demand Response Load Control Cluster Client Init + * + * Client Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfDemandResponseLoadControlClusterClientInitCallback(chip::EndpointId endpoint); + +/** @brief Demand Response Load Control Cluster Server Attribute Changed + * + * Server Attribute Changed + * + * @param attributePath Concrete attribute path that changed + */ +void MatterDemandResponseLoadControlClusterServerAttributeChangedCallback(const chip::app::ConcreteAttributePath & attributePath); + +/** @brief Demand Response Load Control Cluster Server Pre Attribute Changed + * + * Server Pre Attribute Changed + * + * @param attributePath Concrete attribute path to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +chip::Protocols::InteractionModel::Status MatterDemandResponseLoadControlClusterServerPreAttributeChangedCallback( + const chip::app::ConcreteAttributePath & attributePath, EmberAfAttributeType attributeType, uint16_t size, uint8_t * value); + +/** @brief Demand Response Load Control Cluster Client Pre Attribute Changed + * + * Client Pre Attribute Changed + * + * @param attributePath Concrete attribute path to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +chip::Protocols::InteractionModel::Status MatterDemandResponseLoadControlClusterClientPreAttributeChangedCallback( + const chip::app::ConcreteAttributePath & attributePath, EmberAfAttributeType attributeType, uint16_t size, uint8_t * value); + +/** @brief Demand Response Load Control Cluster Server Tick + * + * Server Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfDemandResponseLoadControlClusterServerTickCallback(chip::EndpointId endpoint); + +/** @brief Demand Response Load Control Cluster Client Tick + * + * Client Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfDemandResponseLoadControlClusterClientTickCallback(chip::EndpointId endpoint); + // // Door Lock Cluster // @@ -9147,6 +9231,37 @@ bool emberAfMicrowaveOvenControlClusterSetCookingParametersCallback( bool emberAfMicrowaveOvenControlClusterAddMoreTimeCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::MicrowaveOvenControl::Commands::AddMoreTime::DecodableType & commandData); +/** + * @brief Demand Response Load Control Cluster RegisterLoadControlProgramRequest Command callback (from client) + */ +bool emberAfDemandResponseLoadControlClusterRegisterLoadControlProgramRequestCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::DemandResponseLoadControl::Commands::RegisterLoadControlProgramRequest::DecodableType & commandData); +/** + * @brief Demand Response Load Control Cluster UnregisterLoadControlProgramRequest Command callback (from client) + */ +bool emberAfDemandResponseLoadControlClusterUnregisterLoadControlProgramRequestCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::DemandResponseLoadControl::Commands::UnregisterLoadControlProgramRequest::DecodableType & + commandData); +/** + * @brief Demand Response Load Control Cluster AddLoadControlEventRequest Command callback (from client) + */ +bool emberAfDemandResponseLoadControlClusterAddLoadControlEventRequestCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::DemandResponseLoadControl::Commands::AddLoadControlEventRequest::DecodableType & commandData); +/** + * @brief Demand Response Load Control Cluster RemoveLoadControlEventRequest Command callback (from client) + */ +bool emberAfDemandResponseLoadControlClusterRemoveLoadControlEventRequestCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::DemandResponseLoadControl::Commands::RemoveLoadControlEventRequest::DecodableType & commandData); +/** + * @brief Demand Response Load Control Cluster ClearLoadControlEventsRequest Command callback (from client) + */ +bool emberAfDemandResponseLoadControlClusterClearLoadControlEventsRequestCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::DemandResponseLoadControl::Commands::ClearLoadControlEventsRequest::DecodableType & commandData); /** * @brief Door Lock Cluster LockDoor Command callback (from client) */ 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 1067411f406ce3..d4d6a3827b4afa 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 @@ -1471,6 +1471,88 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(ActivatedCarbonFilterMo } } +static auto __attribute__((unused)) EnsureKnownEnumValue(DemandResponseLoadControl::CriticalityLevelEnum val) +{ + using EnumType = DemandResponseLoadControl::CriticalityLevelEnum; + switch (val) + { + case EnumType::kUnknown: + case EnumType::kGreen: + case EnumType::kLevel1: + case EnumType::kLevel2: + case EnumType::kLevel3: + case EnumType::kLevel4: + case EnumType::kLevel5: + case EnumType::kEmergency: + case EnumType::kPlannedOutage: + case EnumType::kServiceDisconnect: + return val; + default: + return static_cast(10); + } +} +static auto __attribute__((unused)) EnsureKnownEnumValue(DemandResponseLoadControl::HeatingSourceEnum val) +{ + using EnumType = DemandResponseLoadControl::HeatingSourceEnum; + switch (val) + { + case EnumType::kAny: + case EnumType::kElectric: + case EnumType::kNonElectric: + return val; + default: + return static_cast(3); + } +} +static auto __attribute__((unused)) EnsureKnownEnumValue(DemandResponseLoadControl::LoadControlEventChangeSourceEnum val) +{ + using EnumType = DemandResponseLoadControl::LoadControlEventChangeSourceEnum; + switch (val) + { + case EnumType::kAutomatic: + case EnumType::kUserAction: + return val; + default: + return static_cast(2); + } +} +static auto __attribute__((unused)) EnsureKnownEnumValue(DemandResponseLoadControl::LoadControlEventStatusEnum val) +{ + using EnumType = DemandResponseLoadControl::LoadControlEventStatusEnum; + switch (val) + { + case EnumType::kUnknown: + case EnumType::kReceived: + case EnumType::kInProgress: + case EnumType::kCompleted: + case EnumType::kOptedOut: + case EnumType::kOptedIn: + case EnumType::kCanceled: + case EnumType::kSuperseded: + case EnumType::kPartialOptedOut: + case EnumType::kPartialOptedIn: + case EnumType::kNoParticipation: + case EnumType::kUnavailable: + case EnumType::kFailed: + return val; + default: + return static_cast(13); + } +} +static auto __attribute__((unused)) EnsureKnownEnumValue(DemandResponseLoadControl::PowerSavingsEnum val) +{ + using EnumType = DemandResponseLoadControl::PowerSavingsEnum; + switch (val) + { + case EnumType::kLow: + case EnumType::kMedium: + case EnumType::kHigh: + return val; + default: + return static_cast(3); + } +} + static auto __attribute__((unused)) EnsureKnownEnumValue(DoorLock::AlarmCodeEnum val) { using EnumType = DoorLock::AlarmCodeEnum; 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 cdc0c4605abc29..9e15920f1b27cf 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 @@ -2070,6 +2070,143 @@ enum class Feature : uint32_t }; } // namespace ActivatedCarbonFilterMonitoring +namespace DemandResponseLoadControl { + +// Enum for CriticalityLevelEnum +enum class CriticalityLevelEnum : uint8_t +{ + kUnknown = 0x00, + kGreen = 0x01, + kLevel1 = 0x02, + kLevel2 = 0x03, + kLevel3 = 0x04, + kLevel4 = 0x05, + kLevel5 = 0x06, + kEmergency = 0x07, + kPlannedOutage = 0x08, + kServiceDisconnect = 0x09, + // All received enum values that are not listed above will be mapped + // to kUnknownEnumValue. This is a helper enum value that should only + // be used by code to process how it handles receiving and unknown + // enum value. This specific should never be transmitted. + kUnknownEnumValue = 10, +}; + +// Enum for HeatingSourceEnum +enum class HeatingSourceEnum : uint8_t +{ + kAny = 0x00, + kElectric = 0x01, + kNonElectric = 0x02, + // All received enum values that are not listed above will be mapped + // to kUnknownEnumValue. This is a helper enum value that should only + // be used by code to process how it handles receiving and unknown + // enum value. This specific should never be transmitted. + kUnknownEnumValue = 3, +}; + +// Enum for LoadControlEventChangeSourceEnum +enum class LoadControlEventChangeSourceEnum : uint8_t +{ + kAutomatic = 0x00, + kUserAction = 0x01, + // All received enum values that are not listed above will be mapped + // to kUnknownEnumValue. This is a helper enum value that should only + // be used by code to process how it handles receiving and unknown + // enum value. This specific should never be transmitted. + kUnknownEnumValue = 2, +}; + +// Enum for LoadControlEventStatusEnum +enum class LoadControlEventStatusEnum : uint8_t +{ + kUnknown = 0x00, + kReceived = 0x01, + kInProgress = 0x02, + kCompleted = 0x03, + kOptedOut = 0x04, + kOptedIn = 0x05, + kCanceled = 0x06, + kSuperseded = 0x07, + kPartialOptedOut = 0x08, + kPartialOptedIn = 0x09, + kNoParticipation = 0x0A, + kUnavailable = 0x0B, + kFailed = 0x0C, + // All received enum values that are not listed above will be mapped + // to kUnknownEnumValue. This is a helper enum value that should only + // be used by code to process how it handles receiving and unknown + // enum value. This specific should never be transmitted. + kUnknownEnumValue = 13, +}; + +// Enum for PowerSavingsEnum +enum class PowerSavingsEnum : uint8_t +{ + kLow = 0x00, + kMedium = 0x01, + kHigh = 0x02, + // All received enum values that are not listed above will be mapped + // to kUnknownEnumValue. This is a helper enum value that should only + // be used by code to process how it handles receiving and unknown + // enum value. This specific should never be transmitted. + kUnknownEnumValue = 3, +}; + +// Bitmap for CancelControlBitmap +enum class CancelControlBitmap : uint16_t +{ + kRandomEnd = 0x1, +}; + +// Bitmap for DeviceClassBitmap +enum class DeviceClassBitmap : uint32_t +{ + kHvac = 0x1, + kStripHeater = 0x2, + kWaterHeater = 0x4, + kPoolPump = 0x8, + kSmartAppliance = 0x10, + kIrrigationPump = 0x20, + kCommercialLoad = 0x40, + kResidentialLoad = 0x80, + kExteriorLighting = 0x100, + kInteriorLighting = 0x200, + kEv = 0x400, + kGenerationSystem = 0x800, + kSmartInverter = 0x1000, + kEvse = 0x2000, + kResu = 0x4000, + kEms = 0x8000, + kSem = 0x10000, +}; + +// Bitmap for EventControlBitmap +enum class EventControlBitmap : uint16_t +{ + kRandomStart = 0x1, +}; + +// Bitmap for EventTransitionControlBitmap +enum class EventTransitionControlBitmap : uint16_t +{ + kRandomDuration = 0x1, + kIgnoreOptOut = 0x2, +}; + +// Bitmap for Feature +enum class Feature : uint32_t +{ + kEnrollmentGroups = 0x1, + kTemperatureOffset = 0x2, + kTemperatureSetpoint = 0x4, + kLoadAdjustment = 0x8, + kDutyCycle = 0x10, + kPowerSavings = 0x20, + kHeatingSource = 0x40, +}; +} // namespace DemandResponseLoadControl + namespace DoorLock { // Enum for AlarmCodeEnum 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 7dec810a7dcae7..428f781aaf164c 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 @@ -13138,6 +13138,687 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre namespace Events {} // namespace Events } // namespace ActivatedCarbonFilterMonitoring +namespace DemandResponseLoadControl { +namespace Structs { + +namespace HeatingSourceControlStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kHeatingSource), heatingSource); + 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::kHeatingSource)) + { + err = DataModel::Decode(reader, heatingSource); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace HeatingSourceControlStruct + +namespace PowerSavingsControlStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kPowerSavings), powerSavings); + 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::kPowerSavings)) + { + err = DataModel::Decode(reader, powerSavings); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace PowerSavingsControlStruct + +namespace DutyCycleControlStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kDutyCycle), dutyCycle); + 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::kDutyCycle)) + { + err = DataModel::Decode(reader, dutyCycle); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace DutyCycleControlStruct + +namespace AverageLoadControlStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kLoadAdjustment), loadAdjustment); + 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::kLoadAdjustment)) + { + err = DataModel::Decode(reader, loadAdjustment); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace AverageLoadControlStruct + +namespace TemperatureControlStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kCoolingTempOffset), coolingTempOffset); + encoder.Encode(to_underlying(Fields::kHeatingtTempOffset), heatingtTempOffset); + encoder.Encode(to_underlying(Fields::kCoolingTempSetpoint), coolingTempSetpoint); + encoder.Encode(to_underlying(Fields::kHeatingTempSetpoint), heatingTempSetpoint); + 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::kCoolingTempOffset)) + { + err = DataModel::Decode(reader, coolingTempOffset); + } + else if (__context_tag == to_underlying(Fields::kHeatingtTempOffset)) + { + err = DataModel::Decode(reader, heatingtTempOffset); + } + else if (__context_tag == to_underlying(Fields::kCoolingTempSetpoint)) + { + err = DataModel::Decode(reader, coolingTempSetpoint); + } + else if (__context_tag == to_underlying(Fields::kHeatingTempSetpoint)) + { + err = DataModel::Decode(reader, heatingTempSetpoint); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace TemperatureControlStruct + +namespace LoadControlEventTransitionStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kDuration), duration); + encoder.Encode(to_underlying(Fields::kControl), control); + encoder.Encode(to_underlying(Fields::kTemperatureControl), temperatureControl); + encoder.Encode(to_underlying(Fields::kAverageLoadControl), averageLoadControl); + encoder.Encode(to_underlying(Fields::kDutyCycleControl), dutyCycleControl); + encoder.Encode(to_underlying(Fields::kPowerSavingsControl), powerSavingsControl); + encoder.Encode(to_underlying(Fields::kHeatingSourceControl), heatingSourceControl); + 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::kDuration)) + { + err = DataModel::Decode(reader, duration); + } + else if (__context_tag == to_underlying(Fields::kControl)) + { + err = DataModel::Decode(reader, control); + } + else if (__context_tag == to_underlying(Fields::kTemperatureControl)) + { + err = DataModel::Decode(reader, temperatureControl); + } + else if (__context_tag == to_underlying(Fields::kAverageLoadControl)) + { + err = DataModel::Decode(reader, averageLoadControl); + } + else if (__context_tag == to_underlying(Fields::kDutyCycleControl)) + { + err = DataModel::Decode(reader, dutyCycleControl); + } + else if (__context_tag == to_underlying(Fields::kPowerSavingsControl)) + { + err = DataModel::Decode(reader, powerSavingsControl); + } + else if (__context_tag == to_underlying(Fields::kHeatingSourceControl)) + { + err = DataModel::Decode(reader, heatingSourceControl); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace LoadControlEventTransitionStruct + +namespace LoadControlEventStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kEventID), eventID); + encoder.Encode(to_underlying(Fields::kProgramID), programID); + encoder.Encode(to_underlying(Fields::kControl), control); + encoder.Encode(to_underlying(Fields::kDeviceClass), deviceClass); + encoder.Encode(to_underlying(Fields::kEnrollmentGroup), enrollmentGroup); + encoder.Encode(to_underlying(Fields::kCriticality), criticality); + encoder.Encode(to_underlying(Fields::kStartTime), startTime); + encoder.Encode(to_underlying(Fields::kTransitions), transitions); + 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::kEventID)) + { + err = DataModel::Decode(reader, eventID); + } + else if (__context_tag == to_underlying(Fields::kProgramID)) + { + err = DataModel::Decode(reader, programID); + } + else if (__context_tag == to_underlying(Fields::kControl)) + { + err = DataModel::Decode(reader, control); + } + else if (__context_tag == to_underlying(Fields::kDeviceClass)) + { + err = DataModel::Decode(reader, deviceClass); + } + else if (__context_tag == to_underlying(Fields::kEnrollmentGroup)) + { + err = DataModel::Decode(reader, enrollmentGroup); + } + else if (__context_tag == to_underlying(Fields::kCriticality)) + { + err = DataModel::Decode(reader, criticality); + } + else if (__context_tag == to_underlying(Fields::kStartTime)) + { + err = DataModel::Decode(reader, startTime); + } + else if (__context_tag == to_underlying(Fields::kTransitions)) + { + err = DataModel::Decode(reader, transitions); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace LoadControlEventStruct + +namespace LoadControlProgramStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kProgramID), programID); + encoder.Encode(to_underlying(Fields::kName), name); + encoder.Encode(to_underlying(Fields::kEnrollmentGroup), enrollmentGroup); + encoder.Encode(to_underlying(Fields::kRandomStartMinutes), randomStartMinutes); + encoder.Encode(to_underlying(Fields::kRandomDurationMinutes), randomDurationMinutes); + 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::kProgramID)) + { + err = DataModel::Decode(reader, programID); + } + else if (__context_tag == to_underlying(Fields::kName)) + { + err = DataModel::Decode(reader, name); + } + else if (__context_tag == to_underlying(Fields::kEnrollmentGroup)) + { + err = DataModel::Decode(reader, enrollmentGroup); + } + else if (__context_tag == to_underlying(Fields::kRandomStartMinutes)) + { + err = DataModel::Decode(reader, randomStartMinutes); + } + else if (__context_tag == to_underlying(Fields::kRandomDurationMinutes)) + { + err = DataModel::Decode(reader, randomDurationMinutes); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace LoadControlProgramStruct +} // namespace Structs + +namespace Commands { +namespace RegisterLoadControlProgramRequest { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kLoadControlProgram), loadControlProgram); + 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::kLoadControlProgram)) + { + err = DataModel::Decode(reader, loadControlProgram); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace RegisterLoadControlProgramRequest. +namespace UnregisterLoadControlProgramRequest { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kLoadControlProgramID), loadControlProgramID); + 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::kLoadControlProgramID)) + { + err = DataModel::Decode(reader, loadControlProgramID); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace UnregisterLoadControlProgramRequest. +namespace AddLoadControlEventRequest { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kEvent), event); + 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::kEvent)) + { + err = DataModel::Decode(reader, event); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace AddLoadControlEventRequest. +namespace RemoveLoadControlEventRequest { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kEventID), eventID); + encoder.Encode(to_underlying(Fields::kCancelControl), cancelControl); + 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::kEventID)) + { + err = DataModel::Decode(reader, eventID); + } + else if (__context_tag == to_underlying(Fields::kCancelControl)) + { + err = DataModel::Decode(reader, cancelControl); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace RemoveLoadControlEventRequest. +namespace ClearLoadControlEventsRequest { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + 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); + } + } +} +} // namespace ClearLoadControlEventsRequest. +} // namespace Commands + +namespace Attributes { +CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path) +{ + switch (path.mAttributeId) + { + case Attributes::DeviceClass::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, deviceClass); + case Attributes::LoadControlPrograms::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, loadControlPrograms); + case Attributes::NumberOfLoadControlPrograms::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, numberOfLoadControlPrograms); + case Attributes::Events::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, events); + case Attributes::ActiveEvents::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, activeEvents); + case Attributes::NumberOfEventsPerProgram::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, numberOfEventsPerProgram); + case Attributes::NumberOfTransistions::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, numberOfTransistions); + case Attributes::DefaultRandomStart::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, defaultRandomStart); + case Attributes::DefaultRandomDuration::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, defaultRandomDuration); + 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 LoadControlEventStatusChange { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kEventID), eventID)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTransitionIndex), transitionIndex)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatus), status)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCriticality), criticality)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kControl), control)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTemperatureControl), temperatureControl)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kAverageLoadControl), averageLoadControl)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kDutyCycleControl), dutyCycleControl)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kPowerSavingsControl), powerSavingsControl)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kHeatingSourceControl), heatingSourceControl)); + return aWriter.EndContainer(outer); +} + +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::kEventID)) + { + err = DataModel::Decode(reader, eventID); + } + else if (__context_tag == to_underlying(Fields::kTransitionIndex)) + { + err = DataModel::Decode(reader, transitionIndex); + } + else if (__context_tag == to_underlying(Fields::kStatus)) + { + err = DataModel::Decode(reader, status); + } + else if (__context_tag == to_underlying(Fields::kCriticality)) + { + err = DataModel::Decode(reader, criticality); + } + else if (__context_tag == to_underlying(Fields::kControl)) + { + err = DataModel::Decode(reader, control); + } + else if (__context_tag == to_underlying(Fields::kTemperatureControl)) + { + err = DataModel::Decode(reader, temperatureControl); + } + else if (__context_tag == to_underlying(Fields::kAverageLoadControl)) + { + err = DataModel::Decode(reader, averageLoadControl); + } + else if (__context_tag == to_underlying(Fields::kDutyCycleControl)) + { + err = DataModel::Decode(reader, dutyCycleControl); + } + else if (__context_tag == to_underlying(Fields::kPowerSavingsControl)) + { + err = DataModel::Decode(reader, powerSavingsControl); + } + else if (__context_tag == to_underlying(Fields::kHeatingSourceControl)) + { + err = DataModel::Decode(reader, heatingSourceControl); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace LoadControlEventStatusChange. +} // namespace Events + +} // namespace DemandResponseLoadControl namespace DoorLock { namespace Structs { @@ -23438,6 +24119,13 @@ bool CommandIsFabricScoped(ClusterId aCluster, CommandId aCommand) return false; } } + case Clusters::DemandResponseLoadControl::Id: { + switch (aCommand) + { + default: + return false; + } + } case Clusters::DoorLock::Id: { switch (aCommand) { 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 44de094ddc529d..63dd7ce172de80 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 @@ -18721,6 +18721,669 @@ struct TypeInfo }; } // namespace Attributes } // namespace ActivatedCarbonFilterMonitoring +namespace DemandResponseLoadControl { +namespace Structs { +namespace HeatingSourceControlStruct { +enum class Fields : uint8_t +{ + kHeatingSource = 0, +}; + +struct Type +{ +public: + HeatingSourceEnum heatingSource = static_cast(0); + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace HeatingSourceControlStruct +namespace PowerSavingsControlStruct { +enum class Fields : uint8_t +{ + kPowerSavings = 0, +}; + +struct Type +{ +public: + PowerSavingsEnum powerSavings = static_cast(0); + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace PowerSavingsControlStruct +namespace DutyCycleControlStruct { +enum class Fields : uint8_t +{ + kDutyCycle = 0, +}; + +struct Type +{ +public: + chip::Percent dutyCycle = static_cast(0); + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace DutyCycleControlStruct +namespace AverageLoadControlStruct { +enum class Fields : uint8_t +{ + kLoadAdjustment = 0, +}; + +struct Type +{ +public: + int8_t loadAdjustment = static_cast(0); + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace AverageLoadControlStruct +namespace TemperatureControlStruct { +enum class Fields : uint8_t +{ + kCoolingTempOffset = 0, + kHeatingtTempOffset = 1, + kCoolingTempSetpoint = 2, + kHeatingTempSetpoint = 3, +}; + +struct Type +{ +public: + Optional> coolingTempOffset; + Optional> heatingtTempOffset; + Optional> coolingTempSetpoint; + Optional> heatingTempSetpoint; + + 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 TemperatureControlStruct +namespace LoadControlEventTransitionStruct { +enum class Fields : uint8_t +{ + kDuration = 0, + kControl = 1, + kTemperatureControl = 2, + kAverageLoadControl = 3, + kDutyCycleControl = 4, + kPowerSavingsControl = 5, + kHeatingSourceControl = 6, +}; + +struct Type +{ +public: + uint16_t duration = static_cast(0); + chip::BitMask control = static_cast>(0); + Optional temperatureControl; + Optional averageLoadControl; + Optional dutyCycleControl; + Optional powerSavingsControl; + Optional heatingSourceControl; + + 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 LoadControlEventTransitionStruct +namespace LoadControlEventStruct { +enum class Fields : uint8_t +{ + kEventID = 0, + kProgramID = 1, + kControl = 2, + kDeviceClass = 3, + kEnrollmentGroup = 4, + kCriticality = 5, + kStartTime = 6, + kTransitions = 7, +}; + +struct Type +{ +public: + chip::ByteSpan eventID; + DataModel::Nullable programID; + chip::BitMask control = static_cast>(0); + chip::BitMask deviceClass = static_cast>(0); + Optional enrollmentGroup; + CriticalityLevelEnum criticality = static_cast(0); + DataModel::Nullable startTime; + DataModel::List transitions; + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +struct DecodableType +{ +public: + chip::ByteSpan eventID; + DataModel::Nullable programID; + chip::BitMask control = static_cast>(0); + chip::BitMask deviceClass = static_cast>(0); + Optional enrollmentGroup; + CriticalityLevelEnum criticality = static_cast(0); + DataModel::Nullable startTime; + DataModel::DecodableList transitions; + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; +}; + +} // namespace LoadControlEventStruct +namespace LoadControlProgramStruct { +enum class Fields : uint8_t +{ + kProgramID = 0, + kName = 1, + kEnrollmentGroup = 2, + kRandomStartMinutes = 3, + kRandomDurationMinutes = 4, +}; + +struct Type +{ +public: + chip::ByteSpan programID; + chip::CharSpan name; + DataModel::Nullable enrollmentGroup; + DataModel::Nullable randomStartMinutes; + DataModel::Nullable randomDurationMinutes; + + 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 LoadControlProgramStruct +} // namespace Structs + +namespace Commands { +// Forward-declarations so we can reference these later. + +namespace RegisterLoadControlProgramRequest { +struct Type; +struct DecodableType; +} // namespace RegisterLoadControlProgramRequest + +namespace UnregisterLoadControlProgramRequest { +struct Type; +struct DecodableType; +} // namespace UnregisterLoadControlProgramRequest + +namespace AddLoadControlEventRequest { +struct Type; +struct DecodableType; +} // namespace AddLoadControlEventRequest + +namespace RemoveLoadControlEventRequest { +struct Type; +struct DecodableType; +} // namespace RemoveLoadControlEventRequest + +namespace ClearLoadControlEventsRequest { +struct Type; +struct DecodableType; +} // namespace ClearLoadControlEventsRequest + +} // namespace Commands + +namespace Commands { +namespace RegisterLoadControlProgramRequest { +enum class Fields : uint8_t +{ + kLoadControlProgram = 0, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::RegisterLoadControlProgramRequest::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::DemandResponseLoadControl::Id; } + + Structs::LoadControlProgramStruct::Type loadControlProgram; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; + + using ResponseType = DataModel::NullObjectType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::RegisterLoadControlProgramRequest::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::DemandResponseLoadControl::Id; } + + Structs::LoadControlProgramStruct::DecodableType loadControlProgram; + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace RegisterLoadControlProgramRequest +namespace UnregisterLoadControlProgramRequest { +enum class Fields : uint8_t +{ + kLoadControlProgramID = 0, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::UnregisterLoadControlProgramRequest::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::DemandResponseLoadControl::Id; } + + chip::ByteSpan loadControlProgramID; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; + + using ResponseType = DataModel::NullObjectType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::UnregisterLoadControlProgramRequest::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::DemandResponseLoadControl::Id; } + + chip::ByteSpan loadControlProgramID; + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace UnregisterLoadControlProgramRequest +namespace AddLoadControlEventRequest { +enum class Fields : uint8_t +{ + kEvent = 0, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::AddLoadControlEventRequest::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::DemandResponseLoadControl::Id; } + + Structs::LoadControlEventStruct::Type event; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; + + using ResponseType = DataModel::NullObjectType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::AddLoadControlEventRequest::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::DemandResponseLoadControl::Id; } + + Structs::LoadControlEventStruct::DecodableType event; + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace AddLoadControlEventRequest +namespace RemoveLoadControlEventRequest { +enum class Fields : uint8_t +{ + kEventID = 0, + kCancelControl = 1, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::RemoveLoadControlEventRequest::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::DemandResponseLoadControl::Id; } + + chip::ByteSpan eventID; + chip::BitMask cancelControl = static_cast>(0); + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; + + using ResponseType = DataModel::NullObjectType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::RemoveLoadControlEventRequest::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::DemandResponseLoadControl::Id; } + + chip::ByteSpan eventID; + chip::BitMask cancelControl = static_cast>(0); + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace RemoveLoadControlEventRequest +namespace ClearLoadControlEventsRequest { +enum class Fields : uint8_t +{ +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::ClearLoadControlEventsRequest::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::DemandResponseLoadControl::Id; } + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; + + using ResponseType = DataModel::NullObjectType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::ClearLoadControlEventsRequest::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::DemandResponseLoadControl::Id; } + + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace ClearLoadControlEventsRequest +} // namespace Commands + +namespace Attributes { + +namespace DeviceClass { +struct TypeInfo +{ + using Type = chip::BitMask; + using DecodableType = chip::BitMask; + using DecodableArgType = chip::BitMask; + + static constexpr ClusterId GetClusterId() { return Clusters::DemandResponseLoadControl::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::DeviceClass::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace DeviceClass +namespace LoadControlPrograms { +struct TypeInfo +{ + using Type = + chip::app::DataModel::List; + using DecodableType = chip::app::DataModel::DecodableList< + chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlProgramStruct::DecodableType>; + using DecodableArgType = const chip::app::DataModel::DecodableList< + chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlProgramStruct::DecodableType> &; + + static constexpr ClusterId GetClusterId() { return Clusters::DemandResponseLoadControl::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::LoadControlPrograms::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace LoadControlPrograms +namespace NumberOfLoadControlPrograms { +struct TypeInfo +{ + using Type = uint8_t; + using DecodableType = uint8_t; + using DecodableArgType = uint8_t; + + static constexpr ClusterId GetClusterId() { return Clusters::DemandResponseLoadControl::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::NumberOfLoadControlPrograms::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace NumberOfLoadControlPrograms +namespace Events { +struct TypeInfo +{ + using Type = + chip::app::DataModel::List; + using DecodableType = chip::app::DataModel::DecodableList< + chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlEventStruct::DecodableType>; + using DecodableArgType = const chip::app::DataModel::DecodableList< + chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlEventStruct::DecodableType> &; + + static constexpr ClusterId GetClusterId() { return Clusters::DemandResponseLoadControl::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::Events::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace Events +namespace ActiveEvents { +struct TypeInfo +{ + using Type = + chip::app::DataModel::List; + using DecodableType = chip::app::DataModel::DecodableList< + chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlEventStruct::DecodableType>; + using DecodableArgType = const chip::app::DataModel::DecodableList< + chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlEventStruct::DecodableType> &; + + static constexpr ClusterId GetClusterId() { return Clusters::DemandResponseLoadControl::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::ActiveEvents::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace ActiveEvents +namespace NumberOfEventsPerProgram { +struct TypeInfo +{ + using Type = uint8_t; + using DecodableType = uint8_t; + using DecodableArgType = uint8_t; + + static constexpr ClusterId GetClusterId() { return Clusters::DemandResponseLoadControl::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::NumberOfEventsPerProgram::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace NumberOfEventsPerProgram +namespace NumberOfTransistions { +struct TypeInfo +{ + using Type = uint8_t; + using DecodableType = uint8_t; + using DecodableArgType = uint8_t; + + static constexpr ClusterId GetClusterId() { return Clusters::DemandResponseLoadControl::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::NumberOfTransistions::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace NumberOfTransistions +namespace DefaultRandomStart { +struct TypeInfo +{ + using Type = uint8_t; + using DecodableType = uint8_t; + using DecodableArgType = uint8_t; + + static constexpr ClusterId GetClusterId() { return Clusters::DemandResponseLoadControl::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::DefaultRandomStart::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace DefaultRandomStart +namespace DefaultRandomDuration { +struct TypeInfo +{ + using Type = uint8_t; + using DecodableType = uint8_t; + using DecodableArgType = uint8_t; + + static constexpr ClusterId GetClusterId() { return Clusters::DemandResponseLoadControl::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::DefaultRandomDuration::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace DefaultRandomDuration +namespace GeneratedCommandList { +struct TypeInfo : public Clusters::Globals::Attributes::GeneratedCommandList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::DemandResponseLoadControl::Id; } +}; +} // namespace GeneratedCommandList +namespace AcceptedCommandList { +struct TypeInfo : public Clusters::Globals::Attributes::AcceptedCommandList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::DemandResponseLoadControl::Id; } +}; +} // namespace AcceptedCommandList +namespace EventList { +struct TypeInfo : public Clusters::Globals::Attributes::EventList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::DemandResponseLoadControl::Id; } +}; +} // namespace EventList +namespace AttributeList { +struct TypeInfo : public Clusters::Globals::Attributes::AttributeList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::DemandResponseLoadControl::Id; } +}; +} // namespace AttributeList +namespace FeatureMap { +struct TypeInfo : public Clusters::Globals::Attributes::FeatureMap::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::DemandResponseLoadControl::Id; } +}; +} // namespace FeatureMap +namespace ClusterRevision { +struct TypeInfo : public Clusters::Globals::Attributes::ClusterRevision::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::DemandResponseLoadControl::Id; } +}; +} // namespace ClusterRevision + +struct TypeInfo +{ + struct DecodableType + { + static constexpr ClusterId GetClusterId() { return Clusters::DemandResponseLoadControl::Id; } + + CHIP_ERROR Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path); + + Attributes::DeviceClass::TypeInfo::DecodableType deviceClass = + static_cast>(0); + Attributes::LoadControlPrograms::TypeInfo::DecodableType loadControlPrograms; + Attributes::NumberOfLoadControlPrograms::TypeInfo::DecodableType numberOfLoadControlPrograms = static_cast(0); + Attributes::Events::TypeInfo::DecodableType events; + Attributes::ActiveEvents::TypeInfo::DecodableType activeEvents; + Attributes::NumberOfEventsPerProgram::TypeInfo::DecodableType numberOfEventsPerProgram = static_cast(0); + Attributes::NumberOfTransistions::TypeInfo::DecodableType numberOfTransistions = static_cast(0); + Attributes::DefaultRandomStart::TypeInfo::DecodableType defaultRandomStart = static_cast(0); + Attributes::DefaultRandomDuration::TypeInfo::DecodableType defaultRandomDuration = static_cast(0); + 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 Events { +namespace LoadControlEventStatusChange { +static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; + +enum class Fields : uint8_t +{ + kEventID = 0, + kTransitionIndex = 1, + kStatus = 2, + kCriticality = 3, + kControl = 4, + kTemperatureControl = 5, + kAverageLoadControl = 6, + kDutyCycleControl = 7, + kPowerSavingsControl = 8, + kHeatingSourceControl = 9, +}; + +struct Type +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::LoadControlEventStatusChange::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::DemandResponseLoadControl::Id; } + static constexpr bool kIsFabricScoped = false; + + chip::ByteSpan eventID; + DataModel::Nullable transitionIndex; + LoadControlEventStatusEnum status = static_cast(0); + CriticalityLevelEnum criticality = static_cast(0); + chip::BitMask control = static_cast>(0); + Optional> temperatureControl; + Optional> averageLoadControl; + Optional> dutyCycleControl; + Optional> powerSavingsControl; + Optional> heatingSourceControl; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +struct DecodableType +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::LoadControlEventStatusChange::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::DemandResponseLoadControl::Id; } + + chip::ByteSpan eventID; + DataModel::Nullable transitionIndex; + LoadControlEventStatusEnum status = static_cast(0); + CriticalityLevelEnum criticality = static_cast(0); + chip::BitMask control = static_cast>(0); + Optional> temperatureControl; + Optional> averageLoadControl; + Optional> dutyCycleControl; + Optional> powerSavingsControl; + Optional> heatingSourceControl; + + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +} // namespace LoadControlEventStatusChange +} // namespace Events +} // namespace DemandResponseLoadControl namespace DoorLock { namespace Structs { namespace CredentialStruct { 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 6fb42dca77f0d8..36323d8644bac2 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 @@ -3367,6 +3367,72 @@ static constexpr AttributeId Id = Globals::Attributes::ClusterRevision::Id; } // namespace Attributes } // namespace ActivatedCarbonFilterMonitoring +namespace DemandResponseLoadControl { +namespace Attributes { + +namespace DeviceClass { +static constexpr AttributeId Id = 0x00000000; +} // namespace DeviceClass + +namespace LoadControlPrograms { +static constexpr AttributeId Id = 0x00000001; +} // namespace LoadControlPrograms + +namespace NumberOfLoadControlPrograms { +static constexpr AttributeId Id = 0x00000002; +} // namespace NumberOfLoadControlPrograms + +namespace Events { +static constexpr AttributeId Id = 0x00000003; +} // namespace Events + +namespace ActiveEvents { +static constexpr AttributeId Id = 0x00000004; +} // namespace ActiveEvents + +namespace NumberOfEventsPerProgram { +static constexpr AttributeId Id = 0x00000005; +} // namespace NumberOfEventsPerProgram + +namespace NumberOfTransistions { +static constexpr AttributeId Id = 0x00000006; +} // namespace NumberOfTransistions + +namespace DefaultRandomStart { +static constexpr AttributeId Id = 0x00000007; +} // namespace DefaultRandomStart + +namespace DefaultRandomDuration { +static constexpr AttributeId Id = 0x00000008; +} // namespace DefaultRandomDuration + +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 DemandResponseLoadControl + namespace DoorLock { 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 9609fd6ce8f2eb..c5ec35da15c8b3 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 @@ -205,6 +205,9 @@ static constexpr ClusterId Id = 0x00000071; namespace ActivatedCarbonFilterMonitoring { static constexpr ClusterId Id = 0x00000072; } // namespace ActivatedCarbonFilterMonitoring +namespace DemandResponseLoadControl { +static constexpr ClusterId Id = 0x00000096; +} // namespace DemandResponseLoadControl namespace DoorLock { static constexpr ClusterId Id = 0x00000101; } // namespace DoorLock diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h b/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h index cbd8b87e696dde..97129ac5f2168b 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h @@ -869,6 +869,32 @@ static constexpr CommandId Id = 0x00000000; } // namespace Commands } // namespace ActivatedCarbonFilterMonitoring +namespace DemandResponseLoadControl { +namespace Commands { + +namespace RegisterLoadControlProgramRequest { +static constexpr CommandId Id = 0x00000000; +} // namespace RegisterLoadControlProgramRequest + +namespace UnregisterLoadControlProgramRequest { +static constexpr CommandId Id = 0x00000001; +} // namespace UnregisterLoadControlProgramRequest + +namespace AddLoadControlEventRequest { +static constexpr CommandId Id = 0x00000002; +} // namespace AddLoadControlEventRequest + +namespace RemoveLoadControlEventRequest { +static constexpr CommandId Id = 0x00000003; +} // namespace RemoveLoadControlEventRequest + +namespace ClearLoadControlEventsRequest { +static constexpr CommandId Id = 0x00000004; +} // namespace ClearLoadControlEventsRequest + +} // namespace Commands +} // namespace DemandResponseLoadControl + namespace DoorLock { namespace Commands { diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Events.h b/zzz_generated/app-common/app-common/zap-generated/ids/Events.h index 4f8f77d84168e8..d77938228e2f27 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Events.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Events.h @@ -365,6 +365,16 @@ static constexpr EventId Id = 0x00000001; } // namespace Events } // namespace RvcOperationalState +namespace DemandResponseLoadControl { +namespace Events { + +namespace LoadControlEventStatusChange { +static constexpr EventId Id = 0x00000000; +} // namespace LoadControlEventStatusChange + +} // namespace Events +} // namespace DemandResponseLoadControl + namespace DoorLock { namespace Events { diff --git a/zzz_generated/app-common/app-common/zap-generated/print-cluster.h b/zzz_generated/app-common/app-common/zap-generated/print-cluster.h index 3a5488feeb59e1..2827dd0736a05c 100644 --- a/zzz_generated/app-common/app-common/zap-generated/print-cluster.h +++ b/zzz_generated/app-common/app-common/zap-generated/print-cluster.h @@ -408,6 +408,13 @@ #define CHIP_PRINTCLUSTER_ACTIVATED_CARBON_FILTER_MONITORING_CLUSTER #endif +#if defined(ZCL_USING_DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER_SERVER) || defined(ZCL_USING_DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER \ + { chip::app::Clusters::DemandResponseLoadControl::Id, "Demand Response Load Control" }, +#else +#define CHIP_PRINTCLUSTER_DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER +#endif + #if defined(ZCL_USING_DOOR_LOCK_CLUSTER_SERVER) || defined(ZCL_USING_DOOR_LOCK_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_DOOR_LOCK_CLUSTER { chip::app::Clusters::DoorLock::Id, "Door Lock" }, #else @@ -745,6 +752,7 @@ CHIP_PRINTCLUSTER_OPERATIONAL_STATE_RVC_CLUSTER \ CHIP_PRINTCLUSTER_HEPA_FILTER_MONITORING_CLUSTER \ CHIP_PRINTCLUSTER_ACTIVATED_CARBON_FILTER_MONITORING_CLUSTER \ + CHIP_PRINTCLUSTER_DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER \ CHIP_PRINTCLUSTER_DOOR_LOCK_CLUSTER \ CHIP_PRINTCLUSTER_WINDOW_COVERING_CLUSTER \ CHIP_PRINTCLUSTER_BARRIER_CONTROL_CLUSTER \ diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index ef4afce4ff05c6..da69f3cb8a364f 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -94,6 +94,7 @@ | RvcOperationalState | 0x0061 | | HepaFilterMonitoring | 0x0071 | | ActivatedCarbonFilterMonitoring | 0x0072 | +| DemandResponseLoadControl | 0x0096 | | DoorLock | 0x0101 | | WindowCovering | 0x0102 | | BarrierControl | 0x0103 | @@ -6109,6 +6110,241 @@ class ActivatedCarbonFilterMonitoringResetCondition : public ClusterCommand chip::app::Clusters::ActivatedCarbonFilterMonitoring::Commands::ResetCondition::Type mRequest; }; +/*----------------------------------------------------------------------------*\ +| Cluster DemandResponseLoadControl | 0x0096 | +|------------------------------------------------------------------------------| +| Commands: | | +| * RegisterLoadControlProgramRequest | 0x00 | +| * UnregisterLoadControlProgramRequest | 0x01 | +| * AddLoadControlEventRequest | 0x02 | +| * RemoveLoadControlEventRequest | 0x03 | +| * ClearLoadControlEventsRequest | 0x04 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * DeviceClass | 0x0000 | +| * LoadControlPrograms | 0x0001 | +| * NumberOfLoadControlPrograms | 0x0002 | +| * Events | 0x0003 | +| * ActiveEvents | 0x0004 | +| * NumberOfEventsPerProgram | 0x0005 | +| * NumberOfTransistions | 0x0006 | +| * DefaultRandomStart | 0x0007 | +| * DefaultRandomDuration | 0x0008 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * EventList | 0xFFFA | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +| * LoadControlEventStatusChange | 0x0000 | +\*----------------------------------------------------------------------------*/ + +/* + * Command RegisterLoadControlProgramRequest + */ +class DemandResponseLoadControlRegisterLoadControlProgramRequest : public ClusterCommand +{ +public: + DemandResponseLoadControlRegisterLoadControlProgramRequest(CredentialIssuerCommands * credsIssuerConfig) : + ClusterCommand("register-load-control-program-request", credsIssuerConfig), + mComplex_LoadControlProgram(&mRequest.loadControlProgram) + { + AddArgument("LoadControlProgram", &mComplex_LoadControlProgram); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::CommandId commandId = + chip::app::Clusters::DemandResponseLoadControl::Commands::RegisterLoadControlProgramRequest::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, + commandId, endpointIds.at(0)); + return ClusterCommand::SendCommand(device, endpointIds.at(0), clusterId, commandId, mRequest); + } + + CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::CommandId commandId = + chip::app::Clusters::DemandResponseLoadControl::Commands::RegisterLoadControlProgramRequest::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on Group %u", clusterId, commandId, + groupId); + + return ClusterCommand::SendGroupCommand(groupId, fabricIndex, clusterId, commandId, mRequest); + } + +private: + chip::app::Clusters::DemandResponseLoadControl::Commands::RegisterLoadControlProgramRequest::Type mRequest; + TypedComplexArgument + mComplex_LoadControlProgram; +}; + +/* + * Command UnregisterLoadControlProgramRequest + */ +class DemandResponseLoadControlUnregisterLoadControlProgramRequest : public ClusterCommand +{ +public: + DemandResponseLoadControlUnregisterLoadControlProgramRequest(CredentialIssuerCommands * credsIssuerConfig) : + ClusterCommand("unregister-load-control-program-request", credsIssuerConfig) + { + AddArgument("LoadControlProgramID", &mRequest.loadControlProgramID); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::CommandId commandId = + chip::app::Clusters::DemandResponseLoadControl::Commands::UnregisterLoadControlProgramRequest::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, + commandId, endpointIds.at(0)); + return ClusterCommand::SendCommand(device, endpointIds.at(0), clusterId, commandId, mRequest); + } + + CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::CommandId commandId = + chip::app::Clusters::DemandResponseLoadControl::Commands::UnregisterLoadControlProgramRequest::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on Group %u", clusterId, commandId, + groupId); + + return ClusterCommand::SendGroupCommand(groupId, fabricIndex, clusterId, commandId, mRequest); + } + +private: + chip::app::Clusters::DemandResponseLoadControl::Commands::UnregisterLoadControlProgramRequest::Type mRequest; +}; + +/* + * Command AddLoadControlEventRequest + */ +class DemandResponseLoadControlAddLoadControlEventRequest : public ClusterCommand +{ +public: + DemandResponseLoadControlAddLoadControlEventRequest(CredentialIssuerCommands * credsIssuerConfig) : + ClusterCommand("add-load-control-event-request", credsIssuerConfig), mComplex_Event(&mRequest.event) + { + AddArgument("Event", &mComplex_Event); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::CommandId commandId = + chip::app::Clusters::DemandResponseLoadControl::Commands::AddLoadControlEventRequest::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, + commandId, endpointIds.at(0)); + return ClusterCommand::SendCommand(device, endpointIds.at(0), clusterId, commandId, mRequest); + } + + CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::CommandId commandId = + chip::app::Clusters::DemandResponseLoadControl::Commands::AddLoadControlEventRequest::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on Group %u", clusterId, commandId, + groupId); + + return ClusterCommand::SendGroupCommand(groupId, fabricIndex, clusterId, commandId, mRequest); + } + +private: + chip::app::Clusters::DemandResponseLoadControl::Commands::AddLoadControlEventRequest::Type mRequest; + TypedComplexArgument mComplex_Event; +}; + +/* + * Command RemoveLoadControlEventRequest + */ +class DemandResponseLoadControlRemoveLoadControlEventRequest : public ClusterCommand +{ +public: + DemandResponseLoadControlRemoveLoadControlEventRequest(CredentialIssuerCommands * credsIssuerConfig) : + ClusterCommand("remove-load-control-event-request", credsIssuerConfig) + { + AddArgument("EventID", &mRequest.eventID); + AddArgument("CancelControl", 0, UINT16_MAX, &mRequest.cancelControl); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::CommandId commandId = + chip::app::Clusters::DemandResponseLoadControl::Commands::RemoveLoadControlEventRequest::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, + commandId, endpointIds.at(0)); + return ClusterCommand::SendCommand(device, endpointIds.at(0), clusterId, commandId, mRequest); + } + + CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::CommandId commandId = + chip::app::Clusters::DemandResponseLoadControl::Commands::RemoveLoadControlEventRequest::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on Group %u", clusterId, commandId, + groupId); + + return ClusterCommand::SendGroupCommand(groupId, fabricIndex, clusterId, commandId, mRequest); + } + +private: + chip::app::Clusters::DemandResponseLoadControl::Commands::RemoveLoadControlEventRequest::Type mRequest; +}; + +/* + * Command ClearLoadControlEventsRequest + */ +class DemandResponseLoadControlClearLoadControlEventsRequest : public ClusterCommand +{ +public: + DemandResponseLoadControlClearLoadControlEventsRequest(CredentialIssuerCommands * credsIssuerConfig) : + ClusterCommand("clear-load-control-events-request", credsIssuerConfig) + { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::CommandId commandId = + chip::app::Clusters::DemandResponseLoadControl::Commands::ClearLoadControlEventsRequest::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, + commandId, endpointIds.at(0)); + return ClusterCommand::SendCommand(device, endpointIds.at(0), clusterId, commandId, mRequest); + } + + CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::CommandId commandId = + chip::app::Clusters::DemandResponseLoadControl::Commands::ClearLoadControlEventsRequest::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on Group %u", clusterId, commandId, + groupId); + + return ClusterCommand::SendGroupCommand(groupId, fabricIndex, clusterId, commandId, mRequest); + } + +private: + chip::app::Clusters::DemandResponseLoadControl::Commands::ClearLoadControlEventsRequest::Type mRequest; +}; + /*----------------------------------------------------------------------------*\ | Cluster DoorLock | 0x0101 | |------------------------------------------------------------------------------| @@ -16858,6 +17094,111 @@ void registerClusterActivatedCarbonFilterMonitoring(Commands & commands, Credent commands.RegisterCluster(clusterName, clusterCommands); } +void registerClusterDemandResponseLoadControl(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) +{ + using namespace chip::app::Clusters::DemandResponseLoadControl; + + const char * clusterName = "DemandResponseLoadControl"; + + commands_list clusterCommands = { + // + // Commands + // + make_unique(Id, credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // + // + // Attributes + // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "device-class", Attributes::DeviceClass::Id, credsIssuerConfig), // + make_unique(Id, "load-control-programs", Attributes::LoadControlPrograms::Id, credsIssuerConfig), // + make_unique(Id, "number-of-load-control-programs", Attributes::NumberOfLoadControlPrograms::Id, + credsIssuerConfig), // + make_unique(Id, "events", Attributes::Events::Id, credsIssuerConfig), // + make_unique(Id, "active-events", Attributes::ActiveEvents::Id, credsIssuerConfig), // + make_unique(Id, "number-of-events-per-program", Attributes::NumberOfEventsPerProgram::Id, + credsIssuerConfig), // + make_unique(Id, "number-of-transistions", Attributes::NumberOfTransistions::Id, credsIssuerConfig), // + make_unique(Id, "default-random-start", Attributes::DefaultRandomStart::Id, credsIssuerConfig), // + make_unique(Id, "default-random-duration", Attributes::DefaultRandomDuration::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, "device-class", 0, UINT32_MAX, Attributes::DeviceClass::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "load-control-programs", Attributes::LoadControlPrograms::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "number-of-load-control-programs", 0, UINT8_MAX, + Attributes::NumberOfLoadControlPrograms::Id, WriteCommandType::kForceWrite, + credsIssuerConfig), // + make_unique>>( + Id, "events", Attributes::Events::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "active-events", Attributes::ActiveEvents::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "number-of-events-per-program", 0, UINT8_MAX, + Attributes::NumberOfEventsPerProgram::Id, WriteCommandType::kForceWrite, + credsIssuerConfig), // + make_unique>(Id, "number-of-transistions", 0, UINT8_MAX, Attributes::NumberOfTransistions::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "default-random-start", 0, UINT8_MAX, Attributes::DefaultRandomStart::Id, + WriteCommandType::kWrite, credsIssuerConfig), // + make_unique>(Id, "default-random-duration", 0, UINT8_MAX, Attributes::DefaultRandomDuration::Id, + WriteCommandType::kWrite, 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, "device-class", Attributes::DeviceClass::Id, credsIssuerConfig), // + make_unique(Id, "load-control-programs", Attributes::LoadControlPrograms::Id, credsIssuerConfig), // + make_unique(Id, "number-of-load-control-programs", Attributes::NumberOfLoadControlPrograms::Id, + credsIssuerConfig), // + make_unique(Id, "events", Attributes::Events::Id, credsIssuerConfig), // + make_unique(Id, "active-events", Attributes::ActiveEvents::Id, credsIssuerConfig), // + make_unique(Id, "number-of-events-per-program", Attributes::NumberOfEventsPerProgram::Id, + credsIssuerConfig), // + make_unique(Id, "number-of-transistions", Attributes::NumberOfTransistions::Id, credsIssuerConfig), // + make_unique(Id, "default-random-start", Attributes::DefaultRandomStart::Id, credsIssuerConfig), // + make_unique(Id, "default-random-duration", Attributes::DefaultRandomDuration::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, "load-control-event-status-change", Events::LoadControlEventStatusChange::Id, + credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "load-control-event-status-change", Events::LoadControlEventStatusChange::Id, + credsIssuerConfig), // + }; + + commands.RegisterCluster(clusterName, clusterCommands); +} void registerClusterDoorLock(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { using namespace chip::app::Clusters::DoorLock; @@ -22201,6 +22542,7 @@ void registerClusters(Commands & commands, CredentialIssuerCommands * credsIssue registerClusterRvcOperationalState(commands, credsIssuerConfig); registerClusterHepaFilterMonitoring(commands, credsIssuerConfig); registerClusterActivatedCarbonFilterMonitoring(commands, credsIssuerConfig); + registerClusterDemandResponseLoadControl(commands, credsIssuerConfig); registerClusterDoorLock(commands, credsIssuerConfig); registerClusterWindowCovering(commands, credsIssuerConfig); registerClusterBarrierControl(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 151aaec3aa8b17..0d3781a511ce02 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -2161,6 +2161,377 @@ void ComplexArgumentParser::Finalize( ComplexArgumentParser::Finalize(request.productIdentifierValue); } +CHIP_ERROR +ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::DemandResponseLoadControl::Structs::HeatingSourceControlStruct::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("HeatingSourceControlStruct.heatingSource", "heatingSource", + value.isMember("heatingSource"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "heatingSource"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.heatingSource, value["heatingSource"])); + valueCopy.removeMember("heatingSource"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize( + chip::app::Clusters::DemandResponseLoadControl::Structs::HeatingSourceControlStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.heatingSource); +} + +CHIP_ERROR +ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::DemandResponseLoadControl::Structs::PowerSavingsControlStruct::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("PowerSavingsControlStruct.powerSavings", "powerSavings", + value.isMember("powerSavings"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "powerSavings"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.powerSavings, value["powerSavings"])); + valueCopy.removeMember("powerSavings"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize( + chip::app::Clusters::DemandResponseLoadControl::Structs::PowerSavingsControlStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.powerSavings); +} + +CHIP_ERROR +ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::DemandResponseLoadControl::Structs::DutyCycleControlStruct::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("DutyCycleControlStruct.dutyCycle", "dutyCycle", value.isMember("dutyCycle"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "dutyCycle"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.dutyCycle, value["dutyCycle"])); + valueCopy.removeMember("dutyCycle"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize( + chip::app::Clusters::DemandResponseLoadControl::Structs::DutyCycleControlStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.dutyCycle); +} + +CHIP_ERROR +ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::DemandResponseLoadControl::Structs::AverageLoadControlStruct::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("AverageLoadControlStruct.loadAdjustment", "loadAdjustment", + value.isMember("loadAdjustment"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "loadAdjustment"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.loadAdjustment, value["loadAdjustment"])); + valueCopy.removeMember("loadAdjustment"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize( + chip::app::Clusters::DemandResponseLoadControl::Structs::AverageLoadControlStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.loadAdjustment); +} + +CHIP_ERROR +ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::DemandResponseLoadControl::Structs::TemperatureControlStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + char labelWithMember[kMaxLabelLength]; + if (value.isMember("coolingTempOffset")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "coolingTempOffset"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.coolingTempOffset, value["coolingTempOffset"])); + } + valueCopy.removeMember("coolingTempOffset"); + + if (value.isMember("heatingtTempOffset")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "heatingtTempOffset"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.heatingtTempOffset, value["heatingtTempOffset"])); + } + valueCopy.removeMember("heatingtTempOffset"); + + if (value.isMember("coolingTempSetpoint")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "coolingTempSetpoint"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.coolingTempSetpoint, value["coolingTempSetpoint"])); + } + valueCopy.removeMember("coolingTempSetpoint"); + + if (value.isMember("heatingTempSetpoint")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "heatingTempSetpoint"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.heatingTempSetpoint, value["heatingTempSetpoint"])); + } + valueCopy.removeMember("heatingTempSetpoint"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize( + chip::app::Clusters::DemandResponseLoadControl::Structs::TemperatureControlStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.coolingTempOffset); + ComplexArgumentParser::Finalize(request.heatingtTempOffset); + ComplexArgumentParser::Finalize(request.coolingTempSetpoint); + ComplexArgumentParser::Finalize(request.heatingTempSetpoint); +} + +CHIP_ERROR ComplexArgumentParser::Setup( + const char * label, chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlEventTransitionStruct::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("LoadControlEventTransitionStruct.duration", "duration", + value.isMember("duration"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("LoadControlEventTransitionStruct.control", "control", value.isMember("control"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "duration"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.duration, value["duration"])); + valueCopy.removeMember("duration"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "control"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.control, value["control"])); + valueCopy.removeMember("control"); + + if (value.isMember("temperatureControl")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "temperatureControl"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.temperatureControl, value["temperatureControl"])); + } + valueCopy.removeMember("temperatureControl"); + + if (value.isMember("averageLoadControl")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "averageLoadControl"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.averageLoadControl, value["averageLoadControl"])); + } + valueCopy.removeMember("averageLoadControl"); + + if (value.isMember("dutyCycleControl")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "dutyCycleControl"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.dutyCycleControl, value["dutyCycleControl"])); + } + valueCopy.removeMember("dutyCycleControl"); + + if (value.isMember("powerSavingsControl")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "powerSavingsControl"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.powerSavingsControl, value["powerSavingsControl"])); + } + valueCopy.removeMember("powerSavingsControl"); + + if (value.isMember("heatingSourceControl")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "heatingSourceControl"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.heatingSourceControl, value["heatingSourceControl"])); + } + valueCopy.removeMember("heatingSourceControl"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize( + chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlEventTransitionStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.duration); + ComplexArgumentParser::Finalize(request.control); + ComplexArgumentParser::Finalize(request.temperatureControl); + ComplexArgumentParser::Finalize(request.averageLoadControl); + ComplexArgumentParser::Finalize(request.dutyCycleControl); + ComplexArgumentParser::Finalize(request.powerSavingsControl); + ComplexArgumentParser::Finalize(request.heatingSourceControl); +} + +CHIP_ERROR +ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlEventStruct::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("LoadControlEventStruct.eventID", "eventID", value.isMember("eventID"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("LoadControlEventStruct.programID", "programID", value.isMember("programID"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("LoadControlEventStruct.control", "control", value.isMember("control"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("LoadControlEventStruct.deviceClass", "deviceClass", + value.isMember("deviceClass"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("LoadControlEventStruct.criticality", "criticality", + value.isMember("criticality"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("LoadControlEventStruct.startTime", "startTime", value.isMember("startTime"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("LoadControlEventStruct.transitions", "transitions", + value.isMember("transitions"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "eventID"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.eventID, value["eventID"])); + valueCopy.removeMember("eventID"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "programID"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.programID, value["programID"])); + valueCopy.removeMember("programID"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "control"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.control, value["control"])); + valueCopy.removeMember("control"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "deviceClass"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.deviceClass, value["deviceClass"])); + valueCopy.removeMember("deviceClass"); + + if (value.isMember("enrollmentGroup")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "enrollmentGroup"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.enrollmentGroup, value["enrollmentGroup"])); + } + valueCopy.removeMember("enrollmentGroup"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "criticality"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.criticality, value["criticality"])); + valueCopy.removeMember("criticality"); + + 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, "transitions"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.transitions, value["transitions"])); + valueCopy.removeMember("transitions"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize( + chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlEventStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.eventID); + ComplexArgumentParser::Finalize(request.programID); + ComplexArgumentParser::Finalize(request.control); + ComplexArgumentParser::Finalize(request.deviceClass); + ComplexArgumentParser::Finalize(request.enrollmentGroup); + ComplexArgumentParser::Finalize(request.criticality); + ComplexArgumentParser::Finalize(request.startTime); + ComplexArgumentParser::Finalize(request.transitions); +} + +CHIP_ERROR +ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlProgramStruct::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("LoadControlProgramStruct.programID", "programID", value.isMember("programID"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("LoadControlProgramStruct.name", "name", value.isMember("name"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("LoadControlProgramStruct.enrollmentGroup", "enrollmentGroup", + value.isMember("enrollmentGroup"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("LoadControlProgramStruct.randomStartMinutes", + "randomStartMinutes", value.isMember("randomStartMinutes"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist( + "LoadControlProgramStruct.randomDurationMinutes", "randomDurationMinutes", value.isMember("randomDurationMinutes"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "programID"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.programID, value["programID"])); + valueCopy.removeMember("programID"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "name"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.name, value["name"])); + valueCopy.removeMember("name"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "enrollmentGroup"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.enrollmentGroup, value["enrollmentGroup"])); + valueCopy.removeMember("enrollmentGroup"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "randomStartMinutes"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.randomStartMinutes, value["randomStartMinutes"])); + valueCopy.removeMember("randomStartMinutes"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "randomDurationMinutes"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.randomDurationMinutes, value["randomDurationMinutes"])); + valueCopy.removeMember("randomDurationMinutes"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize( + chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlProgramStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.programID); + ComplexArgumentParser::Finalize(request.name); + ComplexArgumentParser::Finalize(request.enrollmentGroup); + ComplexArgumentParser::Finalize(request.randomStartMinutes); + ComplexArgumentParser::Finalize(request.randomDurationMinutes); +} + CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::DoorLock::Structs::CredentialStruct::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 6a9f327de7492c..6cad8c0944afba 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h @@ -271,6 +271,54 @@ static CHIP_ERROR Setup(const char * label, static void Finalize(chip::app::Clusters::ActivatedCarbonFilterMonitoring::Structs::ReplacementProductStruct::Type & request); +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::DemandResponseLoadControl::Structs::HeatingSourceControlStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::DemandResponseLoadControl::Structs::HeatingSourceControlStruct::Type & request); + +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::DemandResponseLoadControl::Structs::PowerSavingsControlStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::DemandResponseLoadControl::Structs::PowerSavingsControlStruct::Type & request); + +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::DemandResponseLoadControl::Structs::DutyCycleControlStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::DemandResponseLoadControl::Structs::DutyCycleControlStruct::Type & request); + +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::DemandResponseLoadControl::Structs::AverageLoadControlStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::DemandResponseLoadControl::Structs::AverageLoadControlStruct::Type & request); + +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::DemandResponseLoadControl::Structs::TemperatureControlStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::DemandResponseLoadControl::Structs::TemperatureControlStruct::Type & request); + +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlEventTransitionStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlEventTransitionStruct::Type & request); + +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlEventStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlEventStruct::Type & request); + +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlProgramStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlProgramStruct::Type & request); + static CHIP_ERROR Setup(const char * label, chip::app::Clusters::DoorLock::Structs::CredentialStruct::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 0b3b0ab49f352c..ad5b6c9eefc4b9 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -1928,6 +1928,310 @@ CHIP_ERROR DataModelLogger::LogValue( return CHIP_NO_ERROR; } +CHIP_ERROR DataModelLogger::LogValue( + const char * label, size_t indent, + const chip::app::Clusters::DemandResponseLoadControl::Structs::HeatingSourceControlStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("HeatingSource", indent + 1, value.heatingSource); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'HeatingSource'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DataModelLogger::LogValue( + const char * label, size_t indent, + const chip::app::Clusters::DemandResponseLoadControl::Structs::PowerSavingsControlStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("PowerSavings", indent + 1, value.powerSavings); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'PowerSavings'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DataModelLogger::LogValue( + const char * label, size_t indent, + const chip::app::Clusters::DemandResponseLoadControl::Structs::DutyCycleControlStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("DutyCycle", indent + 1, value.dutyCycle); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'DutyCycle'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DataModelLogger::LogValue( + const char * label, size_t indent, + const chip::app::Clusters::DemandResponseLoadControl::Structs::AverageLoadControlStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("LoadAdjustment", indent + 1, value.loadAdjustment); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'LoadAdjustment'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DataModelLogger::LogValue( + const char * label, size_t indent, + const chip::app::Clusters::DemandResponseLoadControl::Structs::TemperatureControlStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("CoolingTempOffset", indent + 1, value.coolingTempOffset); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'CoolingTempOffset'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("HeatingtTempOffset", indent + 1, value.heatingtTempOffset); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'HeatingtTempOffset'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("CoolingTempSetpoint", indent + 1, value.coolingTempSetpoint); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'CoolingTempSetpoint'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("HeatingTempSetpoint", indent + 1, value.heatingTempSetpoint); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'HeatingTempSetpoint'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DataModelLogger::LogValue( + const char * label, size_t indent, + const chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlEventTransitionStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("Duration", indent + 1, value.duration); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Duration'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Control", indent + 1, value.control); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Control'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("TemperatureControl", indent + 1, value.temperatureControl); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'TemperatureControl'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("AverageLoadControl", indent + 1, value.averageLoadControl); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'AverageLoadControl'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("DutyCycleControl", indent + 1, value.dutyCycleControl); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'DutyCycleControl'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("PowerSavingsControl", indent + 1, value.powerSavingsControl); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'PowerSavingsControl'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("HeatingSourceControl", indent + 1, value.heatingSourceControl); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'HeatingSourceControl'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DataModelLogger::LogValue( + const char * label, size_t indent, + const chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlEventStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("EventID", indent + 1, value.eventID); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'EventID'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("ProgramID", indent + 1, value.programID); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ProgramID'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Control", indent + 1, value.control); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Control'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("DeviceClass", indent + 1, value.deviceClass); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'DeviceClass'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("EnrollmentGroup", indent + 1, value.enrollmentGroup); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'EnrollmentGroup'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Criticality", indent + 1, value.criticality); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Criticality'"); + 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("Transitions", indent + 1, value.transitions); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Transitions'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DataModelLogger::LogValue( + const char * label, size_t indent, + const chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlProgramStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("ProgramID", indent + 1, value.programID); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ProgramID'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Name", indent + 1, value.name); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Name'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("EnrollmentGroup", indent + 1, value.enrollmentGroup); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'EnrollmentGroup'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("RandomStartMinutes", indent + 1, value.randomStartMinutes); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'RandomStartMinutes'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("RandomDurationMinutes", indent + 1, value.randomDurationMinutes); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'RandomDurationMinutes'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::DoorLock::Structs::CredentialStruct::DecodableType & value) { @@ -3991,6 +4295,94 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const DemandResponseLoadControl::Events::LoadControlEventStatusChange::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = DataModelLogger::LogValue("EventID", indent + 1, value.eventID); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'EventID'"); + return err; + } + } + { + CHIP_ERROR err = DataModelLogger::LogValue("TransitionIndex", indent + 1, value.transitionIndex); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'TransitionIndex'"); + return err; + } + } + { + CHIP_ERROR err = DataModelLogger::LogValue("Status", indent + 1, value.status); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'Status'"); + return err; + } + } + { + CHIP_ERROR err = DataModelLogger::LogValue("Criticality", indent + 1, value.criticality); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'Criticality'"); + return err; + } + } + { + CHIP_ERROR err = DataModelLogger::LogValue("Control", indent + 1, value.control); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'Control'"); + return err; + } + } + { + CHIP_ERROR err = DataModelLogger::LogValue("TemperatureControl", indent + 1, value.temperatureControl); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'TemperatureControl'"); + return err; + } + } + { + CHIP_ERROR err = DataModelLogger::LogValue("AverageLoadControl", indent + 1, value.averageLoadControl); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'AverageLoadControl'"); + return err; + } + } + { + CHIP_ERROR err = DataModelLogger::LogValue("DutyCycleControl", indent + 1, value.dutyCycleControl); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'DutyCycleControl'"); + return err; + } + } + { + CHIP_ERROR err = DataModelLogger::LogValue("PowerSavingsControl", indent + 1, value.powerSavingsControl); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'PowerSavingsControl'"); + return err; + } + } + { + CHIP_ERROR err = DataModelLogger::LogValue("HeatingSourceControl", indent + 1, value.heatingSourceControl); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'HeatingSourceControl'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const DoorLock::Events::DoorLockAlarm::DecodableType & value) { @@ -9214,6 +9606,93 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP } break; } + case DemandResponseLoadControl::Id: { + switch (path.mAttributeId) + { + case DemandResponseLoadControl::Attributes::DeviceClass::Id: { + chip::BitMask value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("DeviceClass", 1, value); + } + case DemandResponseLoadControl::Attributes::LoadControlPrograms::Id: { + chip::app::DataModel::DecodableList< + chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlProgramStruct::DecodableType> + value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("LoadControlPrograms", 1, value); + } + case DemandResponseLoadControl::Attributes::NumberOfLoadControlPrograms::Id: { + uint8_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("NumberOfLoadControlPrograms", 1, value); + } + case DemandResponseLoadControl::Attributes::Events::Id: { + chip::app::DataModel::DecodableList< + chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlEventStruct::DecodableType> + value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("Events", 1, value); + } + case DemandResponseLoadControl::Attributes::ActiveEvents::Id: { + chip::app::DataModel::DecodableList< + chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlEventStruct::DecodableType> + value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ActiveEvents", 1, value); + } + case DemandResponseLoadControl::Attributes::NumberOfEventsPerProgram::Id: { + uint8_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("NumberOfEventsPerProgram", 1, value); + } + case DemandResponseLoadControl::Attributes::NumberOfTransistions::Id: { + uint8_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("NumberOfTransistions", 1, value); + } + case DemandResponseLoadControl::Attributes::DefaultRandomStart::Id: { + uint8_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("DefaultRandomStart", 1, value); + } + case DemandResponseLoadControl::Attributes::DefaultRandomDuration::Id: { + uint8_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("DefaultRandomDuration", 1, value); + } + case DemandResponseLoadControl::Attributes::GeneratedCommandList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + } + case DemandResponseLoadControl::Attributes::AcceptedCommandList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + } + case DemandResponseLoadControl::Attributes::EventList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("EventList", 1, value); + } + case DemandResponseLoadControl::Attributes::AttributeList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("AttributeList", 1, value); + } + case DemandResponseLoadControl::Attributes::FeatureMap::Id: { + uint32_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("FeatureMap", 1, value); + } + case DemandResponseLoadControl::Attributes::ClusterRevision::Id: { + uint16_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ClusterRevision", 1, value); + } + } + break; + } case DoorLock::Id: { switch (path.mAttributeId) { @@ -14713,6 +15192,17 @@ CHIP_ERROR DataModelLogger::LogEvent(const chip::app::EventHeader & header, chip } break; } + case DemandResponseLoadControl::Id: { + switch (header.mPath.mEventId) + { + case DemandResponseLoadControl::Events::LoadControlEventStatusChange::Id: { + chip::app::Clusters::DemandResponseLoadControl::Events::LoadControlEventStatusChange::DecodableType value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("LoadControlEventStatusChange", 1, value); + } + } + break; + } case DoorLock::Id: { switch (header.mPath.mEventId) { 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 20ea4c575eb701..fd07c7d7689334 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h @@ -170,6 +170,38 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::ActivatedCarbonFilterMonitoring::Structs::ReplacementProductStruct::DecodableType & value); +static CHIP_ERROR +LogValue(const char * label, size_t indent, + const chip::app::Clusters::DemandResponseLoadControl::Structs::HeatingSourceControlStruct::DecodableType & value); + +static CHIP_ERROR +LogValue(const char * label, size_t indent, + const chip::app::Clusters::DemandResponseLoadControl::Structs::PowerSavingsControlStruct::DecodableType & value); + +static CHIP_ERROR +LogValue(const char * label, size_t indent, + const chip::app::Clusters::DemandResponseLoadControl::Structs::DutyCycleControlStruct::DecodableType & value); + +static CHIP_ERROR +LogValue(const char * label, size_t indent, + const chip::app::Clusters::DemandResponseLoadControl::Structs::AverageLoadControlStruct::DecodableType & value); + +static CHIP_ERROR +LogValue(const char * label, size_t indent, + const chip::app::Clusters::DemandResponseLoadControl::Structs::TemperatureControlStruct::DecodableType & value); + +static CHIP_ERROR +LogValue(const char * label, size_t indent, + const chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlEventTransitionStruct::DecodableType & value); + +static CHIP_ERROR +LogValue(const char * label, size_t indent, + const chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlEventStruct::DecodableType & value); + +static CHIP_ERROR +LogValue(const char * label, size_t indent, + const chip::app::Clusters::DemandResponseLoadControl::Structs::LoadControlProgramStruct::DecodableType & value); + static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::DoorLock::Structs::CredentialStruct::DecodableType & value); @@ -353,6 +385,9 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::RvcOperationalState::Events::OperationalError::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::RvcOperationalState::Events::OperationCompletion::DecodableType & value); +static CHIP_ERROR +LogValue(const char * label, size_t indent, + const chip::app::Clusters::DemandResponseLoadControl::Events::LoadControlEventStatusChange::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::DoorLock::Events::DoorLockAlarm::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, 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 49f02d426596bd..d99e1e416c97cc 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -97,6 +97,7 @@ | RvcOperationalState | 0x0061 | | HepaFilterMonitoring | 0x0071 | | ActivatedCarbonFilterMonitoring | 0x0072 | +| DemandResponseLoadControl | 0x0096 | | DoorLock | 0x0101 | | WindowCovering | 0x0102 | | BarrierControl | 0x0103 | @@ -70197,6 +70198,1777 @@ class SubscribeAttributeActivatedCarbonFilterMonitoringClusterRevision : public } }; +#endif // MTR_ENABLE_PROVISIONAL +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL +/*----------------------------------------------------------------------------*\ +| Cluster DemandResponseLoadControl | 0x0096 | +|------------------------------------------------------------------------------| +| Commands: | | +| * RegisterLoadControlProgramRequest | 0x00 | +| * UnregisterLoadControlProgramRequest | 0x01 | +| * AddLoadControlEventRequest | 0x02 | +| * RemoveLoadControlEventRequest | 0x03 | +| * ClearLoadControlEventsRequest | 0x04 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * DeviceClass | 0x0000 | +| * LoadControlPrograms | 0x0001 | +| * NumberOfLoadControlPrograms | 0x0002 | +| * Events | 0x0003 | +| * ActiveEvents | 0x0004 | +| * NumberOfEventsPerProgram | 0x0005 | +| * NumberOfTransistions | 0x0006 | +| * DefaultRandomStart | 0x0007 | +| * DefaultRandomDuration | 0x0008 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * EventList | 0xFFFA | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +| * LoadControlEventStatusChange | 0x0000 | +\*----------------------------------------------------------------------------*/ + +#if MTR_ENABLE_PROVISIONAL +/* + * Command RegisterLoadControlProgramRequest + */ +class DemandResponseLoadControlRegisterLoadControlProgramRequest : public ClusterCommand { +public: + DemandResponseLoadControlRegisterLoadControlProgramRequest() + : ClusterCommand("register-load-control-program-request") + , mComplex_LoadControlProgram(&mRequest.loadControlProgram) + { +#if MTR_ENABLE_PROVISIONAL + AddArgument("LoadControlProgram", &mComplex_LoadControlProgram); +#endif // MTR_ENABLE_PROVISIONAL + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::DemandResponseLoadControl::Commands::RegisterLoadControlProgramRequest::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRDemandResponseLoadControlClusterRegisterLoadControlProgramRequestParams alloc] init]; + params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; +#if MTR_ENABLE_PROVISIONAL + params.loadControlProgram = [MTRDemandResponseLoadControlClusterLoadControlProgramStruct new]; + params.loadControlProgram.programID = [NSData dataWithBytes:mRequest.loadControlProgram.programID.data() length:mRequest.loadControlProgram.programID.size()]; + params.loadControlProgram.name = [[NSString alloc] initWithBytes:mRequest.loadControlProgram.name.data() length:mRequest.loadControlProgram.name.size() encoding:NSUTF8StringEncoding]; + if (mRequest.loadControlProgram.enrollmentGroup.IsNull()) { + params.loadControlProgram.enrollmentGroup = nil; + } else { + params.loadControlProgram.enrollmentGroup = [NSNumber numberWithUnsignedChar:mRequest.loadControlProgram.enrollmentGroup.Value()]; + } + if (mRequest.loadControlProgram.randomStartMinutes.IsNull()) { + params.loadControlProgram.randomStartMinutes = nil; + } else { + params.loadControlProgram.randomStartMinutes = [NSNumber numberWithUnsignedChar:mRequest.loadControlProgram.randomStartMinutes.Value()]; + } + if (mRequest.loadControlProgram.randomDurationMinutes.IsNull()) { + params.loadControlProgram.randomDurationMinutes = nil; + } else { + params.loadControlProgram.randomDurationMinutes = [NSNumber numberWithUnsignedChar:mRequest.loadControlProgram.randomDurationMinutes.Value()]; + } +#endif // MTR_ENABLE_PROVISIONAL + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster registerLoadControlProgramRequestWithParams:params completion: + ^(NSError * _Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } + +private: + chip::app::Clusters::DemandResponseLoadControl::Commands::RegisterLoadControlProgramRequest::Type mRequest; + TypedComplexArgument mComplex_LoadControlProgram; +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL +/* + * Command UnregisterLoadControlProgramRequest + */ +class DemandResponseLoadControlUnregisterLoadControlProgramRequest : public ClusterCommand { +public: + DemandResponseLoadControlUnregisterLoadControlProgramRequest() + : ClusterCommand("unregister-load-control-program-request") + { +#if MTR_ENABLE_PROVISIONAL + AddArgument("LoadControlProgramID", &mRequest.loadControlProgramID); +#endif // MTR_ENABLE_PROVISIONAL + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::DemandResponseLoadControl::Commands::UnregisterLoadControlProgramRequest::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRDemandResponseLoadControlClusterUnregisterLoadControlProgramRequestParams alloc] init]; + params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; +#if MTR_ENABLE_PROVISIONAL + params.loadControlProgramID = [NSData dataWithBytes:mRequest.loadControlProgramID.data() length:mRequest.loadControlProgramID.size()]; +#endif // MTR_ENABLE_PROVISIONAL + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster unregisterLoadControlProgramRequestWithParams:params completion: + ^(NSError * _Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } + +private: + chip::app::Clusters::DemandResponseLoadControl::Commands::UnregisterLoadControlProgramRequest::Type mRequest; +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL +/* + * Command AddLoadControlEventRequest + */ +class DemandResponseLoadControlAddLoadControlEventRequest : public ClusterCommand { +public: + DemandResponseLoadControlAddLoadControlEventRequest() + : ClusterCommand("add-load-control-event-request") + , mComplex_Event(&mRequest.event) + { +#if MTR_ENABLE_PROVISIONAL + AddArgument("Event", &mComplex_Event); +#endif // MTR_ENABLE_PROVISIONAL + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::DemandResponseLoadControl::Commands::AddLoadControlEventRequest::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRDemandResponseLoadControlClusterAddLoadControlEventRequestParams alloc] init]; + params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; +#if MTR_ENABLE_PROVISIONAL + params.event = [MTRDemandResponseLoadControlClusterLoadControlEventStruct new]; + params.event.eventID = [NSData dataWithBytes:mRequest.event.eventID.data() length:mRequest.event.eventID.size()]; + if (mRequest.event.programID.IsNull()) { + params.event.programID = nil; + } else { + params.event.programID = [NSData dataWithBytes:mRequest.event.programID.Value().data() length:mRequest.event.programID.Value().size()]; + } + params.event.control = [NSNumber numberWithUnsignedShort:mRequest.event.control.Raw()]; + params.event.deviceClass = [NSNumber numberWithUnsignedInt:mRequest.event.deviceClass.Raw()]; + if (mRequest.event.enrollmentGroup.HasValue()) { + params.event.enrollmentGroup = [NSNumber numberWithUnsignedChar:mRequest.event.enrollmentGroup.Value()]; + } else { + params.event.enrollmentGroup = nil; + } + params.event.criticality = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.event.criticality)]; + if (mRequest.event.startTime.IsNull()) { + params.event.startTime = nil; + } else { + params.event.startTime = [NSNumber numberWithUnsignedInt:mRequest.event.startTime.Value()]; + } + { // Scope for our temporary variables + auto * array_1 = [NSMutableArray new]; + for (auto & entry_1 : mRequest.event.transitions) { + MTRDemandResponseLoadControlClusterLoadControlEventTransitionStruct * newElement_1; + newElement_1 = [MTRDemandResponseLoadControlClusterLoadControlEventTransitionStruct new]; + newElement_1.duration = [NSNumber numberWithUnsignedShort:entry_1.duration]; + newElement_1.control = [NSNumber numberWithUnsignedShort:entry_1.control.Raw()]; + if (entry_1.temperatureControl.HasValue()) { + newElement_1.temperatureControl = [MTRDemandResponseLoadControlClusterTemperatureControlStruct new]; + if (entry_1.temperatureControl.Value().coolingTempOffset.HasValue()) { + if (entry_1.temperatureControl.Value().coolingTempOffset.Value().IsNull()) { + newElement_1.temperatureControl.coolingTempOffset = nil; + } else { + newElement_1.temperatureControl.coolingTempOffset = [NSNumber numberWithUnsignedShort:entry_1.temperatureControl.Value().coolingTempOffset.Value().Value()]; + } + } else { + newElement_1.temperatureControl.coolingTempOffset = nil; + } + if (entry_1.temperatureControl.Value().heatingtTempOffset.HasValue()) { + if (entry_1.temperatureControl.Value().heatingtTempOffset.Value().IsNull()) { + newElement_1.temperatureControl.heatingtTempOffset = nil; + } else { + newElement_1.temperatureControl.heatingtTempOffset = [NSNumber numberWithUnsignedShort:entry_1.temperatureControl.Value().heatingtTempOffset.Value().Value()]; + } + } else { + newElement_1.temperatureControl.heatingtTempOffset = nil; + } + if (entry_1.temperatureControl.Value().coolingTempSetpoint.HasValue()) { + if (entry_1.temperatureControl.Value().coolingTempSetpoint.Value().IsNull()) { + newElement_1.temperatureControl.coolingTempSetpoint = nil; + } else { + newElement_1.temperatureControl.coolingTempSetpoint = [NSNumber numberWithShort:entry_1.temperatureControl.Value().coolingTempSetpoint.Value().Value()]; + } + } else { + newElement_1.temperatureControl.coolingTempSetpoint = nil; + } + if (entry_1.temperatureControl.Value().heatingTempSetpoint.HasValue()) { + if (entry_1.temperatureControl.Value().heatingTempSetpoint.Value().IsNull()) { + newElement_1.temperatureControl.heatingTempSetpoint = nil; + } else { + newElement_1.temperatureControl.heatingTempSetpoint = [NSNumber numberWithShort:entry_1.temperatureControl.Value().heatingTempSetpoint.Value().Value()]; + } + } else { + newElement_1.temperatureControl.heatingTempSetpoint = nil; + } + } else { + newElement_1.temperatureControl = nil; + } + if (entry_1.averageLoadControl.HasValue()) { + newElement_1.averageLoadControl = [MTRDemandResponseLoadControlClusterAverageLoadControlStruct new]; + newElement_1.averageLoadControl.loadAdjustment = [NSNumber numberWithChar:entry_1.averageLoadControl.Value().loadAdjustment]; + } else { + newElement_1.averageLoadControl = nil; + } + if (entry_1.dutyCycleControl.HasValue()) { + newElement_1.dutyCycleControl = [MTRDemandResponseLoadControlClusterDutyCycleControlStruct new]; + newElement_1.dutyCycleControl.dutyCycle = [NSNumber numberWithUnsignedChar:entry_1.dutyCycleControl.Value().dutyCycle]; + } else { + newElement_1.dutyCycleControl = nil; + } + if (entry_1.powerSavingsControl.HasValue()) { + newElement_1.powerSavingsControl = [MTRDemandResponseLoadControlClusterPowerSavingsControlStruct new]; + newElement_1.powerSavingsControl.powerSavings = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_1.powerSavingsControl.Value().powerSavings)]; + } else { + newElement_1.powerSavingsControl = nil; + } + if (entry_1.heatingSourceControl.HasValue()) { + newElement_1.heatingSourceControl = [MTRDemandResponseLoadControlClusterHeatingSourceControlStruct new]; + newElement_1.heatingSourceControl.heatingSource = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_1.heatingSourceControl.Value().heatingSource)]; + } else { + newElement_1.heatingSourceControl = nil; + } + [array_1 addObject:newElement_1]; + } + params.event.transitions = array_1; + } +#endif // MTR_ENABLE_PROVISIONAL + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster addLoadControlEventRequestWithParams:params completion: + ^(NSError * _Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } + +private: + chip::app::Clusters::DemandResponseLoadControl::Commands::AddLoadControlEventRequest::Type mRequest; + TypedComplexArgument mComplex_Event; +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL +/* + * Command RemoveLoadControlEventRequest + */ +class DemandResponseLoadControlRemoveLoadControlEventRequest : public ClusterCommand { +public: + DemandResponseLoadControlRemoveLoadControlEventRequest() + : ClusterCommand("remove-load-control-event-request") + { +#if MTR_ENABLE_PROVISIONAL + AddArgument("EventID", &mRequest.eventID); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("CancelControl", 0, UINT16_MAX, &mRequest.cancelControl); +#endif // MTR_ENABLE_PROVISIONAL + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::DemandResponseLoadControl::Commands::RemoveLoadControlEventRequest::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRDemandResponseLoadControlClusterRemoveLoadControlEventRequestParams alloc] init]; + params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; +#if MTR_ENABLE_PROVISIONAL + params.eventID = [NSData dataWithBytes:mRequest.eventID.data() length:mRequest.eventID.size()]; +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + params.cancelControl = [NSNumber numberWithUnsignedShort:mRequest.cancelControl.Raw()]; +#endif // MTR_ENABLE_PROVISIONAL + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster removeLoadControlEventRequestWithParams:params completion: + ^(NSError * _Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } + +private: + chip::app::Clusters::DemandResponseLoadControl::Commands::RemoveLoadControlEventRequest::Type mRequest; +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL +/* + * Command ClearLoadControlEventsRequest + */ +class DemandResponseLoadControlClearLoadControlEventsRequest : public ClusterCommand { +public: + DemandResponseLoadControlClearLoadControlEventsRequest() + : ClusterCommand("clear-load-control-events-request") + { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::DemandResponseLoadControl::Commands::ClearLoadControlEventsRequest::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRDemandResponseLoadControlClusterClearLoadControlEventsRequestParams alloc] init]; + params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster clearLoadControlEventsRequestWithParams:params completion: + ^(NSError * _Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } + +private: +}; + +#endif // MTR_ENABLE_PROVISIONAL + +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute DeviceClass + */ +class ReadDemandResponseLoadControlDeviceClass : public ReadAttribute { +public: + ReadDemandResponseLoadControlDeviceClass() + : ReadAttribute("device-class") + { + } + + ~ReadDemandResponseLoadControlDeviceClass() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::DeviceClass::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 = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeDeviceClassWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"DemandResponseLoadControl.DeviceClass response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("DemandResponseLoadControl DeviceClass read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDemandResponseLoadControlDeviceClass : public SubscribeAttribute { +public: + SubscribeAttributeDemandResponseLoadControlDeviceClass() + : SubscribeAttribute("device-class") + { + } + + ~SubscribeAttributeDemandResponseLoadControlDeviceClass() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::DeviceClass::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 = [[MTRBaseClusterDemandResponseLoadControl 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 subscribeAttributeDeviceClassWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"DemandResponseLoadControl.DeviceClass 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 LoadControlPrograms + */ +class ReadDemandResponseLoadControlLoadControlPrograms : public ReadAttribute { +public: + ReadDemandResponseLoadControlLoadControlPrograms() + : ReadAttribute("load-control-programs") + { + } + + ~ReadDemandResponseLoadControlLoadControlPrograms() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::LoadControlPrograms::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 = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeLoadControlProgramsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"DemandResponseLoadControl.LoadControlPrograms response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("DemandResponseLoadControl LoadControlPrograms read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDemandResponseLoadControlLoadControlPrograms : public SubscribeAttribute { +public: + SubscribeAttributeDemandResponseLoadControlLoadControlPrograms() + : SubscribeAttribute("load-control-programs") + { + } + + ~SubscribeAttributeDemandResponseLoadControlLoadControlPrograms() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::LoadControlPrograms::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 = [[MTRBaseClusterDemandResponseLoadControl 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 subscribeAttributeLoadControlProgramsWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"DemandResponseLoadControl.LoadControlPrograms 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 NumberOfLoadControlPrograms + */ +class ReadDemandResponseLoadControlNumberOfLoadControlPrograms : public ReadAttribute { +public: + ReadDemandResponseLoadControlNumberOfLoadControlPrograms() + : ReadAttribute("number-of-load-control-programs") + { + } + + ~ReadDemandResponseLoadControlNumberOfLoadControlPrograms() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::NumberOfLoadControlPrograms::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 = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeNumberOfLoadControlProgramsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"DemandResponseLoadControl.NumberOfLoadControlPrograms response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("DemandResponseLoadControl NumberOfLoadControlPrograms read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDemandResponseLoadControlNumberOfLoadControlPrograms : public SubscribeAttribute { +public: + SubscribeAttributeDemandResponseLoadControlNumberOfLoadControlPrograms() + : SubscribeAttribute("number-of-load-control-programs") + { + } + + ~SubscribeAttributeDemandResponseLoadControlNumberOfLoadControlPrograms() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::NumberOfLoadControlPrograms::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 = [[MTRBaseClusterDemandResponseLoadControl 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 subscribeAttributeNumberOfLoadControlProgramsWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"DemandResponseLoadControl.NumberOfLoadControlPrograms 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 Events + */ +class ReadDemandResponseLoadControlEvents : public ReadAttribute { +public: + ReadDemandResponseLoadControlEvents() + : ReadAttribute("events") + { + } + + ~ReadDemandResponseLoadControlEvents() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::Events::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 = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeEventsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"DemandResponseLoadControl.Events response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("DemandResponseLoadControl Events read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDemandResponseLoadControlEvents : public SubscribeAttribute { +public: + SubscribeAttributeDemandResponseLoadControlEvents() + : SubscribeAttribute("events") + { + } + + ~SubscribeAttributeDemandResponseLoadControlEvents() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::Events::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 = [[MTRBaseClusterDemandResponseLoadControl 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 subscribeAttributeEventsWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"DemandResponseLoadControl.Events 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 ActiveEvents + */ +class ReadDemandResponseLoadControlActiveEvents : public ReadAttribute { +public: + ReadDemandResponseLoadControlActiveEvents() + : ReadAttribute("active-events") + { + } + + ~ReadDemandResponseLoadControlActiveEvents() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::ActiveEvents::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 = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeActiveEventsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"DemandResponseLoadControl.ActiveEvents response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("DemandResponseLoadControl ActiveEvents read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDemandResponseLoadControlActiveEvents : public SubscribeAttribute { +public: + SubscribeAttributeDemandResponseLoadControlActiveEvents() + : SubscribeAttribute("active-events") + { + } + + ~SubscribeAttributeDemandResponseLoadControlActiveEvents() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::ActiveEvents::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 = [[MTRBaseClusterDemandResponseLoadControl 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 subscribeAttributeActiveEventsWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"DemandResponseLoadControl.ActiveEvents 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 NumberOfEventsPerProgram + */ +class ReadDemandResponseLoadControlNumberOfEventsPerProgram : public ReadAttribute { +public: + ReadDemandResponseLoadControlNumberOfEventsPerProgram() + : ReadAttribute("number-of-events-per-program") + { + } + + ~ReadDemandResponseLoadControlNumberOfEventsPerProgram() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::NumberOfEventsPerProgram::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 = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeNumberOfEventsPerProgramWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"DemandResponseLoadControl.NumberOfEventsPerProgram response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("DemandResponseLoadControl NumberOfEventsPerProgram read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDemandResponseLoadControlNumberOfEventsPerProgram : public SubscribeAttribute { +public: + SubscribeAttributeDemandResponseLoadControlNumberOfEventsPerProgram() + : SubscribeAttribute("number-of-events-per-program") + { + } + + ~SubscribeAttributeDemandResponseLoadControlNumberOfEventsPerProgram() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::NumberOfEventsPerProgram::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 = [[MTRBaseClusterDemandResponseLoadControl 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 subscribeAttributeNumberOfEventsPerProgramWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"DemandResponseLoadControl.NumberOfEventsPerProgram 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 NumberOfTransistions + */ +class ReadDemandResponseLoadControlNumberOfTransistions : public ReadAttribute { +public: + ReadDemandResponseLoadControlNumberOfTransistions() + : ReadAttribute("number-of-transistions") + { + } + + ~ReadDemandResponseLoadControlNumberOfTransistions() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::NumberOfTransistions::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 = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeNumberOfTransistionsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"DemandResponseLoadControl.NumberOfTransistions response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("DemandResponseLoadControl NumberOfTransistions read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDemandResponseLoadControlNumberOfTransistions : public SubscribeAttribute { +public: + SubscribeAttributeDemandResponseLoadControlNumberOfTransistions() + : SubscribeAttribute("number-of-transistions") + { + } + + ~SubscribeAttributeDemandResponseLoadControlNumberOfTransistions() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::NumberOfTransistions::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 = [[MTRBaseClusterDemandResponseLoadControl 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 subscribeAttributeNumberOfTransistionsWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"DemandResponseLoadControl.NumberOfTransistions 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 DefaultRandomStart + */ +class ReadDemandResponseLoadControlDefaultRandomStart : public ReadAttribute { +public: + ReadDemandResponseLoadControlDefaultRandomStart() + : ReadAttribute("default-random-start") + { + } + + ~ReadDemandResponseLoadControlDefaultRandomStart() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::DefaultRandomStart::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 = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeDefaultRandomStartWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"DemandResponseLoadControl.DefaultRandomStart response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("DemandResponseLoadControl DefaultRandomStart read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteDemandResponseLoadControlDefaultRandomStart : public WriteAttribute { +public: + WriteDemandResponseLoadControlDefaultRandomStart() + : WriteAttribute("default-random-start") + { + AddArgument("attr-name", "default-random-start"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteDemandResponseLoadControlDefaultRandomStart() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::DefaultRandomStart::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (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 = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; + params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; + NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster writeAttributeDefaultRandomStartWithValue:value params:params completion:^(NSError * _Nullable error) { + if (error != nil) { + LogNSError("DemandResponseLoadControl DefaultRandomStart write Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } + +private: + uint8_t mValue; +}; + +class SubscribeAttributeDemandResponseLoadControlDefaultRandomStart : public SubscribeAttribute { +public: + SubscribeAttributeDemandResponseLoadControlDefaultRandomStart() + : SubscribeAttribute("default-random-start") + { + } + + ~SubscribeAttributeDemandResponseLoadControlDefaultRandomStart() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::DefaultRandomStart::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 = [[MTRBaseClusterDemandResponseLoadControl 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 subscribeAttributeDefaultRandomStartWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"DemandResponseLoadControl.DefaultRandomStart 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 DefaultRandomDuration + */ +class ReadDemandResponseLoadControlDefaultRandomDuration : public ReadAttribute { +public: + ReadDemandResponseLoadControlDefaultRandomDuration() + : ReadAttribute("default-random-duration") + { + } + + ~ReadDemandResponseLoadControlDefaultRandomDuration() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::DefaultRandomDuration::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 = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeDefaultRandomDurationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"DemandResponseLoadControl.DefaultRandomDuration response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("DemandResponseLoadControl DefaultRandomDuration read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteDemandResponseLoadControlDefaultRandomDuration : public WriteAttribute { +public: + WriteDemandResponseLoadControlDefaultRandomDuration() + : WriteAttribute("default-random-duration") + { + AddArgument("attr-name", "default-random-duration"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteDemandResponseLoadControlDefaultRandomDuration() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::DefaultRandomDuration::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (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 = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; + params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; + NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster writeAttributeDefaultRandomDurationWithValue:value params:params completion:^(NSError * _Nullable error) { + if (error != nil) { + LogNSError("DemandResponseLoadControl DefaultRandomDuration write Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } + +private: + uint8_t mValue; +}; + +class SubscribeAttributeDemandResponseLoadControlDefaultRandomDuration : public SubscribeAttribute { +public: + SubscribeAttributeDemandResponseLoadControlDefaultRandomDuration() + : SubscribeAttribute("default-random-duration") + { + } + + ~SubscribeAttributeDemandResponseLoadControlDefaultRandomDuration() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::DefaultRandomDuration::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 = [[MTRBaseClusterDemandResponseLoadControl 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 subscribeAttributeDefaultRandomDurationWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"DemandResponseLoadControl.DefaultRandomDuration 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 ReadDemandResponseLoadControlGeneratedCommandList : public ReadAttribute { +public: + ReadDemandResponseLoadControlGeneratedCommandList() + : ReadAttribute("generated-command-list") + { + } + + ~ReadDemandResponseLoadControlGeneratedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::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 = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"DemandResponseLoadControl.GeneratedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("DemandResponseLoadControl GeneratedCommandList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDemandResponseLoadControlGeneratedCommandList : public SubscribeAttribute { +public: + SubscribeAttributeDemandResponseLoadControlGeneratedCommandList() + : SubscribeAttribute("generated-command-list") + { + } + + ~SubscribeAttributeDemandResponseLoadControlGeneratedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::DemandResponseLoadControl::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 = [[MTRBaseClusterDemandResponseLoadControl 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(@"DemandResponseLoadControl.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 ReadDemandResponseLoadControlAcceptedCommandList : public ReadAttribute { +public: + ReadDemandResponseLoadControlAcceptedCommandList() + : ReadAttribute("accepted-command-list") + { + } + + ~ReadDemandResponseLoadControlAcceptedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::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 = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"DemandResponseLoadControl.AcceptedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("DemandResponseLoadControl AcceptedCommandList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDemandResponseLoadControlAcceptedCommandList : public SubscribeAttribute { +public: + SubscribeAttributeDemandResponseLoadControlAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") + { + } + + ~SubscribeAttributeDemandResponseLoadControlAcceptedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::DemandResponseLoadControl::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 = [[MTRBaseClusterDemandResponseLoadControl 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(@"DemandResponseLoadControl.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 ReadDemandResponseLoadControlEventList : public ReadAttribute { +public: + ReadDemandResponseLoadControlEventList() + : ReadAttribute("event-list") + { + } + + ~ReadDemandResponseLoadControlEventList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::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 = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"DemandResponseLoadControl.EventList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("DemandResponseLoadControl EventList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDemandResponseLoadControlEventList : public SubscribeAttribute { +public: + SubscribeAttributeDemandResponseLoadControlEventList() + : SubscribeAttribute("event-list") + { + } + + ~SubscribeAttributeDemandResponseLoadControlEventList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::DemandResponseLoadControl::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 = [[MTRBaseClusterDemandResponseLoadControl 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(@"DemandResponseLoadControl.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 ReadDemandResponseLoadControlAttributeList : public ReadAttribute { +public: + ReadDemandResponseLoadControlAttributeList() + : ReadAttribute("attribute-list") + { + } + + ~ReadDemandResponseLoadControlAttributeList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::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 = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"DemandResponseLoadControl.AttributeList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("DemandResponseLoadControl AttributeList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDemandResponseLoadControlAttributeList : public SubscribeAttribute { +public: + SubscribeAttributeDemandResponseLoadControlAttributeList() + : SubscribeAttribute("attribute-list") + { + } + + ~SubscribeAttributeDemandResponseLoadControlAttributeList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::DemandResponseLoadControl::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 = [[MTRBaseClusterDemandResponseLoadControl 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(@"DemandResponseLoadControl.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 ReadDemandResponseLoadControlFeatureMap : public ReadAttribute { +public: + ReadDemandResponseLoadControlFeatureMap() + : ReadAttribute("feature-map") + { + } + + ~ReadDemandResponseLoadControlFeatureMap() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::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 = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"DemandResponseLoadControl.FeatureMap response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("DemandResponseLoadControl FeatureMap read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDemandResponseLoadControlFeatureMap : public SubscribeAttribute { +public: + SubscribeAttributeDemandResponseLoadControlFeatureMap() + : SubscribeAttribute("feature-map") + { + } + + ~SubscribeAttributeDemandResponseLoadControlFeatureMap() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::DemandResponseLoadControl::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 = [[MTRBaseClusterDemandResponseLoadControl 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(@"DemandResponseLoadControl.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 ReadDemandResponseLoadControlClusterRevision : public ReadAttribute { +public: + ReadDemandResponseLoadControlClusterRevision() + : ReadAttribute("cluster-revision") + { + } + + ~ReadDemandResponseLoadControlClusterRevision() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::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 = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"DemandResponseLoadControl.ClusterRevision response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("DemandResponseLoadControl ClusterRevision read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeDemandResponseLoadControlClusterRevision : public SubscribeAttribute { +public: + SubscribeAttributeDemandResponseLoadControlClusterRevision() + : SubscribeAttribute("cluster-revision") + { + } + + ~SubscribeAttributeDemandResponseLoadControlClusterRevision() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::DemandResponseLoadControl::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 = [[MTRBaseClusterDemandResponseLoadControl 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(@"DemandResponseLoadControl.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 /*----------------------------------------------------------------------------*\ @@ -159581,6 +161353,102 @@ void registerClusterActivatedCarbonFilterMonitoring(Commands & commands) commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } +void registerClusterDemandResponseLoadControl(Commands & commands) +{ +#if MTR_ENABLE_PROVISIONAL + using namespace chip::app::Clusters::DemandResponseLoadControl; + + const char * clusterName = "DemandResponseLoadControl"; + + commands_list clusterCommands = { + make_unique(Id), // +#if MTR_ENABLE_PROVISIONAL + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL + 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(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + 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 + make_unique(Id), // + make_unique(Id), // + }; + + commands.RegisterCluster(clusterName, clusterCommands); +#endif // MTR_ENABLE_PROVISIONAL +} void registerClusterDoorLock(Commands & commands) { using namespace chip::app::Clusters::DoorLock; @@ -162708,6 +164576,7 @@ void registerClusters(Commands & commands) registerClusterRvcOperationalState(commands); registerClusterHepaFilterMonitoring(commands); registerClusterActivatedCarbonFilterMonitoring(commands); + registerClusterDemandResponseLoadControl(commands); registerClusterDoorLock(commands); registerClusterWindowCovering(commands); registerClusterBarrierControl(commands);