From ae68cd10ccd6ee8063d46ec7db9af1fe0d997d4f Mon Sep 17 00:00:00 2001 From: Fesseha Date: Tue, 12 Dec 2023 14:21:33 +0100 Subject: [PATCH] update valve configuration and control cluster according to latest spec --- ...alve-configuration-and-control-cluster.xml | 69 ++-- .../data_model/controller-clusters.matter | 41 +- .../chip/devicecontroller/ChipClusters.java | 152 +++---- .../devicecontroller/ChipEventStructs.java | 19 +- .../devicecontroller/ClusterIDMapping.java | 34 +- .../devicecontroller/ClusterInfoMapping.java | 45 +- .../devicecontroller/ClusterReadMapping.java | 36 +- .../devicecontroller/ClusterWriteMapping.java | 60 +-- ...AndControlClusterValveStateChangedEvent.kt | 20 +- .../ValveConfigurationAndControlCluster.kt | 185 ++------- ...AndControlClusterValveStateChangedEvent.kt | 20 +- .../CHIPAttributeTLVValueDecoder.cpp | 60 +-- .../zap-generated/CHIPClustersWrite-JNI.cpp | 124 +----- .../CHIPEventTLVValueDecoder.cpp | 22 +- .../java/zap-generated/CHIPReadCallbacks.cpp | 113 ++--- .../python/chip/clusters/CHIPClusters.py | 23 +- .../python/chip/clusters/Objects.py | 90 ++-- .../MTRAttributeSpecifiedCheck.mm | 8 +- .../MTRAttributeTLVValueDecoder.mm | 38 +- .../CHIP/zap-generated/MTRBaseClusters.h | 52 ++- .../CHIP/zap-generated/MTRBaseClusters.mm | 188 +++------ .../CHIP/zap-generated/MTRClusterConstants.h | 13 +- .../CHIP/zap-generated/MTRClusters.h | 15 +- .../CHIP/zap-generated/MTRClusters.mm | 65 +-- .../zap-generated/MTRCommandPayloadsObjc.h | 34 +- .../zap-generated/MTRCommandPayloadsObjc.mm | 106 +---- .../MTRCommandPayloads_Internal.h | 6 - .../zap-generated/MTREventTLVValueDecoder.mm | 9 + .../CHIP/zap-generated/MTRStructsObjc.h | 1 + .../CHIP/zap-generated/MTRStructsObjc.mm | 5 +- .../zap-generated/attributes/Accessors.cpp | 120 +++--- .../zap-generated/attributes/Accessors.h | 21 +- .../app-common/zap-generated/callback.h | 6 - .../zap-generated/cluster-enums-check.h | 16 +- .../app-common/zap-generated/cluster-enums.h | 27 +- .../zap-generated/cluster-objects.cpp | 57 +-- .../zap-generated/cluster-objects.h | 91 ++-- .../app-common/zap-generated/ids/Attributes.h | 20 +- .../app-common/zap-generated/ids/Commands.h | 4 - .../zap-generated/cluster/Commands.h | 79 +--- .../cluster/logging/DataModelLogger.cpp | 24 +- .../zap-generated/cluster/Commands.h | 389 ++++++------------ 42 files changed, 871 insertions(+), 1636 deletions(-) diff --git a/src/app/zap-templates/zcl/data-model/chip/valve-configuration-and-control-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/valve-configuration-and-control-cluster.xml index d4207d6f116e2f..0058160c13d692 100644 --- a/src/app/zap-templates/zcl/data-model/chip/valve-configuration-and-control-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/valve-configuration-and-control-cluster.xml @@ -19,21 +19,30 @@ limitations under the License. - - + + - - - + + + + + + - - + + + + + + + + @@ -48,51 +57,37 @@ limitations under the License. - - OpenDuration - - - - AutoCloseTime - RemainingDuration - CurrentState - TargetState - - StartUpState - - - + OpenDuration + + + DefaultOpenDuration + AutoCloseTime + RemainingDuration + CurrentState + TargetState CurrentLevel TargetLevel - - OpenLevel - - - + DefaultOpenLevel ValveFault - This command is used to set the valve to its fully open position. - + This command is used to set the valve to its open position. + + - This command is used to set the valve to its fully closed position. - - - - This command is used to set the valve to a specific level. - - + This command is used to set the valve to its closed position. - This event SHALL be generated when the valve changes state, either opens or closes. + This event SHALL be generated when the valve state changed. + - This event SHALL be generated when the valve registers a fault. + This event SHALL be generated when the valve registers or clears a fault. diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 2d1909cb0ee41b..c558cf99d72be8 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -4049,9 +4049,14 @@ provisional cluster BooleanSensorConfiguration = 128 { provisional cluster ValveConfigurationAndControl = 129 { revision 1; + enum StatusCodeEnum : enum8 { + kFailureDueToFault = 2; + } + enum ValveStateEnum : enum8 { - kOpen = 0; - kClosed = 1; + kClosed = 0; + kOpen = 1; + kTransitioning = 2; } bitmap Feature : bitmap32 { @@ -4063,25 +4068,29 @@ provisional cluster ValveConfigurationAndControl = 129 { kGeneralFault = 0x1; kBlocked = 0x2; kLeaking = 0x4; + kNotConnected = 0x8; + kShortCircuit = 0x10; + kCurrentExceeded = 0x20; } info event ValveStateChanged = 0 { ValveStateEnum valveState = 0; + optional percent valveLevel = 1; } info event ValveFault = 1 { ValveFaultBitmap valveFault = 0; } - attribute access(write: manage) nullable elapsed_s openDuration = 0; - readonly attribute optional nullable epoch_us autoCloseTime = 1; - readonly attribute optional nullable elapsed_s remainingDuration = 2; - readonly attribute nullable ValveStateEnum currentState = 3; - readonly attribute nullable ValveStateEnum targetState = 4; - attribute access(write: manage) optional ValveStateEnum startUpState = 5; + readonly attribute nullable elapsed_s openDuration = 0; + readonly attribute nullable elapsed_s defaultOpenDuration = 1; + readonly attribute optional nullable epoch_us autoCloseTime = 2; + readonly attribute nullable elapsed_s remainingDuration = 3; + readonly attribute nullable ValveStateEnum currentState = 4; + readonly attribute nullable ValveStateEnum targetState = 5; readonly attribute optional nullable percent currentLevel = 6; readonly attribute optional nullable percent targetLevel = 7; - attribute access(write: manage) optional nullable percent openLevel = 8; + attribute optional percent defaultOpenLevel = 8; readonly attribute optional ValveFaultBitmap valveFault = 9; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; @@ -4091,20 +4100,14 @@ provisional cluster ValveConfigurationAndControl = 129 { readonly attribute int16u clusterRevision = 65533; request struct OpenRequest { - optional elapsed_s openDuration = 0; - } - - request struct SetLevelRequest { - percent level = 0; - optional elapsed_s openDuration = 1; + optional nullable elapsed_s openDuration = 0; + optional percent targetLevel = 1; } - /** This command is used to set the valve to its fully open position. */ + /** This command is used to set the valve to its open position. */ command Open(OpenRequest): DefaultSuccess = 0; - /** This command is used to set the valve to its fully closed position. */ + /** This command is used to set the valve to its closed position. */ command Close(): DefaultSuccess = 1; - /** This command is used to set the valve to a specific level. */ - command SetLevel(SetLevelRequest): DefaultSuccess = 2; } /** This cluster provides a mechanism for querying data about the electrical energy imported or provided by the server. */ diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index b571ac051e3f2b..19e47eb8577c9b 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -27749,14 +27749,14 @@ public static class ValveConfigurationAndControlCluster extends BaseChipCluster public static final long CLUSTER_ID = 129L; private static final long OPEN_DURATION_ATTRIBUTE_ID = 0L; - private static final long AUTO_CLOSE_TIME_ATTRIBUTE_ID = 1L; - private static final long REMAINING_DURATION_ATTRIBUTE_ID = 2L; - private static final long CURRENT_STATE_ATTRIBUTE_ID = 3L; - private static final long TARGET_STATE_ATTRIBUTE_ID = 4L; - private static final long START_UP_STATE_ATTRIBUTE_ID = 5L; + private static final long DEFAULT_OPEN_DURATION_ATTRIBUTE_ID = 1L; + private static final long AUTO_CLOSE_TIME_ATTRIBUTE_ID = 2L; + private static final long REMAINING_DURATION_ATTRIBUTE_ID = 3L; + private static final long CURRENT_STATE_ATTRIBUTE_ID = 4L; + private static final long TARGET_STATE_ATTRIBUTE_ID = 5L; private static final long CURRENT_LEVEL_ATTRIBUTE_ID = 6L; private static final long TARGET_LEVEL_ATTRIBUTE_ID = 7L; - private static final long OPEN_LEVEL_ATTRIBUTE_ID = 8L; + private static final long DEFAULT_OPEN_LEVEL_ATTRIBUTE_ID = 8L; private static final long VALVE_FAULT_ATTRIBUTE_ID = 9L; private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L; private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L; @@ -27775,18 +27775,22 @@ public long initWithDevice(long devicePtr, int endpointId) { return 0L; } - public void open(DefaultClusterCallback callback, Optional openDuration) { - open(callback, openDuration, 0); + public void open(DefaultClusterCallback callback, @Nullable Optional openDuration, Optional targetLevel) { + open(callback, openDuration, targetLevel, 0); } - public void open(DefaultClusterCallback callback, Optional openDuration, int timedInvokeTimeoutMs) { + public void open(DefaultClusterCallback callback, @Nullable Optional openDuration, Optional targetLevel, int timedInvokeTimeoutMs) { final long commandId = 0L; ArrayList elements = new ArrayList<>(); final long openDurationFieldID = 0L; - BaseTLVType openDurationtlvValue = openDuration.map((nonOptionalopenDuration) -> new UIntType(nonOptionalopenDuration)).orElse(new EmptyType()); + BaseTLVType openDurationtlvValue = openDuration != null ? openDuration.map((nonOptionalopenDuration) -> new UIntType(nonOptionalopenDuration)).orElse(new EmptyType()) : new NullType(); elements.add(new StructElement(openDurationFieldID, openDurationtlvValue)); + final long targetLevelFieldID = 1L; + BaseTLVType targetLeveltlvValue = targetLevel.map((nonOptionaltargetLevel) -> new UIntType(nonOptionaltargetLevel)).orElse(new EmptyType()); + elements.add(new StructElement(targetLevelFieldID, targetLeveltlvValue)); + StructType value = new StructType(elements); invoke(new InvokeCallbackImpl(callback) { @Override @@ -27811,31 +27815,11 @@ public void onResponse(StructType invokeStructValue) { }}, commandId, value, timedInvokeTimeoutMs); } - public void setLevel(DefaultClusterCallback callback, Integer level, Optional openDuration) { - setLevel(callback, level, openDuration, 0); - } - - public void setLevel(DefaultClusterCallback callback, Integer level, Optional openDuration, int timedInvokeTimeoutMs) { - final long commandId = 2L; - - ArrayList elements = new ArrayList<>(); - final long levelFieldID = 0L; - BaseTLVType leveltlvValue = new UIntType(level); - elements.add(new StructElement(levelFieldID, leveltlvValue)); - - final long openDurationFieldID = 1L; - BaseTLVType openDurationtlvValue = openDuration.map((nonOptionalopenDuration) -> new UIntType(nonOptionalopenDuration)).orElse(new EmptyType()); - elements.add(new StructElement(openDurationFieldID, openDurationtlvValue)); - - StructType value = new StructType(elements); - invoke(new InvokeCallbackImpl(callback) { - @Override - public void onResponse(StructType invokeStructValue) { - callback.onSuccess(); - }}, commandId, value, timedInvokeTimeoutMs); + public interface OpenDurationAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable Long value); } - public interface OpenDurationAttributeCallback extends BaseAttributeCallback { + public interface DefaultOpenDurationAttributeCallback extends BaseAttributeCallback { void onSuccess(@Nullable Long value); } @@ -27863,10 +27847,6 @@ public interface TargetLevelAttributeCallback extends BaseAttributeCallback { void onSuccess(@Nullable Integer value); } - public interface OpenLevelAttributeCallback extends BaseAttributeCallback { - void onSuccess(@Nullable Integer value); - } - public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { void onSuccess(List value); } @@ -27896,15 +27876,6 @@ public void onSuccess(byte[] tlv) { }, OPEN_DURATION_ATTRIBUTE_ID, true); } - public void writeOpenDurationAttribute(DefaultClusterCallback callback, Long value) { - writeOpenDurationAttribute(callback, value, 0); - } - - public void writeOpenDurationAttribute(DefaultClusterCallback callback, Long value, int timedWriteTimeoutMs) { - BaseTLVType tlvValue = value != null ? new UIntType(value) : new NullType(); - writeAttribute(new WriteAttributesCallbackImpl(callback), OPEN_DURATION_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); - } - public void subscribeOpenDurationAttribute( OpenDurationAttributeCallback callback, int minInterval, int maxInterval) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, OPEN_DURATION_ATTRIBUTE_ID); @@ -27917,6 +27888,31 @@ public void onSuccess(byte[] tlv) { }, OPEN_DURATION_ATTRIBUTE_ID, minInterval, maxInterval); } + public void readDefaultOpenDurationAttribute( + DefaultOpenDurationAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DEFAULT_OPEN_DURATION_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, DEFAULT_OPEN_DURATION_ATTRIBUTE_ID, true); + } + + public void subscribeDefaultOpenDurationAttribute( + DefaultOpenDurationAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DEFAULT_OPEN_DURATION_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, DEFAULT_OPEN_DURATION_ATTRIBUTE_ID, minInterval, maxInterval); + } + public void readAutoCloseTimeAttribute( AutoCloseTimeAttributeCallback callback) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AUTO_CLOSE_TIME_ATTRIBUTE_ID); @@ -28017,40 +28013,6 @@ public void onSuccess(byte[] tlv) { }, TARGET_STATE_ATTRIBUTE_ID, minInterval, maxInterval); } - public void readStartUpStateAttribute( - IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, START_UP_STATE_ATTRIBUTE_ID); - - readAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, START_UP_STATE_ATTRIBUTE_ID, true); - } - - public void writeStartUpStateAttribute(DefaultClusterCallback callback, Integer value) { - writeStartUpStateAttribute(callback, value, 0); - } - - public void writeStartUpStateAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { - BaseTLVType tlvValue = new UIntType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), START_UP_STATE_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); - } - - public void subscribeStartUpStateAttribute( - IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, START_UP_STATE_ATTRIBUTE_ID); - - subscribeAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - } - }, START_UP_STATE_ATTRIBUTE_ID, minInterval, maxInterval); - } - public void readCurrentLevelAttribute( CurrentLevelAttributeCallback callback) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_LEVEL_ATTRIBUTE_ID); @@ -28101,38 +28063,38 @@ public void onSuccess(byte[] tlv) { }, TARGET_LEVEL_ATTRIBUTE_ID, minInterval, maxInterval); } - public void readOpenLevelAttribute( - OpenLevelAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, OPEN_LEVEL_ATTRIBUTE_ID); + public void readDefaultOpenLevelAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DEFAULT_OPEN_LEVEL_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, OPEN_LEVEL_ATTRIBUTE_ID, true); + }, DEFAULT_OPEN_LEVEL_ATTRIBUTE_ID, true); } - public void writeOpenLevelAttribute(DefaultClusterCallback callback, Integer value) { - writeOpenLevelAttribute(callback, value, 0); + public void writeDefaultOpenLevelAttribute(DefaultClusterCallback callback, Integer value) { + writeDefaultOpenLevelAttribute(callback, value, 0); } - public void writeOpenLevelAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { - BaseTLVType tlvValue = value != null ? new UIntType(value) : new NullType(); - writeAttribute(new WriteAttributesCallbackImpl(callback), OPEN_LEVEL_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + public void writeDefaultOpenLevelAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { + BaseTLVType tlvValue = new UIntType(value); + writeAttribute(new WriteAttributesCallbackImpl(callback), DEFAULT_OPEN_LEVEL_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); } - public void subscribeOpenLevelAttribute( - OpenLevelAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, OPEN_LEVEL_ATTRIBUTE_ID); + public void subscribeDefaultOpenLevelAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DEFAULT_OPEN_LEVEL_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); } - }, OPEN_LEVEL_ATTRIBUTE_ID, minInterval, maxInterval); + }, DEFAULT_OPEN_LEVEL_ATTRIBUTE_ID, minInterval, maxInterval); } public void readValveFaultAttribute( diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java index 5f9984935302be..86fd1946246420 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java @@ -2970,17 +2970,22 @@ public String toString() { } public static class ValveConfigurationAndControlClusterValveStateChangedEvent { public Integer valveState; + public Optional valveLevel; private static final long VALVE_STATE_ID = 0L; + private static final long VALVE_LEVEL_ID = 1L; public ValveConfigurationAndControlClusterValveStateChangedEvent( - Integer valveState + Integer valveState, + Optional valveLevel ) { this.valveState = valveState; + this.valveLevel = valveLevel; } public StructType encodeTlv() { ArrayList values = new ArrayList<>(); values.add(new StructElement(VALVE_STATE_ID, new UIntType(valveState))); + values.add(new StructElement(VALVE_LEVEL_ID, valveLevel.map((nonOptionalvalveLevel) -> new UIntType(nonOptionalvalveLevel)).orElse(new EmptyType()))); return new StructType(values); } @@ -2990,16 +2995,23 @@ public static ValveConfigurationAndControlClusterValveStateChangedEvent decodeTl return null; } Integer valveState = null; + Optional valveLevel = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { if (element.contextTagNum() == VALVE_STATE_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); valveState = castingValue.value(Integer.class); } + } else if (element.contextTagNum() == VALVE_LEVEL_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + valveLevel = Optional.of(castingValue.value(Integer.class)); + } } } return new ValveConfigurationAndControlClusterValveStateChangedEvent( - valveState + valveState, + valveLevel ); } @@ -3010,6 +3022,9 @@ public String toString() { output.append("\tvalveState: "); output.append(valveState); output.append("\n"); + output.append("\tvalveLevel: "); + output.append(valveLevel); + output.append("\n"); output.append("}\n"); return output.toString(); } diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java index 0762d4168da6f5..13d1cbc830bc44 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java @@ -8900,14 +8900,14 @@ public long getID() { public enum Attribute { OpenDuration(0L), - AutoCloseTime(1L), - RemainingDuration(2L), - CurrentState(3L), - TargetState(4L), - StartUpState(5L), + DefaultOpenDuration(1L), + AutoCloseTime(2L), + RemainingDuration(3L), + CurrentState(4L), + TargetState(5L), CurrentLevel(6L), TargetLevel(7L), - OpenLevel(8L), + DefaultOpenLevel(8L), ValveFault(9L), GeneratedCommandList(65528L), AcceptedCommandList(65529L), @@ -8958,8 +8958,7 @@ public static Event value(long id) throws NoSuchFieldError { public enum Command { Open(0L), - Close(1L), - SetLevel(2L),; + Close(1L),; private final long id; Command(long id) { this.id = id; @@ -8977,7 +8976,7 @@ public static Command value(long id) throws NoSuchFieldError { } throw new NoSuchFieldError(); } - }public enum OpenCommandField {OpenDuration(0),; + }public enum OpenCommandField {OpenDuration(0),TargetLevel(1),; private final int id; OpenCommandField(int id) { this.id = id; @@ -8994,23 +8993,6 @@ public static OpenCommandField value(int id) throws NoSuchFieldError { } throw new NoSuchFieldError(); } - }public enum SetLevelCommandField {Level(0),OpenDuration(1),; - private final int id; - SetLevelCommandField(int id) { - this.id = id; - } - - public int getID() { - return id; - } - public static SetLevelCommandField value(int id) throws NoSuchFieldError { - for (SetLevelCommandField field : SetLevelCommandField.values()) { - if (field.getID() == id) { - return field; - } - } - throw new NoSuchFieldError(); - } }@Override public String getAttributeName(long id) throws NoSuchFieldError { return Attribute.value(id).toString(); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java index 27b051c993d5f5..6dd356409f9347 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java @@ -9777,7 +9777,7 @@ public void onError(Exception ex) { } } - public static class DelegatedValveConfigurationAndControlClusterAutoCloseTimeAttributeCallback implements ChipClusters.ValveConfigurationAndControlCluster.AutoCloseTimeAttributeCallback, DelegatedClusterCallback { + public static class DelegatedValveConfigurationAndControlClusterDefaultOpenDurationAttributeCallback implements ChipClusters.ValveConfigurationAndControlCluster.DefaultOpenDurationAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -9798,7 +9798,7 @@ public void onError(Exception ex) { } } - public static class DelegatedValveConfigurationAndControlClusterRemainingDurationAttributeCallback implements ChipClusters.ValveConfigurationAndControlCluster.RemainingDurationAttributeCallback, DelegatedClusterCallback { + public static class DelegatedValveConfigurationAndControlClusterAutoCloseTimeAttributeCallback implements ChipClusters.ValveConfigurationAndControlCluster.AutoCloseTimeAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -9819,7 +9819,7 @@ public void onError(Exception ex) { } } - public static class DelegatedValveConfigurationAndControlClusterCurrentStateAttributeCallback implements ChipClusters.ValveConfigurationAndControlCluster.CurrentStateAttributeCallback, DelegatedClusterCallback { + public static class DelegatedValveConfigurationAndControlClusterRemainingDurationAttributeCallback implements ChipClusters.ValveConfigurationAndControlCluster.RemainingDurationAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -9827,9 +9827,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(@Nullable Integer value) { + public void onSuccess(@Nullable Long value) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Integer"); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long"); responseValues.put(commandResponseInfo, value); callback.onSuccess(responseValues); } @@ -9840,7 +9840,7 @@ public void onError(Exception ex) { } } - public static class DelegatedValveConfigurationAndControlClusterTargetStateAttributeCallback implements ChipClusters.ValveConfigurationAndControlCluster.TargetStateAttributeCallback, DelegatedClusterCallback { + public static class DelegatedValveConfigurationAndControlClusterCurrentStateAttributeCallback implements ChipClusters.ValveConfigurationAndControlCluster.CurrentStateAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -9861,7 +9861,7 @@ public void onError(Exception ex) { } } - public static class DelegatedValveConfigurationAndControlClusterCurrentLevelAttributeCallback implements ChipClusters.ValveConfigurationAndControlCluster.CurrentLevelAttributeCallback, DelegatedClusterCallback { + public static class DelegatedValveConfigurationAndControlClusterTargetStateAttributeCallback implements ChipClusters.ValveConfigurationAndControlCluster.TargetStateAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -9882,7 +9882,7 @@ public void onError(Exception ex) { } } - public static class DelegatedValveConfigurationAndControlClusterTargetLevelAttributeCallback implements ChipClusters.ValveConfigurationAndControlCluster.TargetLevelAttributeCallback, DelegatedClusterCallback { + public static class DelegatedValveConfigurationAndControlClusterCurrentLevelAttributeCallback implements ChipClusters.ValveConfigurationAndControlCluster.CurrentLevelAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -9903,7 +9903,7 @@ public void onError(Exception ex) { } } - public static class DelegatedValveConfigurationAndControlClusterOpenLevelAttributeCallback implements ChipClusters.ValveConfigurationAndControlCluster.OpenLevelAttributeCallback, DelegatedClusterCallback { + public static class DelegatedValveConfigurationAndControlClusterTargetLevelAttributeCallback implements ChipClusters.ValveConfigurationAndControlCluster.TargetLevelAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -22627,12 +22627,17 @@ public Map> getCommandMap() { CommandParameterInfo valveConfigurationAndControlopenopenDurationCommandParameterInfo = new CommandParameterInfo("openDuration", Optional.class, Long.class); valveConfigurationAndControlopenCommandParams.put("openDuration",valveConfigurationAndControlopenopenDurationCommandParameterInfo); + + CommandParameterInfo valveConfigurationAndControlopentargetLevelCommandParameterInfo = new CommandParameterInfo("targetLevel", Optional.class, Integer.class); + valveConfigurationAndControlopenCommandParams.put("targetLevel",valveConfigurationAndControlopentargetLevelCommandParameterInfo); InteractionInfo valveConfigurationAndControlopenInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ValveConfigurationAndControlCluster) cluster) .open((DefaultClusterCallback) callback , (Optional) commandArguments.get("openDuration") + , (Optional) + commandArguments.get("targetLevel") ); }, () -> new DelegatedDefaultClusterCallback(), @@ -22652,28 +22657,6 @@ public Map> getCommandMap() { ); valveConfigurationAndControlClusterInteractionInfoMap.put("close", valveConfigurationAndControlcloseInteractionInfo); - Map valveConfigurationAndControlsetLevelCommandParams = new LinkedHashMap(); - - CommandParameterInfo valveConfigurationAndControlsetLevellevelCommandParameterInfo = new CommandParameterInfo("level", Integer.class, Integer.class); - valveConfigurationAndControlsetLevelCommandParams.put("level",valveConfigurationAndControlsetLevellevelCommandParameterInfo); - - CommandParameterInfo valveConfigurationAndControlsetLevelopenDurationCommandParameterInfo = new CommandParameterInfo("openDuration", Optional.class, Long.class); - valveConfigurationAndControlsetLevelCommandParams.put("openDuration",valveConfigurationAndControlsetLevelopenDurationCommandParameterInfo); - InteractionInfo valveConfigurationAndControlsetLevelInteractionInfo = new InteractionInfo( - (cluster, callback, commandArguments) -> { - ((ChipClusters.ValveConfigurationAndControlCluster) cluster) - .setLevel((DefaultClusterCallback) callback - , (Integer) - commandArguments.get("level") - , (Optional) - commandArguments.get("openDuration") - ); - }, - () -> new DelegatedDefaultClusterCallback(), - valveConfigurationAndControlsetLevelCommandParams - ); - valveConfigurationAndControlClusterInteractionInfoMap.put("setLevel", valveConfigurationAndControlsetLevelInteractionInfo); - commandMap.put("valveConfigurationAndControl", valveConfigurationAndControlClusterInteractionInfoMap); Map electricalEnergyMeasurementClusterInteractionInfoMap = 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 fecf9c31d761ee..3097d8bc524e25 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java @@ -8763,6 +8763,17 @@ private static Map readValveConfigurationAndControlInte readValveConfigurationAndControlOpenDurationCommandParams ); result.put("readOpenDurationAttribute", readValveConfigurationAndControlOpenDurationAttributeInteractionInfo); + Map readValveConfigurationAndControlDefaultOpenDurationCommandParams = new LinkedHashMap(); + InteractionInfo readValveConfigurationAndControlDefaultOpenDurationAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ValveConfigurationAndControlCluster) cluster).readDefaultOpenDurationAttribute( + (ChipClusters.ValveConfigurationAndControlCluster.DefaultOpenDurationAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedValveConfigurationAndControlClusterDefaultOpenDurationAttributeCallback(), + readValveConfigurationAndControlDefaultOpenDurationCommandParams + ); + result.put("readDefaultOpenDurationAttribute", readValveConfigurationAndControlDefaultOpenDurationAttributeInteractionInfo); Map readValveConfigurationAndControlAutoCloseTimeCommandParams = new LinkedHashMap(); InteractionInfo readValveConfigurationAndControlAutoCloseTimeAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8807,17 +8818,6 @@ private static Map readValveConfigurationAndControlInte readValveConfigurationAndControlTargetStateCommandParams ); result.put("readTargetStateAttribute", readValveConfigurationAndControlTargetStateAttributeInteractionInfo); - Map readValveConfigurationAndControlStartUpStateCommandParams = new LinkedHashMap(); - InteractionInfo readValveConfigurationAndControlStartUpStateAttributeInteractionInfo = new InteractionInfo( - (cluster, callback, commandArguments) -> { - ((ChipClusters.ValveConfigurationAndControlCluster) cluster).readStartUpStateAttribute( - (ChipClusters.IntegerAttributeCallback) callback - ); - }, - () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), - readValveConfigurationAndControlStartUpStateCommandParams - ); - result.put("readStartUpStateAttribute", readValveConfigurationAndControlStartUpStateAttributeInteractionInfo); Map readValveConfigurationAndControlCurrentLevelCommandParams = new LinkedHashMap(); InteractionInfo readValveConfigurationAndControlCurrentLevelAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -8840,17 +8840,17 @@ private static Map readValveConfigurationAndControlInte readValveConfigurationAndControlTargetLevelCommandParams ); result.put("readTargetLevelAttribute", readValveConfigurationAndControlTargetLevelAttributeInteractionInfo); - Map readValveConfigurationAndControlOpenLevelCommandParams = new LinkedHashMap(); - InteractionInfo readValveConfigurationAndControlOpenLevelAttributeInteractionInfo = new InteractionInfo( + Map readValveConfigurationAndControlDefaultOpenLevelCommandParams = new LinkedHashMap(); + InteractionInfo readValveConfigurationAndControlDefaultOpenLevelAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { - ((ChipClusters.ValveConfigurationAndControlCluster) cluster).readOpenLevelAttribute( - (ChipClusters.ValveConfigurationAndControlCluster.OpenLevelAttributeCallback) callback + ((ChipClusters.ValveConfigurationAndControlCluster) cluster).readDefaultOpenLevelAttribute( + (ChipClusters.IntegerAttributeCallback) callback ); }, - () -> new ClusterInfoMapping.DelegatedValveConfigurationAndControlClusterOpenLevelAttributeCallback(), - readValveConfigurationAndControlOpenLevelCommandParams + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readValveConfigurationAndControlDefaultOpenLevelCommandParams ); - result.put("readOpenLevelAttribute", readValveConfigurationAndControlOpenLevelAttributeInteractionInfo); + result.put("readDefaultOpenLevelAttribute", readValveConfigurationAndControlDefaultOpenLevelAttributeInteractionInfo); Map readValveConfigurationAndControlValveFaultCommandParams = new LinkedHashMap(); InteractionInfo readValveConfigurationAndControlValveFaultAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java index 5c6174336ce03a..d7041fdfb34747 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java @@ -1211,72 +1211,28 @@ public Map> getWriteAttributeMap() { writeBooleanSensorConfigurationInteractionInfo.put("writeAlarmsEnabledAttribute", writeBooleanSensorConfigurationAlarmsEnabledAttributeInteractionInfo); writeAttributeMap.put("booleanSensorConfiguration", writeBooleanSensorConfigurationInteractionInfo); Map writeValveConfigurationAndControlInteractionInfo = new LinkedHashMap<>(); - Map writeValveConfigurationAndControlOpenDurationCommandParams = new LinkedHashMap(); - CommandParameterInfo valveConfigurationAndControlopenDurationCommandParameterInfo = - new CommandParameterInfo( - "value", - Long.class, - Long.class - ); - writeValveConfigurationAndControlOpenDurationCommandParams.put( - "value", - valveConfigurationAndControlopenDurationCommandParameterInfo - ); - InteractionInfo writeValveConfigurationAndControlOpenDurationAttributeInteractionInfo = new InteractionInfo( - (cluster, callback, commandArguments) -> { - ((ChipClusters.ValveConfigurationAndControlCluster) cluster).writeOpenDurationAttribute( - (DefaultClusterCallback) callback, - (Long) commandArguments.get("value") - ); - }, - () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), - writeValveConfigurationAndControlOpenDurationCommandParams - ); - writeValveConfigurationAndControlInteractionInfo.put("writeOpenDurationAttribute", writeValveConfigurationAndControlOpenDurationAttributeInteractionInfo); - Map writeValveConfigurationAndControlStartUpStateCommandParams = new LinkedHashMap(); - CommandParameterInfo valveConfigurationAndControlstartUpStateCommandParameterInfo = - new CommandParameterInfo( - "value", - Integer.class, - Integer.class - ); - writeValveConfigurationAndControlStartUpStateCommandParams.put( - "value", - valveConfigurationAndControlstartUpStateCommandParameterInfo - ); - InteractionInfo writeValveConfigurationAndControlStartUpStateAttributeInteractionInfo = new InteractionInfo( - (cluster, callback, commandArguments) -> { - ((ChipClusters.ValveConfigurationAndControlCluster) cluster).writeStartUpStateAttribute( - (DefaultClusterCallback) callback, - (Integer) commandArguments.get("value") - ); - }, - () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), - writeValveConfigurationAndControlStartUpStateCommandParams - ); - writeValveConfigurationAndControlInteractionInfo.put("writeStartUpStateAttribute", writeValveConfigurationAndControlStartUpStateAttributeInteractionInfo); - Map writeValveConfigurationAndControlOpenLevelCommandParams = new LinkedHashMap(); - CommandParameterInfo valveConfigurationAndControlopenLevelCommandParameterInfo = + Map writeValveConfigurationAndControlDefaultOpenLevelCommandParams = new LinkedHashMap(); + CommandParameterInfo valveConfigurationAndControldefaultOpenLevelCommandParameterInfo = new CommandParameterInfo( "value", Integer.class, Integer.class ); - writeValveConfigurationAndControlOpenLevelCommandParams.put( + writeValveConfigurationAndControlDefaultOpenLevelCommandParams.put( "value", - valveConfigurationAndControlopenLevelCommandParameterInfo + valveConfigurationAndControldefaultOpenLevelCommandParameterInfo ); - InteractionInfo writeValveConfigurationAndControlOpenLevelAttributeInteractionInfo = new InteractionInfo( + InteractionInfo writeValveConfigurationAndControlDefaultOpenLevelAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { - ((ChipClusters.ValveConfigurationAndControlCluster) cluster).writeOpenLevelAttribute( + ((ChipClusters.ValveConfigurationAndControlCluster) cluster).writeDefaultOpenLevelAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value") ); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), - writeValveConfigurationAndControlOpenLevelCommandParams + writeValveConfigurationAndControlDefaultOpenLevelCommandParams ); - writeValveConfigurationAndControlInteractionInfo.put("writeOpenLevelAttribute", writeValveConfigurationAndControlOpenLevelAttributeInteractionInfo); + writeValveConfigurationAndControlInteractionInfo.put("writeDefaultOpenLevelAttribute", writeValveConfigurationAndControlDefaultOpenLevelAttributeInteractionInfo); writeAttributeMap.put("valveConfigurationAndControl", writeValveConfigurationAndControlInteractionInfo); Map writeElectricalEnergyMeasurementInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("electricalEnergyMeasurement", writeElectricalEnergyMeasurementInteractionInfo); diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ValveConfigurationAndControlClusterValveStateChangedEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ValveConfigurationAndControlClusterValveStateChangedEvent.kt index d015f73b2e61b5..e34e14aee60c7d 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ValveConfigurationAndControlClusterValveStateChangedEvent.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ValveConfigurationAndControlClusterValveStateChangedEvent.kt @@ -17,15 +17,20 @@ 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 ValveConfigurationAndControlClusterValveStateChangedEvent(val valveState: UInt) { +class ValveConfigurationAndControlClusterValveStateChangedEvent( + val valveState: UInt, + val valveLevel: Optional +) { override fun toString(): String = buildString { append("ValveConfigurationAndControlClusterValveStateChangedEvent {\n") append("\tvalveState : $valveState\n") + append("\tvalveLevel : $valveLevel\n") append("}\n") } @@ -33,12 +38,17 @@ class ValveConfigurationAndControlClusterValveStateChangedEvent(val valveState: tlvWriter.apply { startStructure(tlvTag) put(ContextSpecificTag(TAG_VALVE_STATE), valveState) + if (valveLevel.isPresent) { + val optvalveLevel = valveLevel.get() + put(ContextSpecificTag(TAG_VALVE_LEVEL), optvalveLevel) + } endStructure() } } companion object { private const val TAG_VALVE_STATE = 0 + private const val TAG_VALVE_LEVEL = 1 fun fromTlv( tlvTag: Tag, @@ -46,10 +56,16 @@ class ValveConfigurationAndControlClusterValveStateChangedEvent(val valveState: ): ValveConfigurationAndControlClusterValveStateChangedEvent { tlvReader.enterStructure(tlvTag) val valveState = tlvReader.getUInt(ContextSpecificTag(TAG_VALVE_STATE)) + val valveLevel = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALVE_LEVEL))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_VALVE_LEVEL))) + } else { + Optional.empty() + } tlvReader.exitContainer() - return ValveConfigurationAndControlClusterValveStateChangedEvent(valveState) + return ValveConfigurationAndControlClusterValveStateChangedEvent(valveState, valveLevel) } } } diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/ValveConfigurationAndControlCluster.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/ValveConfigurationAndControlCluster.kt index e4f6af0b20c0f2..96939494e08bd1 100644 --- a/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/ValveConfigurationAndControlCluster.kt +++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/ValveConfigurationAndControlCluster.kt @@ -35,6 +35,8 @@ class ValveConfigurationAndControlCluster( ) { class OpenDurationAttribute(val value: UInt?) + class DefaultOpenDurationAttribute(val value: UInt?) + class AutoCloseTimeAttribute(val value: ULong?) class RemainingDurationAttribute(val value: UInt?) @@ -47,8 +49,6 @@ class ValveConfigurationAndControlCluster( class TargetLevelAttribute(val value: UByte?) - class OpenLevelAttribute(val value: UByte?) - class GeneratedCommandListAttribute(val value: List) class AcceptedCommandListAttribute(val value: List) @@ -57,7 +57,7 @@ class ValveConfigurationAndControlCluster( class AttributeListAttribute(val value: List) - suspend fun open(openDuration: UInt?, timedInvokeTimeoutMs: Int? = null) { + suspend fun open(openDuration: UInt?, targetLevel: UByte?, timedInvokeTimeoutMs: Int? = null) { val commandId: UInt = 0u val timeoutMs: Duration = timedInvokeTimeoutMs?.let { Duration.ofMillis(it.toLong()) } ?: Duration.ZERO @@ -67,6 +67,9 @@ class ValveConfigurationAndControlCluster( val TAG_OPEN_DURATION_REQ: Int = 0 openDuration?.let { tlvWriter.put(ContextSpecificTag(TAG_OPEN_DURATION_REQ), openDuration) } + + val TAG_TARGET_LEVEL_REQ: Int = 1 + targetLevel?.let { tlvWriter.put(ContextSpecificTag(TAG_TARGET_LEVEL_REQ), targetLevel) } tlvWriter.endStructure() val request: InvokeRequest = @@ -100,32 +103,6 @@ class ValveConfigurationAndControlCluster( logger.log(Level.FINE, "Invoke command succeeded: ${response}") } - suspend fun setLevel(level: UByte, openDuration: UInt?, timedInvokeTimeoutMs: Int? = null) { - val commandId: UInt = 2u - val timeoutMs: Duration = - timedInvokeTimeoutMs?.let { Duration.ofMillis(it.toLong()) } ?: Duration.ZERO - - val tlvWriter = TlvWriter() - tlvWriter.startStructure(AnonymousTag) - - val TAG_LEVEL_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_LEVEL_REQ), level) - - val TAG_OPEN_DURATION_REQ: Int = 1 - openDuration?.let { tlvWriter.put(ContextSpecificTag(TAG_OPEN_DURATION_REQ), openDuration) } - tlvWriter.endStructure() - - val request: InvokeRequest = - InvokeRequest( - CommandPath(endpointId, clusterId = CLUSTER_ID, commandId), - tlvPayload = tlvWriter.getEncoded(), - timedRequest = timeoutMs - ) - - val response: InvokeResponse = controller.invoke(request) - logger.log(Level.FINE, "Invoke command succeeded: ${response}") - } - suspend fun readOpenDurationAttribute(): OpenDurationAttribute { val ATTRIBUTE_ID: UInt = 0u @@ -163,49 +140,7 @@ class ValveConfigurationAndControlCluster( return OpenDurationAttribute(decodedValue) } - suspend fun writeOpenDurationAttribute(value: UInt, timedWriteTimeoutMs: Int? = null) { - val ATTRIBUTE_ID: UInt = 0u - val timeoutMs: Duration = - timedWriteTimeoutMs?.let { Duration.ofMillis(it.toLong()) } ?: Duration.ZERO - - val tlvWriter = TlvWriter() - tlvWriter.put(AnonymousTag, value) - - val writeRequests: WriteRequests = - WriteRequests( - requests = - listOf( - WriteRequest( - attributePath = - AttributePath(endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID), - tlvPayload = tlvWriter.getEncoded() - ) - ), - timedRequest = timeoutMs - ) - - val response: WriteResponse = controller.write(writeRequests) - - when (response) { - is WriteResponse.Success -> { - logger.log(Level.FINE, "Write command succeeded") - } - is WriteResponse.PartialWriteFailure -> { - val aggregatedErrorMessage = - response.failures.joinToString("\n") { failure -> - "Error at ${failure.attributePath}: ${failure.ex.message}" - } - - response.failures.forEach { failure -> - logger.log(Level.WARNING, "Error at ${failure.attributePath}: ${failure.ex.message}") - } - - throw IllegalStateException("Write command failed with errors: \n$aggregatedErrorMessage") - } - } - } - - suspend fun readAutoCloseTimeAttribute(): AutoCloseTimeAttribute { + suspend fun readDefaultOpenDurationAttribute(): DefaultOpenDurationAttribute { val ATTRIBUTE_ID: UInt = 1u val attributePath = @@ -227,26 +162,22 @@ class ValveConfigurationAndControlCluster( it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { "Autoclosetime attribute not found in response" } + requireNotNull(attributeData) { "Defaultopenduration attribute not found in response" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: ULong? = + val decodedValue: UInt? = if (!tlvReader.isNull()) { - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getULong(AnonymousTag) - } else { - null - } + tlvReader.getUInt(AnonymousTag) } else { tlvReader.getNull(AnonymousTag) null } - return AutoCloseTimeAttribute(decodedValue) + return DefaultOpenDurationAttribute(decodedValue) } - suspend fun readRemainingDurationAttribute(): RemainingDurationAttribute { + suspend fun readAutoCloseTimeAttribute(): AutoCloseTimeAttribute { val ATTRIBUTE_ID: UInt = 2u val attributePath = @@ -268,14 +199,14 @@ class ValveConfigurationAndControlCluster( it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { "Remainingduration attribute not found in response" } + requireNotNull(attributeData) { "Autoclosetime attribute not found in response" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: UInt? = + val decodedValue: ULong? = if (!tlvReader.isNull()) { if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getUInt(AnonymousTag) + tlvReader.getULong(AnonymousTag) } else { null } @@ -284,10 +215,10 @@ class ValveConfigurationAndControlCluster( null } - return RemainingDurationAttribute(decodedValue) + return AutoCloseTimeAttribute(decodedValue) } - suspend fun readCurrentStateAttribute(): CurrentStateAttribute { + suspend fun readRemainingDurationAttribute(): RemainingDurationAttribute { val ATTRIBUTE_ID: UInt = 3u val attributePath = @@ -309,22 +240,22 @@ class ValveConfigurationAndControlCluster( it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { "Currentstate attribute not found in response" } + requireNotNull(attributeData) { "Remainingduration attribute not found in response" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: UByte? = + val decodedValue: UInt? = if (!tlvReader.isNull()) { - tlvReader.getUByte(AnonymousTag) + tlvReader.getUInt(AnonymousTag) } else { tlvReader.getNull(AnonymousTag) null } - return CurrentStateAttribute(decodedValue) + return RemainingDurationAttribute(decodedValue) } - suspend fun readTargetStateAttribute(): TargetStateAttribute { + suspend fun readCurrentStateAttribute(): CurrentStateAttribute { val ATTRIBUTE_ID: UInt = 4u val attributePath = @@ -346,7 +277,7 @@ class ValveConfigurationAndControlCluster( it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { "Targetstate attribute not found in response" } + requireNotNull(attributeData) { "Currentstate attribute not found in response" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) @@ -358,10 +289,10 @@ class ValveConfigurationAndControlCluster( null } - return TargetStateAttribute(decodedValue) + return CurrentStateAttribute(decodedValue) } - suspend fun readStartUpStateAttribute(): UByte? { + suspend fun readTargetStateAttribute(): TargetStateAttribute { val ATTRIBUTE_ID: UInt = 5u val attributePath = @@ -383,60 +314,19 @@ class ValveConfigurationAndControlCluster( it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { "Startupstate attribute not found in response" } + requireNotNull(attributeData) { "Targetstate attribute not found in response" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) val decodedValue: UByte? = - if (tlvReader.isNextTag(AnonymousTag)) { + if (!tlvReader.isNull()) { tlvReader.getUByte(AnonymousTag) } else { + tlvReader.getNull(AnonymousTag) null } - return decodedValue - } - - suspend fun writeStartUpStateAttribute(value: UByte, timedWriteTimeoutMs: Int? = null) { - val ATTRIBUTE_ID: UInt = 5u - val timeoutMs: Duration = - timedWriteTimeoutMs?.let { Duration.ofMillis(it.toLong()) } ?: Duration.ZERO - - val tlvWriter = TlvWriter() - tlvWriter.put(AnonymousTag, value) - - val writeRequests: WriteRequests = - WriteRequests( - requests = - listOf( - WriteRequest( - attributePath = - AttributePath(endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID), - tlvPayload = tlvWriter.getEncoded() - ) - ), - timedRequest = timeoutMs - ) - - val response: WriteResponse = controller.write(writeRequests) - - when (response) { - is WriteResponse.Success -> { - logger.log(Level.FINE, "Write command succeeded") - } - is WriteResponse.PartialWriteFailure -> { - val aggregatedErrorMessage = - response.failures.joinToString("\n") { failure -> - "Error at ${failure.attributePath}: ${failure.ex.message}" - } - - response.failures.forEach { failure -> - logger.log(Level.WARNING, "Error at ${failure.attributePath}: ${failure.ex.message}") - } - - throw IllegalStateException("Write command failed with errors: \n$aggregatedErrorMessage") - } - } + return TargetStateAttribute(decodedValue) } suspend fun readCurrentLevelAttribute(): CurrentLevelAttribute { @@ -521,7 +411,7 @@ class ValveConfigurationAndControlCluster( return TargetLevelAttribute(decodedValue) } - suspend fun readOpenLevelAttribute(): OpenLevelAttribute { + suspend fun readDefaultOpenLevelAttribute(): UByte? { val ATTRIBUTE_ID: UInt = 8u val attributePath = @@ -543,26 +433,21 @@ class ValveConfigurationAndControlCluster( it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { "Openlevel attribute not found in response" } + requireNotNull(attributeData) { "Defaultopenlevel attribute not found in response" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) val decodedValue: UByte? = - if (!tlvReader.isNull()) { - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getUByte(AnonymousTag) - } else { - null - } + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getUByte(AnonymousTag) } else { - tlvReader.getNull(AnonymousTag) null } - return OpenLevelAttribute(decodedValue) + return decodedValue } - suspend fun writeOpenLevelAttribute(value: UByte, timedWriteTimeoutMs: Int? = null) { + suspend fun writeDefaultOpenLevelAttribute(value: UByte, timedWriteTimeoutMs: Int? = null) { val ATTRIBUTE_ID: UInt = 8u val timeoutMs: Duration = timedWriteTimeoutMs?.let { Duration.ofMillis(it.toLong()) } ?: Duration.ZERO diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/ValveConfigurationAndControlClusterValveStateChangedEvent.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/ValveConfigurationAndControlClusterValveStateChangedEvent.kt index d75afd26bd341a..5ef190d6292992 100644 --- a/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/ValveConfigurationAndControlClusterValveStateChangedEvent.kt +++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/ValveConfigurationAndControlClusterValveStateChangedEvent.kt @@ -16,16 +16,21 @@ */ 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 ValveConfigurationAndControlClusterValveStateChangedEvent(val valveState: UByte) { +class ValveConfigurationAndControlClusterValveStateChangedEvent( + val valveState: UByte, + val valveLevel: Optional +) { override fun toString(): String = buildString { append("ValveConfigurationAndControlClusterValveStateChangedEvent {\n") append("\tvalveState : $valveState\n") + append("\tvalveLevel : $valveLevel\n") append("}\n") } @@ -33,12 +38,17 @@ class ValveConfigurationAndControlClusterValveStateChangedEvent(val valveState: tlvWriter.apply { startStructure(tlvTag) put(ContextSpecificTag(TAG_VALVE_STATE), valveState) + if (valveLevel.isPresent) { + val optvalveLevel = valveLevel.get() + put(ContextSpecificTag(TAG_VALVE_LEVEL), optvalveLevel) + } endStructure() } } companion object { private const val TAG_VALVE_STATE = 0 + private const val TAG_VALVE_LEVEL = 1 fun fromTlv( tlvTag: Tag, @@ -46,10 +56,16 @@ class ValveConfigurationAndControlClusterValveStateChangedEvent(val valveState: ): ValveConfigurationAndControlClusterValveStateChangedEvent { tlvReader.enterStructure(tlvTag) val valveState = tlvReader.getUByte(ContextSpecificTag(TAG_VALVE_STATE)) + val valveLevel = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALVE_LEVEL))) { + Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_VALVE_LEVEL))) + } else { + Optional.empty() + } tlvReader.exitContainer() - return ValveConfigurationAndControlClusterValveStateChangedEvent(valveState) + return ValveConfigurationAndControlClusterValveStateChangedEvent(valveState, valveLevel) } } } diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index e87c3ea5961c68..0bd22cb2855524 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -19014,6 +19014,29 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } return value; } + case Attributes::DefaultOpenDuration::Id: { + using TypeInfo = Attributes::DefaultOpenDuration::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + } + return value; + } case Attributes::AutoCloseTime::Id: { using TypeInfo = Attributes::AutoCloseTime::TypeInfo; TypeInfo::DecodableType cppValue; @@ -19106,22 +19129,6 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } return value; } - case Attributes::StartUpState::Id: { - using TypeInfo = Attributes::StartUpState::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::CurrentLevel::Id: { using TypeInfo = Attributes::CurrentLevel::TypeInfo; TypeInfo::DecodableType cppValue; @@ -19168,8 +19175,8 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } return value; } - case Attributes::OpenLevel::Id: { - using TypeInfo = Attributes::OpenLevel::TypeInfo; + case Attributes::DefaultOpenLevel::Id: { + using TypeInfo = Attributes::DefaultOpenLevel::TypeInfo; TypeInfo::DecodableType cppValue; *aError = app::DataModel::Decode(aReader, cppValue); if (*aError != CHIP_NO_ERROR) @@ -19177,18 +19184,11 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR return nullptr; } jobject value; - if (cppValue.IsNull()) - { - value = nullptr; - } - else - { - std::string valueClassName = "java/lang/Integer"; - std::string valueCtorSignature = "(I)V"; - jint jnivalue = static_cast(cppValue.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), - jnivalue, 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::ValveFault::Id: { diff --git a/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp b/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp index c8b407678f3d20..5f1c72a7984125 100644 --- a/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp +++ b/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp @@ -3392,72 +3392,12 @@ JNI_METHOD(void, BooleanSensorConfigurationCluster, writeAlarmsEnabledAttribute) onFailure.release(); } -JNI_METHOD(void, ValveConfigurationAndControlCluster, writeOpenDurationAttribute) +JNI_METHOD(void, ValveConfigurationAndControlCluster, writeDefaultOpenLevelAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { chip::DeviceLayer::StackLock lock; ListFreer listFreer; - using TypeInfo = chip::app::Clusters::ValveConfigurationAndControl::Attributes::OpenDuration::TypeInfo; - TypeInfo::Type cppValue; - - std::vector> cleanupByteArrays; - std::vector> cleanupStrings; - - if (value == nullptr) - { - cppValue.SetNull(); - } - else - { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = static_cast>( - chip::JniReferences::GetInstance().LongToPrimitive(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; - ValveConfigurationAndControlCluster * 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, ValveConfigurationAndControlCluster, writeStartUpStateAttribute) -(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) -{ - chip::DeviceLayer::StackLock lock; - ListFreer listFreer; - using TypeInfo = chip::app::Clusters::ValveConfigurationAndControl::Attributes::StartUpState::TypeInfo; + using TypeInfo = chip::app::Clusters::ValveConfigurationAndControl::Attributes::DefaultOpenLevel::TypeInfo; TypeInfo::Type cppValue; std::vector> cleanupByteArrays; @@ -3504,66 +3444,6 @@ JNI_METHOD(void, ValveConfigurationAndControlCluster, writeStartUpStateAttribute onFailure.release(); } -JNI_METHOD(void, ValveConfigurationAndControlCluster, writeOpenLevelAttribute) -(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) -{ - chip::DeviceLayer::StackLock lock; - ListFreer listFreer; - using TypeInfo = chip::app::Clusters::ValveConfigurationAndControl::Attributes::OpenLevel::TypeInfo; - TypeInfo::Type cppValue; - - std::vector> cleanupByteArrays; - std::vector> cleanupStrings; - - if (value == nullptr) - { - cppValue.SetNull(); - } - else - { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = 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; - ValveConfigurationAndControlCluster * 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, writeDefaultRandomStartAttribute) (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 26bd0d48009066..5666a62e8d0e78 100644 --- a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp @@ -3774,6 +3774,23 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & chip::JniReferences::GetInstance().CreateBoxedObject( value_valveStateClassName.c_str(), value_valveStateCtorSignature.c_str(), jnivalue_valveState, value_valveState); + jobject value_valveLevel; + if (!cppValue.valveLevel.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_valveLevel); + } + else + { + jobject value_valveLevelInsideOptional; + std::string value_valveLevelInsideOptionalClassName = "java/lang/Integer"; + std::string value_valveLevelInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_valveLevelInsideOptional = static_cast(cppValue.valveLevel.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_valveLevelInsideOptionalClassName.c_str(), value_valveLevelInsideOptionalCtorSignature.c_str(), + jnivalue_valveLevelInsideOptional, value_valveLevelInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_valveLevelInsideOptional, value_valveLevel); + } + jclass valveStateChangedStructClass; err = chip::JniReferences::GetInstance().GetClassRef( env, "chip/devicecontroller/ChipEventStructs$ValveConfigurationAndControlClusterValveStateChangedEvent", @@ -3785,7 +3802,7 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & return nullptr; } jmethodID valveStateChangedStructCtor = - env->GetMethodID(valveStateChangedStructClass, "", "(Ljava/lang/Integer;)V"); + env->GetMethodID(valveStateChangedStructClass, "", "(Ljava/lang/Integer;Ljava/util/Optional;)V"); if (valveStateChangedStructCtor == nullptr) { ChipLogError( @@ -3793,7 +3810,8 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & return nullptr; } - jobject value = env->NewObject(valveStateChangedStructClass, valveStateChangedStructCtor, value_valveState); + jobject value = + env->NewObject(valveStateChangedStructClass, valveStateChangedStructCtor, value_valveState, value_valveLevel); return value; } diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp index 630984be29b0a7..8f8233e8df0d4d 100644 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp @@ -30081,9 +30081,9 @@ void CHIPValveConfigurationAndControlOpenDurationAttributeCallback::CallbackFn( env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } -CHIPValveConfigurationAndControlAutoCloseTimeAttributeCallback::CHIPValveConfigurationAndControlAutoCloseTimeAttributeCallback( - jobject javaCallback, bool keepAlive) : - chip::Callback::Callback(CallbackFn, this), +CHIPValveConfigurationAndControlDefaultOpenDurationAttributeCallback:: +CHIPValveConfigurationAndControlDefaultOpenDurationAttributeCallback(jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -30100,7 +30100,8 @@ CHIPValveConfigurationAndControlAutoCloseTimeAttributeCallback::CHIPValveConfigu } } -CHIPValveConfigurationAndControlAutoCloseTimeAttributeCallback::~CHIPValveConfigurationAndControlAutoCloseTimeAttributeCallback() +CHIPValveConfigurationAndControlDefaultOpenDurationAttributeCallback::~ +CHIPValveConfigurationAndControlDefaultOpenDurationAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -30111,8 +30112,8 @@ CHIPValveConfigurationAndControlAutoCloseTimeAttributeCallback::~CHIPValveConfig env->DeleteGlobalRef(javaCallbackRef); } -void CHIPValveConfigurationAndControlAutoCloseTimeAttributeCallback::CallbackFn( - void * context, const chip::app::DataModel::Nullable & value) +void CHIPValveConfigurationAndControlDefaultOpenDurationAttributeCallback::CallbackFn( + void * context, const chip::app::DataModel::Nullable & value) { chip::DeviceLayer::StackUnlock unlock; CHIP_ERROR err = CHIP_NO_ERROR; @@ -30120,8 +30121,8 @@ void CHIPValveConfigurationAndControlAutoCloseTimeAttributeCallback::CallbackFn( jobject javaCallbackRef; VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); - std::unique_ptr cppCallback( - reinterpret_cast(context), maybeDestroy); + 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; @@ -30149,9 +30150,9 @@ void CHIPValveConfigurationAndControlAutoCloseTimeAttributeCallback::CallbackFn( env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } -CHIPValveConfigurationAndControlRemainingDurationAttributeCallback:: -CHIPValveConfigurationAndControlRemainingDurationAttributeCallback(jobject javaCallback, bool keepAlive) : - chip::Callback::Callback(CallbackFn, this), +CHIPValveConfigurationAndControlAutoCloseTimeAttributeCallback::CHIPValveConfigurationAndControlAutoCloseTimeAttributeCallback( + jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -30168,8 +30169,7 @@ CHIPValveConfigurationAndControlRemainingDurationAttributeCallback(jobject javaC } } -CHIPValveConfigurationAndControlRemainingDurationAttributeCallback::~ -CHIPValveConfigurationAndControlRemainingDurationAttributeCallback() +CHIPValveConfigurationAndControlAutoCloseTimeAttributeCallback::~CHIPValveConfigurationAndControlAutoCloseTimeAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -30180,8 +30180,8 @@ CHIPValveConfigurationAndControlRemainingDurationAttributeCallback() env->DeleteGlobalRef(javaCallbackRef); } -void CHIPValveConfigurationAndControlRemainingDurationAttributeCallback::CallbackFn( - void * context, const chip::app::DataModel::Nullable & value) +void CHIPValveConfigurationAndControlAutoCloseTimeAttributeCallback::CallbackFn( + void * context, const chip::app::DataModel::Nullable & value) { chip::DeviceLayer::StackUnlock unlock; CHIP_ERROR err = CHIP_NO_ERROR; @@ -30189,8 +30189,8 @@ void CHIPValveConfigurationAndControlRemainingDurationAttributeCallback::Callbac jobject javaCallbackRef; VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); - std::unique_ptr cppCallback( - reinterpret_cast(context), maybeDestroy); + 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; @@ -30218,9 +30218,9 @@ void CHIPValveConfigurationAndControlRemainingDurationAttributeCallback::Callbac env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } -CHIPValveConfigurationAndControlCurrentStateAttributeCallback::CHIPValveConfigurationAndControlCurrentStateAttributeCallback( - jobject javaCallback, bool keepAlive) : - chip::Callback::Callback(CallbackFn, this), +CHIPValveConfigurationAndControlRemainingDurationAttributeCallback:: +CHIPValveConfigurationAndControlRemainingDurationAttributeCallback(jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -30237,7 +30237,8 @@ CHIPValveConfigurationAndControlCurrentStateAttributeCallback::CHIPValveConfigur } } -CHIPValveConfigurationAndControlCurrentStateAttributeCallback::~CHIPValveConfigurationAndControlCurrentStateAttributeCallback() +CHIPValveConfigurationAndControlRemainingDurationAttributeCallback::~ +CHIPValveConfigurationAndControlRemainingDurationAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -30248,8 +30249,8 @@ CHIPValveConfigurationAndControlCurrentStateAttributeCallback::~CHIPValveConfigu env->DeleteGlobalRef(javaCallbackRef); } -void CHIPValveConfigurationAndControlCurrentStateAttributeCallback::CallbackFn( - void * context, const chip::app::DataModel::Nullable & value) +void CHIPValveConfigurationAndControlRemainingDurationAttributeCallback::CallbackFn( + void * context, const chip::app::DataModel::Nullable & value) { chip::DeviceLayer::StackUnlock unlock; CHIP_ERROR err = CHIP_NO_ERROR; @@ -30257,8 +30258,8 @@ void CHIPValveConfigurationAndControlCurrentStateAttributeCallback::CallbackFn( jobject javaCallbackRef; VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); - std::unique_ptr cppCallback( - reinterpret_cast(context), maybeDestroy); + 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; @@ -30266,7 +30267,7 @@ void CHIPValveConfigurationAndControlCurrentStateAttributeCallback::CallbackFn( ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); jmethodID javaMethod; - err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/Integer;)V", &javaMethod); + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/Long;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); jobject javaValue; @@ -30276,19 +30277,19 @@ void CHIPValveConfigurationAndControlCurrentStateAttributeCallback::CallbackFn( } else { - std::string javaValueClassName = "java/lang/Integer"; - std::string javaValueCtorSignature = "(I)V"; - jint jnijavaValue = static_cast(value.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - jnijavaValue, javaValue); + std::string javaValueClassName = "java/lang/Long"; + std::string javaValueCtorSignature = "(J)V"; + jlong jnijavaValue = static_cast(value.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + jnijavaValue, javaValue); } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } -CHIPValveConfigurationAndControlTargetStateAttributeCallback::CHIPValveConfigurationAndControlTargetStateAttributeCallback( +CHIPValveConfigurationAndControlCurrentStateAttributeCallback::CHIPValveConfigurationAndControlCurrentStateAttributeCallback( jobject javaCallback, bool keepAlive) : - chip::Callback::Callback(CallbackFn, this), + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -30305,7 +30306,7 @@ CHIPValveConfigurationAndControlTargetStateAttributeCallback::CHIPValveConfigura } } -CHIPValveConfigurationAndControlTargetStateAttributeCallback::~CHIPValveConfigurationAndControlTargetStateAttributeCallback() +CHIPValveConfigurationAndControlCurrentStateAttributeCallback::~CHIPValveConfigurationAndControlCurrentStateAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -30316,7 +30317,7 @@ CHIPValveConfigurationAndControlTargetStateAttributeCallback::~CHIPValveConfigur env->DeleteGlobalRef(javaCallbackRef); } -void CHIPValveConfigurationAndControlTargetStateAttributeCallback::CallbackFn( +void CHIPValveConfigurationAndControlCurrentStateAttributeCallback::CallbackFn( void * context, const chip::app::DataModel::Nullable & value) { chip::DeviceLayer::StackUnlock unlock; @@ -30325,8 +30326,8 @@ void CHIPValveConfigurationAndControlTargetStateAttributeCallback::CallbackFn( jobject javaCallbackRef; VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); - std::unique_ptr cppCallback( - reinterpret_cast(context), maybeDestroy); + 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; @@ -30354,9 +30355,9 @@ void CHIPValveConfigurationAndControlTargetStateAttributeCallback::CallbackFn( env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } -CHIPValveConfigurationAndControlCurrentLevelAttributeCallback::CHIPValveConfigurationAndControlCurrentLevelAttributeCallback( +CHIPValveConfigurationAndControlTargetStateAttributeCallback::CHIPValveConfigurationAndControlTargetStateAttributeCallback( jobject javaCallback, bool keepAlive) : - chip::Callback::Callback(CallbackFn, this), + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -30373,7 +30374,7 @@ CHIPValveConfigurationAndControlCurrentLevelAttributeCallback::CHIPValveConfigur } } -CHIPValveConfigurationAndControlCurrentLevelAttributeCallback::~CHIPValveConfigurationAndControlCurrentLevelAttributeCallback() +CHIPValveConfigurationAndControlTargetStateAttributeCallback::~CHIPValveConfigurationAndControlTargetStateAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -30384,8 +30385,8 @@ CHIPValveConfigurationAndControlCurrentLevelAttributeCallback::~CHIPValveConfigu env->DeleteGlobalRef(javaCallbackRef); } -void CHIPValveConfigurationAndControlCurrentLevelAttributeCallback::CallbackFn( - void * context, const chip::app::DataModel::Nullable & value) +void CHIPValveConfigurationAndControlTargetStateAttributeCallback::CallbackFn( + void * context, const chip::app::DataModel::Nullable & value) { chip::DeviceLayer::StackUnlock unlock; CHIP_ERROR err = CHIP_NO_ERROR; @@ -30393,8 +30394,8 @@ void CHIPValveConfigurationAndControlCurrentLevelAttributeCallback::CallbackFn( jobject javaCallbackRef; VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); - std::unique_ptr cppCallback( - reinterpret_cast(context), maybeDestroy); + 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; @@ -30422,9 +30423,9 @@ void CHIPValveConfigurationAndControlCurrentLevelAttributeCallback::CallbackFn( env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } -CHIPValveConfigurationAndControlTargetLevelAttributeCallback::CHIPValveConfigurationAndControlTargetLevelAttributeCallback( +CHIPValveConfigurationAndControlCurrentLevelAttributeCallback::CHIPValveConfigurationAndControlCurrentLevelAttributeCallback( jobject javaCallback, bool keepAlive) : - chip::Callback::Callback(CallbackFn, this), + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -30441,7 +30442,7 @@ CHIPValveConfigurationAndControlTargetLevelAttributeCallback::CHIPValveConfigura } } -CHIPValveConfigurationAndControlTargetLevelAttributeCallback::~CHIPValveConfigurationAndControlTargetLevelAttributeCallback() +CHIPValveConfigurationAndControlCurrentLevelAttributeCallback::~CHIPValveConfigurationAndControlCurrentLevelAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -30452,7 +30453,7 @@ CHIPValveConfigurationAndControlTargetLevelAttributeCallback::~CHIPValveConfigur env->DeleteGlobalRef(javaCallbackRef); } -void CHIPValveConfigurationAndControlTargetLevelAttributeCallback::CallbackFn( +void CHIPValveConfigurationAndControlCurrentLevelAttributeCallback::CallbackFn( void * context, const chip::app::DataModel::Nullable & value) { chip::DeviceLayer::StackUnlock unlock; @@ -30461,8 +30462,8 @@ void CHIPValveConfigurationAndControlTargetLevelAttributeCallback::CallbackFn( jobject javaCallbackRef; VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); - std::unique_ptr cppCallback( - reinterpret_cast(context), maybeDestroy); + 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; @@ -30490,9 +30491,9 @@ void CHIPValveConfigurationAndControlTargetLevelAttributeCallback::CallbackFn( env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } -CHIPValveConfigurationAndControlOpenLevelAttributeCallback::CHIPValveConfigurationAndControlOpenLevelAttributeCallback( +CHIPValveConfigurationAndControlTargetLevelAttributeCallback::CHIPValveConfigurationAndControlTargetLevelAttributeCallback( jobject javaCallback, bool keepAlive) : - chip::Callback::Callback(CallbackFn, this), + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -30509,7 +30510,7 @@ CHIPValveConfigurationAndControlOpenLevelAttributeCallback::CHIPValveConfigurati } } -CHIPValveConfigurationAndControlOpenLevelAttributeCallback::~CHIPValveConfigurationAndControlOpenLevelAttributeCallback() +CHIPValveConfigurationAndControlTargetLevelAttributeCallback::~CHIPValveConfigurationAndControlTargetLevelAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -30520,7 +30521,7 @@ CHIPValveConfigurationAndControlOpenLevelAttributeCallback::~CHIPValveConfigurat env->DeleteGlobalRef(javaCallbackRef); } -void CHIPValveConfigurationAndControlOpenLevelAttributeCallback::CallbackFn( +void CHIPValveConfigurationAndControlTargetLevelAttributeCallback::CallbackFn( void * context, const chip::app::DataModel::Nullable & value) { chip::DeviceLayer::StackUnlock unlock; @@ -30529,8 +30530,8 @@ void CHIPValveConfigurationAndControlOpenLevelAttributeCallback::CallbackFn( jobject javaCallbackRef; VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); - std::unique_ptr cppCallback( - reinterpret_cast(context), maybeDestroy); + 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; diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index e6a384cd3336a9..85e500f0247a07 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -6221,6 +6221,7 @@ class ChipClusters: "commandName": "Open", "args": { "openDuration": "int", + "targetLevel": "int", }, }, 0x00000001: { @@ -6229,14 +6230,6 @@ class ChipClusters: "args": { }, }, - 0x00000002: { - "commandId": 0x00000002, - "commandName": "SetLevel", - "args": { - "level": "int", - "openDuration": "int", - }, - }, }, "attributes": { 0x00000000: { @@ -6244,38 +6237,36 @@ class ChipClusters: "attributeId": 0x00000000, "type": "int", "reportable": True, - "writable": True, }, 0x00000001: { - "attributeName": "AutoCloseTime", + "attributeName": "DefaultOpenDuration", "attributeId": 0x00000001, "type": "int", "reportable": True, }, 0x00000002: { - "attributeName": "RemainingDuration", + "attributeName": "AutoCloseTime", "attributeId": 0x00000002, "type": "int", "reportable": True, }, 0x00000003: { - "attributeName": "CurrentState", + "attributeName": "RemainingDuration", "attributeId": 0x00000003, "type": "int", "reportable": True, }, 0x00000004: { - "attributeName": "TargetState", + "attributeName": "CurrentState", "attributeId": 0x00000004, "type": "int", "reportable": True, }, 0x00000005: { - "attributeName": "StartUpState", + "attributeName": "TargetState", "attributeId": 0x00000005, "type": "int", "reportable": True, - "writable": True, }, 0x00000006: { "attributeName": "CurrentLevel", @@ -6290,7 +6281,7 @@ class ChipClusters: "reportable": True, }, 0x00000008: { - "attributeName": "OpenLevel", + "attributeName": "DefaultOpenLevel", "attributeId": 0x00000008, "type": "int", "reportable": True, diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index f346a96ecb3785..cc0a579c0b6aa5 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -21761,14 +21761,14 @@ def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ ClusterObjectFieldDescriptor(Label="openDuration", Tag=0x00000000, Type=typing.Union[Nullable, uint]), - ClusterObjectFieldDescriptor(Label="autoCloseTime", Tag=0x00000001, Type=typing.Union[None, Nullable, uint]), - ClusterObjectFieldDescriptor(Label="remainingDuration", Tag=0x00000002, Type=typing.Union[None, Nullable, uint]), - ClusterObjectFieldDescriptor(Label="currentState", Tag=0x00000003, Type=typing.Union[Nullable, ValveConfigurationAndControl.Enums.ValveStateEnum]), - ClusterObjectFieldDescriptor(Label="targetState", Tag=0x00000004, Type=typing.Union[Nullable, ValveConfigurationAndControl.Enums.ValveStateEnum]), - ClusterObjectFieldDescriptor(Label="startUpState", Tag=0x00000005, Type=typing.Optional[ValveConfigurationAndControl.Enums.ValveStateEnum]), + ClusterObjectFieldDescriptor(Label="defaultOpenDuration", Tag=0x00000001, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="autoCloseTime", Tag=0x00000002, Type=typing.Union[None, Nullable, uint]), + ClusterObjectFieldDescriptor(Label="remainingDuration", Tag=0x00000003, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="currentState", Tag=0x00000004, Type=typing.Union[Nullable, ValveConfigurationAndControl.Enums.ValveStateEnum]), + ClusterObjectFieldDescriptor(Label="targetState", Tag=0x00000005, Type=typing.Union[Nullable, ValveConfigurationAndControl.Enums.ValveStateEnum]), ClusterObjectFieldDescriptor(Label="currentLevel", Tag=0x00000006, Type=typing.Union[None, Nullable, uint]), ClusterObjectFieldDescriptor(Label="targetLevel", Tag=0x00000007, Type=typing.Union[None, Nullable, uint]), - ClusterObjectFieldDescriptor(Label="openLevel", Tag=0x00000008, Type=typing.Union[None, Nullable, uint]), + ClusterObjectFieldDescriptor(Label="defaultOpenLevel", Tag=0x00000008, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="valveFault", Tag=0x00000009, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), @@ -21779,14 +21779,14 @@ def descriptor(cls) -> ClusterObjectDescriptor: ]) openDuration: 'typing.Union[Nullable, uint]' = None + defaultOpenDuration: 'typing.Union[Nullable, uint]' = None autoCloseTime: 'typing.Union[None, Nullable, uint]' = None - remainingDuration: 'typing.Union[None, Nullable, uint]' = None + remainingDuration: 'typing.Union[Nullable, uint]' = None currentState: 'typing.Union[Nullable, ValveConfigurationAndControl.Enums.ValveStateEnum]' = None targetState: 'typing.Union[Nullable, ValveConfigurationAndControl.Enums.ValveStateEnum]' = None - startUpState: 'typing.Optional[ValveConfigurationAndControl.Enums.ValveStateEnum]' = None currentLevel: 'typing.Union[None, Nullable, uint]' = None targetLevel: 'typing.Union[None, Nullable, uint]' = None - openLevel: 'typing.Union[None, Nullable, uint]' = None + defaultOpenLevel: 'typing.Optional[uint]' = None valveFault: 'typing.Optional[uint]' = None generatedCommandList: 'typing.List[uint]' = None acceptedCommandList: 'typing.List[uint]' = None @@ -21796,14 +21796,23 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: + class StatusCodeEnum(MatterIntEnum): + kFailureDueToFault = 0x02 + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving and unknown + # enum value. This specific should never be transmitted. + kUnknownEnumValue = 0, + class ValveStateEnum(MatterIntEnum): - kOpen = 0x00 - kClosed = 0x01 + kClosed = 0x00 + kOpen = 0x01 + kTransitioning = 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 = 2, + kUnknownEnumValue = 3, class Bitmaps: class Feature(IntFlag): @@ -21814,6 +21823,9 @@ class ValveFaultBitmap(IntFlag): kGeneralFault = 0x1 kBlocked = 0x2 kLeaking = 0x4 + kNotConnected = 0x8 + kShortCircuit = 0x10 + kCurrentExceeded = 0x20 class Commands: @dataclass @@ -21827,10 +21839,12 @@ class Open(ClusterCommand): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="openDuration", Tag=0, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="openDuration", Tag=0, Type=typing.Union[None, Nullable, uint]), + ClusterObjectFieldDescriptor(Label="targetLevel", Tag=1, Type=typing.Optional[uint]), ]) - openDuration: 'typing.Optional[uint]' = None + openDuration: 'typing.Union[None, Nullable, uint]' = None + targetLevel: 'typing.Optional[uint]' = None @dataclass class Close(ClusterCommand): @@ -21845,24 +21859,6 @@ def descriptor(cls) -> ClusterObjectDescriptor: Fields=[ ]) - @dataclass - class SetLevel(ClusterCommand): - cluster_id: typing.ClassVar[int] = 0x00000081 - 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="level", Tag=0, Type=uint), - ClusterObjectFieldDescriptor(Label="openDuration", Tag=1, Type=typing.Optional[uint]), - ]) - - level: 'uint' = 0 - openDuration: 'typing.Optional[uint]' = None - class Attributes: @dataclass class OpenDuration(ClusterAttributeDescriptor): @@ -21881,7 +21877,7 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'typing.Union[Nullable, uint]' = NullValue @dataclass - class AutoCloseTime(ClusterAttributeDescriptor): + class DefaultOpenDuration(ClusterAttributeDescriptor): @ChipUtility.classproperty def cluster_id(cls) -> int: return 0x00000081 @@ -21892,12 +21888,12 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, uint]) + return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, uint]) - value: 'typing.Union[None, Nullable, uint]' = None + value: 'typing.Union[Nullable, uint]' = NullValue @dataclass - class RemainingDuration(ClusterAttributeDescriptor): + class AutoCloseTime(ClusterAttributeDescriptor): @ChipUtility.classproperty def cluster_id(cls) -> int: return 0x00000081 @@ -21913,7 +21909,7 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'typing.Union[None, Nullable, uint]' = None @dataclass - class CurrentState(ClusterAttributeDescriptor): + class RemainingDuration(ClusterAttributeDescriptor): @ChipUtility.classproperty def cluster_id(cls) -> int: return 0x00000081 @@ -21924,12 +21920,12 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, ValveConfigurationAndControl.Enums.ValveStateEnum]) + return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, uint]) - value: 'typing.Union[Nullable, ValveConfigurationAndControl.Enums.ValveStateEnum]' = NullValue + value: 'typing.Union[Nullable, uint]' = NullValue @dataclass - class TargetState(ClusterAttributeDescriptor): + class CurrentState(ClusterAttributeDescriptor): @ChipUtility.classproperty def cluster_id(cls) -> int: return 0x00000081 @@ -21945,7 +21941,7 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'typing.Union[Nullable, ValveConfigurationAndControl.Enums.ValveStateEnum]' = NullValue @dataclass - class StartUpState(ClusterAttributeDescriptor): + class TargetState(ClusterAttributeDescriptor): @ChipUtility.classproperty def cluster_id(cls) -> int: return 0x00000081 @@ -21956,9 +21952,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Optional[ValveConfigurationAndControl.Enums.ValveStateEnum]) + return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, ValveConfigurationAndControl.Enums.ValveStateEnum]) - value: 'typing.Optional[ValveConfigurationAndControl.Enums.ValveStateEnum]' = None + value: 'typing.Union[Nullable, ValveConfigurationAndControl.Enums.ValveStateEnum]' = NullValue @dataclass class CurrentLevel(ClusterAttributeDescriptor): @@ -21993,7 +21989,7 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'typing.Union[None, Nullable, uint]' = None @dataclass - class OpenLevel(ClusterAttributeDescriptor): + class DefaultOpenLevel(ClusterAttributeDescriptor): @ChipUtility.classproperty def cluster_id(cls) -> int: return 0x00000081 @@ -22004,9 +22000,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, uint]) + return ClusterObjectFieldDescriptor(Type=typing.Optional[uint]) - value: 'typing.Union[None, Nullable, uint]' = None + value: 'typing.Optional[uint]' = None @dataclass class ValveFault(ClusterAttributeDescriptor): @@ -22136,9 +22132,11 @@ def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ ClusterObjectFieldDescriptor(Label="valveState", Tag=0, Type=ValveConfigurationAndControl.Enums.ValveStateEnum), + ClusterObjectFieldDescriptor(Label="valveLevel", Tag=1, Type=typing.Optional[uint]), ]) valveState: 'ValveConfigurationAndControl.Enums.ValveStateEnum' = 0 + valveLevel: 'typing.Optional[uint]' = None @dataclass class ValveFault(ClusterEvent): diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm index 1f7d91156734b9..abf2880f92b8d0 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm @@ -2865,6 +2865,9 @@ static BOOL AttributeIsSpecifiedInValveConfigurationAndControlCluster(AttributeI case Attributes::OpenDuration::Id: { return YES; } + case Attributes::DefaultOpenDuration::Id: { + return YES; + } case Attributes::AutoCloseTime::Id: { return YES; } @@ -2877,16 +2880,13 @@ static BOOL AttributeIsSpecifiedInValveConfigurationAndControlCluster(AttributeI case Attributes::TargetState::Id: { return YES; } - case Attributes::StartUpState::Id: { - return YES; - } case Attributes::CurrentLevel::Id: { return YES; } case Attributes::TargetLevel::Id: { return YES; } - case Attributes::OpenLevel::Id: { + case Attributes::DefaultOpenLevel::Id: { return YES; } case Attributes::ValveFault::Id: { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index 2deb87873533aa..90f6a6e99e1f7b 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -7456,6 +7456,21 @@ static id _Nullable DecodeAttributeValueForValveConfigurationAndControlCluster(A } return value; } + case Attributes::DefaultOpenDuration::Id: { + using TypeInfo = Attributes::DefaultOpenDuration::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; + } + return value; + } case Attributes::AutoCloseTime::Id: { using TypeInfo = Attributes::AutoCloseTime::TypeInfo; TypeInfo::DecodableType cppValue; @@ -7516,17 +7531,6 @@ static id _Nullable DecodeAttributeValueForValveConfigurationAndControlCluster(A } return value; } - case Attributes::StartUpState::Id: { - using TypeInfo = Attributes::StartUpState::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; - return value; - } case Attributes::CurrentLevel::Id: { using TypeInfo = Attributes::CurrentLevel::TypeInfo; TypeInfo::DecodableType cppValue; @@ -7557,19 +7561,15 @@ static id _Nullable DecodeAttributeValueForValveConfigurationAndControlCluster(A } return value; } - case Attributes::OpenLevel::Id: { - using TypeInfo = Attributes::OpenLevel::TypeInfo; + case Attributes::DefaultOpenLevel::Id: { + using TypeInfo = Attributes::DefaultOpenLevel::TypeInfo; TypeInfo::DecodableType cppValue; *aError = DataModel::Decode(aReader, cppValue); if (*aError != CHIP_NO_ERROR) { return nil; } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; return value; } case Attributes::ValveFault::Id: { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index ad4120b06c3ee5..8056d13eb0e920 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -7091,32 +7091,30 @@ MTR_PROVISIONALLY_AVAILABLE /** * Command Open * - * This command is used to set the valve to its fully open position. + * This command is used to set the valve to its open position. */ - (void)openWithParams:(MTRValveConfigurationAndControlClusterOpenParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; /** * Command Close * - * This command is used to set the valve to its fully closed position. + * This command is used to set the valve to its closed position. */ - (void)closeWithParams:(MTRValveConfigurationAndControlClusterCloseParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (void)closeWithCompletion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -/** - * Command SetLevel - * - * This command is used to set the valve to a specific level. - */ -- (void)setLevelWithParams:(MTRValveConfigurationAndControlClusterSetLevelParams *)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (void)readAttributeOpenDurationWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeOpenDurationWithValue:(NSNumber * _Nullable)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeOpenDurationWithValue:(NSNumber * _Nullable)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (void)subscribeAttributeOpenDurationWithParams:(MTRSubscribeParams *)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; + (void)readAttributeOpenDurationWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)readAttributeDefaultOpenDurationWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeDefaultOpenDurationWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeDefaultOpenDurationWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + - (void)readAttributeAutoCloseTimeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)subscribeAttributeAutoCloseTimeWithParams:(MTRSubscribeParams *)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished @@ -7141,14 +7139,6 @@ MTR_PROVISIONALLY_AVAILABLE reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; + (void)readAttributeTargetStateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)readAttributeStartUpStateWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeStartUpStateWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeStartUpStateWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)subscribeAttributeStartUpStateWithParams:(MTRSubscribeParams *)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; -+ (void)readAttributeStartUpStateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - - (void)readAttributeCurrentLevelWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)subscribeAttributeCurrentLevelWithParams:(MTRSubscribeParams *)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished @@ -7161,13 +7151,13 @@ MTR_PROVISIONALLY_AVAILABLE reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; + (void)readAttributeTargetLevelWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)readAttributeOpenLevelWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeOpenLevelWithValue:(NSNumber * _Nullable)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeOpenLevelWithValue:(NSNumber * _Nullable)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)subscribeAttributeOpenLevelWithParams:(MTRSubscribeParams *)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; -+ (void)readAttributeOpenLevelWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)readAttributeDefaultOpenLevelWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeDefaultOpenLevelWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeDefaultOpenLevelWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeDefaultOpenLevelWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeDefaultOpenLevelWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)readAttributeValveFaultWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)subscribeAttributeValveFaultWithParams:(MTRSubscribeParams *)params @@ -16829,9 +16819,14 @@ typedef NS_OPTIONS(uint32_t, MTRBooleanSensorConfigurationFeature) { MTRBooleanSensorConfigurationFeatureSensitivityLevel MTR_PROVISIONALLY_AVAILABLE = 0x8, } MTR_PROVISIONALLY_AVAILABLE; +typedef NS_ENUM(uint8_t, MTRValveConfigurationAndControlStatusCode) { + MTRValveConfigurationAndControlStatusCodeFailureDueToFault MTR_PROVISIONALLY_AVAILABLE = 0x02, +} MTR_PROVISIONALLY_AVAILABLE; + typedef NS_ENUM(uint8_t, MTRValveConfigurationAndControlValveState) { - MTRValveConfigurationAndControlValveStateOpen MTR_PROVISIONALLY_AVAILABLE = 0x00, - MTRValveConfigurationAndControlValveStateClosed MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRValveConfigurationAndControlValveStateClosed MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRValveConfigurationAndControlValveStateOpen MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRValveConfigurationAndControlValveStateTransitioning MTR_PROVISIONALLY_AVAILABLE = 0x02, } MTR_PROVISIONALLY_AVAILABLE; typedef NS_OPTIONS(uint32_t, MTRValveConfigurationAndControlFeature) { @@ -16843,6 +16838,9 @@ typedef NS_OPTIONS(uint16_t, MTRValveConfigurationAndControlValveFaultBitmap) { MTRValveConfigurationAndControlValveFaultBitmapGeneralFault MTR_PROVISIONALLY_AVAILABLE = 0x1, MTRValveConfigurationAndControlValveFaultBitmapBlocked MTR_PROVISIONALLY_AVAILABLE = 0x2, MTRValveConfigurationAndControlValveFaultBitmapLeaking MTR_PROVISIONALLY_AVAILABLE = 0x4, + MTRValveConfigurationAndControlValveFaultBitmapNotConnected MTR_PROVISIONALLY_AVAILABLE = 0x8, + MTRValveConfigurationAndControlValveFaultBitmapShortCircuit MTR_PROVISIONALLY_AVAILABLE = 0x10, + MTRValveConfigurationAndControlValveFaultBitmapCurrentExceeded MTR_PROVISIONALLY_AVAILABLE = 0x20, } MTR_PROVISIONALLY_AVAILABLE; typedef NS_ENUM(uint16_t, MTRElectricalEnergyMeasurementMeasurementType) { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index 45c8b38f7a85dc..770018724e0f78 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -49581,30 +49581,6 @@ - (void)closeWithParams:(MTRValveConfigurationAndControlClusterCloseParams * _Nu queue:self.callbackQueue completion:responseHandler]; } -- (void)setLevelWithParams:(MTRValveConfigurationAndControlClusterSetLevelParams *)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRValveConfigurationAndControlClusterSetLevelParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = ValveConfigurationAndControl::Commands::SetLevel::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)readAttributeOpenDurationWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { @@ -49617,39 +49593,6 @@ - (void)readAttributeOpenDurationWithCompletion:(void (^)(NSNumber * _Nullable v completion:completion]; } -- (void)writeAttributeOpenDurationWithValue:(NSNumber * _Nullable)value completion:(MTRStatusCompletion)completion -{ - [self writeAttributeOpenDurationWithValue:(NSNumber * _Nullable) value params:nil completion:completion]; -} -- (void)writeAttributeOpenDurationWithValue:(NSNumber * _Nullable)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 = ValveConfigurationAndControl::Attributes::OpenDuration::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedIntValue; - } - - chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpoint); - return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); - std::move(*bridge).DispatchAction(self.device); -} - - (void)subscribeAttributeOpenDurationWithParams:(MTRSubscribeParams * _Nonnull)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler @@ -49675,6 +49618,42 @@ + (void)readAttributeOpenDurationWithClusterStateCache:(MTRClusterStateCacheCont completion:completion]; } +- (void)readAttributeDefaultOpenDurationWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ValveConfigurationAndControl::Attributes::DefaultOpenDuration::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeDefaultOpenDurationWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ValveConfigurationAndControl::Attributes::DefaultOpenDuration::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeDefaultOpenDurationWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ValveConfigurationAndControl::Attributes::DefaultOpenDuration::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + - (void)readAttributeAutoCloseTimeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { using TypeInfo = ValveConfigurationAndControl::Attributes::AutoCloseTime::TypeInfo; @@ -49819,70 +49798,6 @@ + (void)readAttributeTargetStateWithClusterStateCache:(MTRClusterStateCacheConta completion:completion]; } -- (void)readAttributeStartUpStateWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = ValveConfigurationAndControl::Attributes::StartUpState::TypeInfo; - [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:nil - queue:self.callbackQueue - completion:completion]; -} - -- (void)writeAttributeStartUpStateWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion -{ - [self writeAttributeStartUpStateWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; -} -- (void)writeAttributeStartUpStateWithValue:(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 = ValveConfigurationAndControl::Attributes::StartUpState::TypeInfo; - TypeInfo::Type cppValue; - cppValue = static_cast>(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)subscribeAttributeStartUpStateWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler -{ - using TypeInfo = ValveConfigurationAndControl::Attributes::StartUpState::TypeInfo; - [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:params - queue:self.callbackQueue - reportHandler:reportHandler - subscriptionEstablished:subscriptionEstablished]; -} - -+ (void)readAttributeStartUpStateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = ValveConfigurationAndControl::Attributes::StartUpState::TypeInfo; - [clusterStateCacheContainer - _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) - clusterID:TypeInfo::GetClusterId() - attributeID:TypeInfo::GetAttributeId() - queue:queue - completion:completion]; -} - - (void)readAttributeCurrentLevelWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { using TypeInfo = ValveConfigurationAndControl::Attributes::CurrentLevel::TypeInfo; @@ -49955,9 +49870,9 @@ + (void)readAttributeTargetLevelWithClusterStateCache:(MTRClusterStateCacheConta completion:completion]; } -- (void)readAttributeOpenLevelWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeDefaultOpenLevelWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ValveConfigurationAndControl::Attributes::OpenLevel::TypeInfo; + using TypeInfo = ValveConfigurationAndControl::Attributes::DefaultOpenLevel::TypeInfo; [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -49966,11 +49881,11 @@ - (void)readAttributeOpenLevelWithCompletion:(void (^)(NSNumber * _Nullable valu completion:completion]; } -- (void)writeAttributeOpenLevelWithValue:(NSNumber * _Nullable)value completion:(MTRStatusCompletion)completion +- (void)writeAttributeDefaultOpenLevelWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion { - [self writeAttributeOpenLevelWithValue:(NSNumber * _Nullable) value params:nil completion:completion]; + [self writeAttributeDefaultOpenLevelWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; } -- (void)writeAttributeOpenLevelWithValue:(NSNumber * _Nullable)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion +- (void)writeAttributeDefaultOpenLevelWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion { // Make a copy of params before we go async. params = [params copy]; @@ -49985,25 +49900,20 @@ - (void)writeAttributeOpenLevelWithValue:(NSNumber * _Nullable)value params:(MTR } ListFreer listFreer; - using TypeInfo = ValveConfigurationAndControl::Attributes::OpenLevel::TypeInfo; + using TypeInfo = ValveConfigurationAndControl::Attributes::DefaultOpenLevel::TypeInfo; TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedCharValue; - } + 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)subscribeAttributeOpenLevelWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeDefaultOpenLevelWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ValveConfigurationAndControl::Attributes::OpenLevel::TypeInfo; + using TypeInfo = ValveConfigurationAndControl::Attributes::DefaultOpenLevel::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -50013,9 +49923,9 @@ - (void)subscribeAttributeOpenLevelWithParams:(MTRSubscribeParams * _Nonnull)par subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeOpenLevelWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeDefaultOpenLevelWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ValveConfigurationAndControl::Attributes::OpenLevel::TypeInfo; + using TypeInfo = ValveConfigurationAndControl::Attributes::DefaultOpenLevel::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index d01196579b4023..b3cb9199e96c08 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -2590,14 +2590,14 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { // Cluster ValveConfigurationAndControl attributes MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeOpenDurationID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, - MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeAutoCloseTimeID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, - MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeRemainingDurationID MTR_PROVISIONALLY_AVAILABLE = 0x00000002, - MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeCurrentStateID MTR_PROVISIONALLY_AVAILABLE = 0x00000003, - MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeTargetStateID MTR_PROVISIONALLY_AVAILABLE = 0x00000004, - MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeStartUpStateID MTR_PROVISIONALLY_AVAILABLE = 0x00000005, + MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeDefaultOpenDurationID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeAutoCloseTimeID MTR_PROVISIONALLY_AVAILABLE = 0x00000002, + MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeRemainingDurationID MTR_PROVISIONALLY_AVAILABLE = 0x00000003, + MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeCurrentStateID MTR_PROVISIONALLY_AVAILABLE = 0x00000004, + MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeTargetStateID MTR_PROVISIONALLY_AVAILABLE = 0x00000005, MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeCurrentLevelID MTR_PROVISIONALLY_AVAILABLE = 0x00000006, MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeTargetLevelID MTR_PROVISIONALLY_AVAILABLE = 0x00000007, - MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeOpenLevelID MTR_PROVISIONALLY_AVAILABLE = 0x00000008, + MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeDefaultOpenLevelID MTR_PROVISIONALLY_AVAILABLE = 0x00000008, MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeValveFaultID MTR_PROVISIONALLY_AVAILABLE = 0x00000009, MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeGeneratedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID, MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeAcceptedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID, @@ -6252,7 +6252,6 @@ typedef NS_ENUM(uint32_t, MTRCommandIDType) { // Cluster ValveConfigurationAndControl commands MTRCommandIDTypeClusterValveConfigurationAndControlCommandOpenID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, MTRCommandIDTypeClusterValveConfigurationAndControlCommandCloseID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, - MTRCommandIDTypeClusterValveConfigurationAndControlCommandSetLevelID MTR_PROVISIONALLY_AVAILABLE = 0x00000002, // Cluster DemandResponseLoadControl commands MTRCommandIDTypeClusterDemandResponseLoadControlCommandRegisterLoadControlProgramRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index 12e03cd11b4e27..02dc79264a9fc8 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -3371,11 +3371,10 @@ MTR_PROVISIONALLY_AVAILABLE - (void)closeWithParams:(MTRValveConfigurationAndControlClusterCloseParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (void)closeWithExpectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)setLevelWithParams:(MTRValveConfigurationAndControlClusterSetLevelParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeOpenDurationWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeOpenDurationWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeOpenDurationWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeDefaultOpenDurationWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeAutoCloseTimeWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; @@ -3385,17 +3384,13 @@ MTR_PROVISIONALLY_AVAILABLE - (NSDictionary * _Nullable)readAttributeTargetStateWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; -- (NSDictionary * _Nullable)readAttributeStartUpStateWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeStartUpStateWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeStartUpStateWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - - (NSDictionary * _Nullable)readAttributeCurrentLevelWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeTargetLevelWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; -- (NSDictionary * _Nullable)readAttributeOpenLevelWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeOpenLevelWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeOpenLevelWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; +- (NSDictionary * _Nullable)readAttributeDefaultOpenLevelWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeDefaultOpenLevelWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeDefaultOpenLevelWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeValveFaultWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm index fbf736a5882e3e..1dcfc598540aef 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -9111,47 +9111,14 @@ - (void)closeWithParams:(MTRValveConfigurationAndControlClusterCloseParams * _Nu completion:responseHandler]; } -- (void)setLevelWithParams:(MTRValveConfigurationAndControlClusterSetLevelParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRValveConfigurationAndControlClusterSetLevelParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = ValveConfigurationAndControl::Commands::SetLevel::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)readAttributeOpenDurationWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeValveConfigurationAndControlID) attributeID:@(MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeOpenDurationID) params:params]; } -- (void)writeAttributeOpenDurationWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs +- (NSDictionary * _Nullable)readAttributeDefaultOpenDurationWithParams:(MTRReadParams * _Nullable)params { - [self writeAttributeOpenDurationWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; -} -- (void)writeAttributeOpenDurationWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params -{ - NSNumber * timedWriteTimeout = params.timedWriteTimeout; - - [self.device writeAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeValveConfigurationAndControlID) attributeID:@(MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeOpenDurationID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeValveConfigurationAndControlID) attributeID:@(MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeDefaultOpenDurationID) params:params]; } - (NSDictionary * _Nullable)readAttributeAutoCloseTimeWithParams:(MTRReadParams * _Nullable)params @@ -9174,22 +9141,6 @@ - (void)writeAttributeOpenDurationWithValue:(NSDictionary *)data return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeValveConfigurationAndControlID) attributeID:@(MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeTargetStateID) params:params]; } -- (NSDictionary * _Nullable)readAttributeStartUpStateWithParams:(MTRReadParams * _Nullable)params -{ - return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeValveConfigurationAndControlID) attributeID:@(MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeStartUpStateID) params:params]; -} - -- (void)writeAttributeStartUpStateWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs -{ - [self writeAttributeStartUpStateWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; -} -- (void)writeAttributeStartUpStateWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params -{ - NSNumber * timedWriteTimeout = params.timedWriteTimeout; - - [self.device writeAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeValveConfigurationAndControlID) attributeID:@(MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeStartUpStateID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; -} - - (NSDictionary * _Nullable)readAttributeCurrentLevelWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeValveConfigurationAndControlID) attributeID:@(MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeCurrentLevelID) params:params]; @@ -9200,20 +9151,20 @@ - (void)writeAttributeStartUpStateWithValue:(NSDictionary *)data return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeValveConfigurationAndControlID) attributeID:@(MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeTargetLevelID) params:params]; } -- (NSDictionary * _Nullable)readAttributeOpenLevelWithParams:(MTRReadParams * _Nullable)params +- (NSDictionary * _Nullable)readAttributeDefaultOpenLevelWithParams:(MTRReadParams * _Nullable)params { - return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeValveConfigurationAndControlID) attributeID:@(MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeOpenLevelID) params:params]; + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeValveConfigurationAndControlID) attributeID:@(MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeDefaultOpenLevelID) params:params]; } -- (void)writeAttributeOpenLevelWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs +- (void)writeAttributeDefaultOpenLevelWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs { - [self writeAttributeOpenLevelWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; + [self writeAttributeDefaultOpenLevelWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; } -- (void)writeAttributeOpenLevelWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params +- (void)writeAttributeDefaultOpenLevelWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params { NSNumber * timedWriteTimeout = params.timedWriteTimeout; - [self.device writeAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeValveConfigurationAndControlID) attributeID:@(MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeOpenLevelID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; + [self.device writeAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeValveConfigurationAndControlID) attributeID:@(MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeDefaultOpenLevelID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; } - (NSDictionary * _Nullable)readAttributeValveFaultWithParams:(MTRReadParams * _Nullable)params diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h index 5778c777f0e0b3..169cd5452c6133 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h @@ -5629,34 +5629,8 @@ MTR_PROVISIONALLY_AVAILABLE @interface MTRValveConfigurationAndControlClusterOpenParams : NSObject @property (nonatomic, copy) NSNumber * _Nullable openDuration 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 MTRValveConfigurationAndControlClusterCloseParams : NSObject +@property (nonatomic, copy) NSNumber * _Nullable targetLevel MTR_PROVISIONALLY_AVAILABLE; /** * Controls whether the command is a timed command (using Timed Invoke). * @@ -5684,11 +5658,7 @@ MTR_PROVISIONALLY_AVAILABLE @end MTR_PROVISIONALLY_AVAILABLE -@interface MTRValveConfigurationAndControlClusterSetLevelParams : NSObject - -@property (nonatomic, copy) NSNumber * _Nonnull level MTR_PROVISIONALLY_AVAILABLE; - -@property (nonatomic, copy) NSNumber * _Nullable openDuration MTR_PROVISIONALLY_AVAILABLE; +@interface MTRValveConfigurationAndControlClusterCloseParams : NSObject /** * Controls whether the command is a timed command (using Timed Invoke). * diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index 319c22ab6ecc41..eb97ce9dd9d5ff 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -15467,6 +15467,8 @@ - (instancetype)init if (self = [super init]) { _openDuration = nil; + + _targetLevel = nil; _timedInvokeTimeoutMs = nil; _serverSideProcessingTimeout = nil; } @@ -15478,6 +15480,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; auto other = [[MTRValveConfigurationAndControlClusterOpenParams alloc] init]; other.openDuration = self.openDuration; + other.targetLevel = self.targetLevel; other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; @@ -15486,7 +15489,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: openDuration:%@; >", NSStringFromClass([self class]), _openDuration]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: openDuration:%@; targetLevel:%@; >", NSStringFromClass([self class]), _openDuration, _targetLevel]; return descriptionString; } @@ -15501,7 +15504,18 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader { if (self.openDuration != nil) { auto & definedValue_0 = encodableStruct.openDuration.Emplace(); - definedValue_0 = self.openDuration.unsignedIntValue; + if (self.openDuration == nil) { + definedValue_0.SetNull(); + } else { + auto & nonNullValue_1 = definedValue_0.SetNonNull(); + nonNullValue_1 = self.openDuration.unsignedIntValue; + } + } + } + { + if (self.targetLevel != nil) { + auto & definedValue_0 = encodableStruct.targetLevel.Emplace(); + definedValue_0 = self.targetLevel.unsignedCharValue; } } @@ -15616,94 +15630,6 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader } @end -@implementation MTRValveConfigurationAndControlClusterSetLevelParams -- (instancetype)init -{ - if (self = [super init]) { - - _level = @(0); - - _openDuration = nil; - _timedInvokeTimeoutMs = nil; - _serverSideProcessingTimeout = nil; - } - return self; -} - -- (id)copyWithZone:(NSZone * _Nullable)zone; -{ - auto other = [[MTRValveConfigurationAndControlClusterSetLevelParams alloc] init]; - - other.level = self.level; - other.openDuration = self.openDuration; - other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; - other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; - - return other; -} - -- (NSString *)description -{ - NSString * descriptionString = [NSString stringWithFormat:@"<%@: level:%@; openDuration:%@; >", NSStringFromClass([self class]), _level, _openDuration]; - return descriptionString; -} - -@end - -@implementation MTRValveConfigurationAndControlClusterSetLevelParams (InternalMethods) - -- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader -{ - chip::app::Clusters::ValveConfigurationAndControl::Commands::SetLevel::Type encodableStruct; - ListFreer listFreer; - { - encodableStruct.level = self.level.unsignedCharValue; - } - { - if (self.openDuration != nil) { - auto & definedValue_0 = encodableStruct.openDuration.Emplace(); - definedValue_0 = self.openDuration.unsignedIntValue; - } - } - - 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 MTRDemandResponseLoadControlClusterRegisterLoadControlProgramRequestParams - (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 54b6b8159bc576..ee5fdab66fbd3e 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h @@ -1012,12 +1012,6 @@ NS_ASSUME_NONNULL_BEGIN @end -@interface MTRValveConfigurationAndControlClusterSetLevelParams (InternalMethods) - -- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; - -@end - @interface MTRDemandResponseLoadControlClusterRegisterLoadControlProgramRequestParams (InternalMethods) - (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm index 8119e5be2e3021..9e5a83d99b359f 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm @@ -2433,6 +2433,15 @@ static id _Nullable DecodeEventPayloadForValveConfigurationAndControlCluster(Eve memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.valveState)]; value.valveState = memberValue; } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.valveLevel.HasValue()) { + memberValue = [NSNumber numberWithUnsignedChar:cppValue.valveLevel.Value()]; + } else { + memberValue = nil; + } + value.valveLevel = memberValue; + } while (0); return value; } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index b21a35ab11b40f..56a13238933397 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -1065,6 +1065,7 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRValveConfigurationAndControlClusterValveStateChangedEvent : NSObject @property (nonatomic, copy) NSNumber * _Nonnull valveState MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable valveLevel MTR_PROVISIONALLY_AVAILABLE; @end MTR_PROVISIONALLY_AVAILABLE diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index 074a9001c288b5..370595e3ba4b0b 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -4262,6 +4262,8 @@ - (instancetype)init if (self = [super init]) { _valveState = @(0); + + _valveLevel = nil; } return self; } @@ -4271,13 +4273,14 @@ - (id)copyWithZone:(NSZone * _Nullable)zone auto other = [[MTRValveConfigurationAndControlClusterValveStateChangedEvent alloc] init]; other.valveState = self.valveState; + other.valveLevel = self.valveLevel; return other; } - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: valveState:%@; >", NSStringFromClass([self class]), _valveState]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: valveState:%@; valveLevel:%@; >", NSStringFromClass([self class]), _valveState, _valveLevel]; return descriptionString; } 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 66f3ff69bb6949..9dd6762293ddb9 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 @@ -9626,6 +9626,59 @@ EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullabl } // namespace OpenDuration +namespace DefaultOpenDuration { + +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::ValveConfigurationAndControl::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (Traits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = Traits::StorageToWorking(temp); + } + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::ValveConfigurationAndControl::Id, Id, writable, ZCL_ELAPSED_S_ATTRIBUTE_TYPE); +} + +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::ValveConfigurationAndControl::Id, Id, writable, ZCL_ELAPSED_S_ATTRIBUTE_TYPE); +} + +EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace DefaultOpenDuration + namespace AutoCloseTime { EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) @@ -9842,37 +9895,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, } // namespace TargetState -namespace StartUpState { - -EmberAfStatus Get(chip::EndpointId endpoint, chip::app::Clusters::ValveConfigurationAndControl::ValveStateEnum * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::ValveConfigurationAndControl::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::app::Clusters::ValveConfigurationAndControl::ValveStateEnum 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::ValveConfigurationAndControl::Id, Id, writable, ZCL_ENUM8_ATTRIBUTE_TYPE); -} - -} // namespace StartUpState - namespace CurrentLevel { EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) @@ -9979,29 +10001,26 @@ EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullabl } // namespace TargetLevel -namespace OpenLevel { +namespace DefaultOpenLevel { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) +EmberAfStatus Get(chip::EndpointId endpoint, chip::Percent * value) { using Traits = NumericAttributeTraits; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::ValveConfigurationAndControl::Id, Id, readable, sizeof(temp)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (Traits::IsNullValue(temp)) - { - value.SetNull(); - } - else + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) { - value.SetNonNull() = Traits::StorageToWorking(temp); + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; } + *value = Traits::StorageToWorking(temp); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::Percent value) { using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; } @@ -10011,26 +10030,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, chip::Percent value) return emberAfWriteAttribute(endpoint, Clusters::ValveConfigurationAndControl::Id, Id, writable, ZCL_PERCENT_ATTRIBUTE_TYPE); } -EmberAfStatus SetNull(chip::EndpointId endpoint) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::ValveConfigurationAndControl::Id, Id, writable, ZCL_PERCENT_ATTRIBUTE_TYPE); -} - -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) -{ - if (value.IsNull()) - { - return SetNull(endpoint); - } - - return Set(endpoint, value.Value()); -} - -} // namespace OpenLevel +} // namespace DefaultOpenLevel namespace ValveFault { 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 4222d40ea76f9f..2b801659eed9bb 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 @@ -1882,6 +1882,13 @@ EmberAfStatus SetNull(chip::EndpointId endpoint); EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); } // namespace OpenDuration +namespace DefaultOpenDuration { +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // elapsed_s +EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); +} // namespace DefaultOpenDuration + namespace AutoCloseTime { EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // epoch_us EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value); @@ -1914,12 +1921,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); } // namespace TargetState -namespace StartUpState { -EmberAfStatus Get(chip::EndpointId endpoint, - chip::app::Clusters::ValveConfigurationAndControl::ValveStateEnum * value); // ValveStateEnum -EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::ValveConfigurationAndControl::ValveStateEnum value); -} // namespace StartUpState - namespace CurrentLevel { EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // percent EmberAfStatus Set(chip::EndpointId endpoint, chip::Percent value); @@ -1934,12 +1935,10 @@ EmberAfStatus SetNull(chip::EndpointId endpoint); EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); } // namespace TargetLevel -namespace OpenLevel { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // percent +namespace DefaultOpenLevel { +EmberAfStatus Get(chip::EndpointId endpoint, chip::Percent * value); // percent EmberAfStatus Set(chip::EndpointId endpoint, chip::Percent value); -EmberAfStatus SetNull(chip::EndpointId endpoint); -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); -} // namespace OpenLevel +} // namespace DefaultOpenLevel namespace ValveFault { EmberAfStatus Get(chip::EndpointId endpoint, 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 ff5751ddcb52ee..c843d31ed5203b 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callback.h +++ b/zzz_generated/app-common/app-common/zap-generated/callback.h @@ -10126,12 +10126,6 @@ bool emberAfValveConfigurationAndControlClusterOpenCallback( bool emberAfValveConfigurationAndControlClusterCloseCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::ValveConfigurationAndControl::Commands::Close::DecodableType & commandData); -/** - * @brief Valve Configuration and Control Cluster SetLevel Command callback (from client) - */ -bool emberAfValveConfigurationAndControlClusterSetLevelCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::ValveConfigurationAndControl::Commands::SetLevel::DecodableType & commandData); /** * @brief Demand Response Load Control Cluster RegisterLoadControlProgramRequest 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 48a2a5094ad527..4eccbbdb6e4d65 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 @@ -1522,16 +1522,28 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(BooleanSensorConfigurat } } +static auto __attribute__((unused)) EnsureKnownEnumValue(ValveConfigurationAndControl::StatusCodeEnum val) +{ + using EnumType = ValveConfigurationAndControl::StatusCodeEnum; + switch (val) + { + case EnumType::kFailureDueToFault: + return val; + default: + return static_cast(0); + } +} static auto __attribute__((unused)) EnsureKnownEnumValue(ValveConfigurationAndControl::ValveStateEnum val) { using EnumType = ValveConfigurationAndControl::ValveStateEnum; switch (val) { - case EnumType::kOpen: case EnumType::kClosed: + case EnumType::kOpen: + case EnumType::kTransitioning: return val; default: - return static_cast(2); + return static_cast(3); } } 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 adcca6f89087af..1cbbb29dbb4216 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 @@ -2159,16 +2159,28 @@ enum class Feature : uint32_t namespace ValveConfigurationAndControl { +// Enum for StatusCodeEnum +enum class StatusCodeEnum : uint8_t +{ + kFailureDueToFault = 0x02, + // All received enum values that are not listed above will be mapped + // to kUnknownEnumValue. This is a helper enum value that should only + // be used by code to process how it handles receiving and unknown + // enum value. This specific should never be transmitted. + kUnknownEnumValue = 0, +}; + // Enum for ValveStateEnum enum class ValveStateEnum : uint8_t { - kOpen = 0x00, - kClosed = 0x01, + kClosed = 0x00, + kOpen = 0x01, + kTransitioning = 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 = 2, + kUnknownEnumValue = 3, }; // Bitmap for Feature @@ -2181,9 +2193,12 @@ enum class Feature : uint32_t // Bitmap for ValveFaultBitmap enum class ValveFaultBitmap : uint16_t { - kGeneralFault = 0x1, - kBlocked = 0x2, - kLeaking = 0x4, + kGeneralFault = 0x1, + kBlocked = 0x2, + kLeaking = 0x4, + kNotConnected = 0x8, + kShortCircuit = 0x10, + kCurrentExceeded = 0x20, }; } // namespace ValveConfigurationAndControl 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 78bf30815c3084..be92b8e93a8083 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 @@ -13792,6 +13792,7 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; encoder.Encode(to_underlying(Fields::kOpenDuration), openDuration); + encoder.Encode(to_underlying(Fields::kTargetLevel), targetLevel); return encoder.Finalize(); } @@ -13813,6 +13814,10 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { err = DataModel::Decode(reader, openDuration); } + else if (__context_tag == to_underlying(Fields::kTargetLevel)) + { + err = DataModel::Decode(reader, targetLevel); + } else { } @@ -13841,45 +13846,6 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } } } // namespace Close. -namespace SetLevel { -CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const -{ - DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kLevel), level); - encoder.Encode(to_underlying(Fields::kOpenDuration), openDuration); - 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::kLevel)) - { - err = DataModel::Decode(reader, level); - } - else if (__context_tag == to_underlying(Fields::kOpenDuration)) - { - err = DataModel::Decode(reader, openDuration); - } - else - { - } - - ReturnErrorOnFailure(err); - } -} -} // namespace SetLevel. } // namespace Commands namespace Attributes { @@ -13889,6 +13855,8 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre { case Attributes::OpenDuration::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, openDuration); + case Attributes::DefaultOpenDuration::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, defaultOpenDuration); case Attributes::AutoCloseTime::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, autoCloseTime); case Attributes::RemainingDuration::TypeInfo::GetAttributeId(): @@ -13897,14 +13865,12 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre return DataModel::Decode(reader, currentState); case Attributes::TargetState::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, targetState); - case Attributes::StartUpState::TypeInfo::GetAttributeId(): - return DataModel::Decode(reader, startUpState); case Attributes::CurrentLevel::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, currentLevel); case Attributes::TargetLevel::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, targetLevel); - case Attributes::OpenLevel::TypeInfo::GetAttributeId(): - return DataModel::Decode(reader, openLevel); + case Attributes::DefaultOpenLevel::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, defaultOpenLevel); case Attributes::ValveFault::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, valveFault); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): @@ -13932,6 +13898,7 @@ 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::kValveState), valveState)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kValveLevel), valveLevel)); return aWriter.EndContainer(outer); } @@ -13953,6 +13920,10 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { err = DataModel::Decode(reader, valveState); } + else if (__context_tag == to_underlying(Fields::kValveLevel)) + { + err = DataModel::Decode(reader, valveLevel); + } else { } 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 afb183bc0de418..1a1973ae63e69f 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 @@ -19748,11 +19748,6 @@ struct Type; struct DecodableType; } // namespace Close -namespace SetLevel { -struct Type; -struct DecodableType; -} // namespace SetLevel - } // namespace Commands namespace Commands { @@ -19760,6 +19755,7 @@ namespace Open { enum class Fields : uint8_t { kOpenDuration = 0, + kTargetLevel = 1, }; struct Type @@ -19769,7 +19765,8 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::Open::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ValveConfigurationAndControl::Id; } - Optional openDuration; + Optional> openDuration; + Optional targetLevel; CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -19784,7 +19781,8 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::Open::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ValveConfigurationAndControl::Id; } - Optional openDuration; + Optional> openDuration; + Optional targetLevel; CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace Open @@ -19816,41 +19814,6 @@ struct DecodableType CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace Close -namespace SetLevel { -enum class Fields : uint8_t -{ - kLevel = 0, - kOpenDuration = 1, -}; - -struct Type -{ -public: - // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand - static constexpr CommandId GetCommandId() { return Commands::SetLevel::Id; } - static constexpr ClusterId GetClusterId() { return Clusters::ValveConfigurationAndControl::Id; } - - chip::Percent level = static_cast(0); - Optional openDuration; - - 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::SetLevel::Id; } - static constexpr ClusterId GetClusterId() { return Clusters::ValveConfigurationAndControl::Id; } - - chip::Percent level = static_cast(0); - Optional openDuration; - CHIP_ERROR Decode(TLV::TLVReader & reader); -}; -}; // namespace SetLevel } // namespace Commands namespace Attributes { @@ -19867,6 +19830,18 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace OpenDuration +namespace DefaultOpenDuration { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::ValveConfigurationAndControl::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::DefaultOpenDuration::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace DefaultOpenDuration namespace AutoCloseTime { struct TypeInfo { @@ -19917,18 +19892,6 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace TargetState -namespace StartUpState { -struct TypeInfo -{ - using Type = chip::app::Clusters::ValveConfigurationAndControl::ValveStateEnum; - using DecodableType = chip::app::Clusters::ValveConfigurationAndControl::ValveStateEnum; - using DecodableArgType = chip::app::Clusters::ValveConfigurationAndControl::ValveStateEnum; - - static constexpr ClusterId GetClusterId() { return Clusters::ValveConfigurationAndControl::Id; } - static constexpr AttributeId GetAttributeId() { return Attributes::StartUpState::Id; } - static constexpr bool MustUseTimedWrite() { return false; } -}; -} // namespace StartUpState namespace CurrentLevel { struct TypeInfo { @@ -19953,18 +19916,18 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace TargetLevel -namespace OpenLevel { +namespace DefaultOpenLevel { struct TypeInfo { - using Type = chip::app::DataModel::Nullable; - using DecodableType = chip::app::DataModel::Nullable; - using DecodableArgType = const chip::app::DataModel::Nullable &; + using Type = chip::Percent; + using DecodableType = chip::Percent; + using DecodableArgType = chip::Percent; static constexpr ClusterId GetClusterId() { return Clusters::ValveConfigurationAndControl::Id; } - static constexpr AttributeId GetAttributeId() { return Attributes::OpenLevel::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::DefaultOpenLevel::Id; } static constexpr bool MustUseTimedWrite() { return false; } }; -} // namespace OpenLevel +} // namespace DefaultOpenLevel namespace ValveFault { struct TypeInfo { @@ -20023,15 +19986,14 @@ struct TypeInfo CHIP_ERROR Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path); Attributes::OpenDuration::TypeInfo::DecodableType openDuration; + Attributes::DefaultOpenDuration::TypeInfo::DecodableType defaultOpenDuration; Attributes::AutoCloseTime::TypeInfo::DecodableType autoCloseTime; Attributes::RemainingDuration::TypeInfo::DecodableType remainingDuration; Attributes::CurrentState::TypeInfo::DecodableType currentState; Attributes::TargetState::TypeInfo::DecodableType targetState; - Attributes::StartUpState::TypeInfo::DecodableType startUpState = - static_cast(0); Attributes::CurrentLevel::TypeInfo::DecodableType currentLevel; Attributes::TargetLevel::TypeInfo::DecodableType targetLevel; - Attributes::OpenLevel::TypeInfo::DecodableType openLevel; + Attributes::DefaultOpenLevel::TypeInfo::DecodableType defaultOpenLevel = static_cast(0); Attributes::ValveFault::TypeInfo::DecodableType valveFault = static_cast>(0); Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; @@ -20050,6 +20012,7 @@ static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; enum class Fields : uint8_t { kValveState = 0, + kValveLevel = 1, }; struct Type @@ -20061,6 +20024,7 @@ struct Type static constexpr bool kIsFabricScoped = false; ValveStateEnum valveState = static_cast(0); + Optional valveLevel; CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; }; @@ -20073,6 +20037,7 @@ struct DecodableType static constexpr ClusterId GetClusterId() { return Clusters::ValveConfigurationAndControl::Id; } ValveStateEnum valveState = static_cast(0); + Optional valveLevel; CHIP_ERROR Decode(TLV::TLVReader & reader); }; 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 732997cd74bf35..3e3f3963c05d73 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 @@ -3566,25 +3566,25 @@ namespace OpenDuration { static constexpr AttributeId Id = 0x00000000; } // namespace OpenDuration -namespace AutoCloseTime { +namespace DefaultOpenDuration { static constexpr AttributeId Id = 0x00000001; +} // namespace DefaultOpenDuration + +namespace AutoCloseTime { +static constexpr AttributeId Id = 0x00000002; } // namespace AutoCloseTime namespace RemainingDuration { -static constexpr AttributeId Id = 0x00000002; +static constexpr AttributeId Id = 0x00000003; } // namespace RemainingDuration namespace CurrentState { -static constexpr AttributeId Id = 0x00000003; +static constexpr AttributeId Id = 0x00000004; } // namespace CurrentState namespace TargetState { -static constexpr AttributeId Id = 0x00000004; -} // namespace TargetState - -namespace StartUpState { static constexpr AttributeId Id = 0x00000005; -} // namespace StartUpState +} // namespace TargetState namespace CurrentLevel { static constexpr AttributeId Id = 0x00000006; @@ -3594,9 +3594,9 @@ namespace TargetLevel { static constexpr AttributeId Id = 0x00000007; } // namespace TargetLevel -namespace OpenLevel { +namespace DefaultOpenLevel { static constexpr AttributeId Id = 0x00000008; -} // namespace OpenLevel +} // namespace DefaultOpenLevel namespace ValveFault { static constexpr AttributeId Id = 0x00000009; 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 79c4cd73302615..405ee0242fd147 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 @@ -934,10 +934,6 @@ namespace Close { static constexpr CommandId Id = 0x00000001; } // namespace Close -namespace SetLevel { -static constexpr CommandId Id = 0x00000002; -} // namespace SetLevel - } // namespace Commands } // namespace ValveConfigurationAndControl diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 645a06603e14c0..1a1873d0616fd3 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -6437,18 +6437,17 @@ class BooleanSensorConfigurationSuppressRequest : public ClusterCommand | Commands: | | | * Open | 0x00 | | * Close | 0x01 | -| * SetLevel | 0x02 | |------------------------------------------------------------------------------| | Attributes: | | | * OpenDuration | 0x0000 | -| * AutoCloseTime | 0x0001 | -| * RemainingDuration | 0x0002 | -| * CurrentState | 0x0003 | -| * TargetState | 0x0004 | -| * StartUpState | 0x0005 | +| * DefaultOpenDuration | 0x0001 | +| * AutoCloseTime | 0x0002 | +| * RemainingDuration | 0x0003 | +| * CurrentState | 0x0004 | +| * TargetState | 0x0005 | | * CurrentLevel | 0x0006 | | * TargetLevel | 0x0007 | -| * OpenLevel | 0x0008 | +| * DefaultOpenLevel | 0x0008 | | * ValveFault | 0x0009 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | @@ -6471,6 +6470,7 @@ class ValveConfigurationAndControlOpen : public ClusterCommand ValveConfigurationAndControlOpen(CredentialIssuerCommands * credsIssuerConfig) : ClusterCommand("open", credsIssuerConfig) { AddArgument("OpenDuration", 0, UINT32_MAX, &mRequest.openDuration); + AddArgument("TargetLevel", 0, UINT8_MAX, &mRequest.targetLevel); ClusterCommand::AddArguments(); } @@ -6535,45 +6535,6 @@ class ValveConfigurationAndControlClose : public ClusterCommand chip::app::Clusters::ValveConfigurationAndControl::Commands::Close::Type mRequest; }; -/* - * Command SetLevel - */ -class ValveConfigurationAndControlSetLevel : public ClusterCommand -{ -public: - ValveConfigurationAndControlSetLevel(CredentialIssuerCommands * credsIssuerConfig) : - ClusterCommand("set-level", credsIssuerConfig) - { - AddArgument("Level", 0, UINT8_MAX, &mRequest.level); - AddArgument("OpenDuration", 0, UINT32_MAX, &mRequest.openDuration); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::ValveConfigurationAndControl::Commands::SetLevel::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::ValveConfigurationAndControl::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::ValveConfigurationAndControl::Commands::SetLevel::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::ValveConfigurationAndControl::Commands::SetLevel::Type mRequest; -}; - /*----------------------------------------------------------------------------*\ | Cluster ElectricalEnergyMeasurement | 0x0091 | |------------------------------------------------------------------------------| @@ -19256,23 +19217,22 @@ void registerClusterValveConfigurationAndControl(Commands & commands, Credential // // Commands // - make_unique(Id, credsIssuerConfig), // - make_unique(credsIssuerConfig), // - make_unique(credsIssuerConfig), // - make_unique(credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // // // Attributes // make_unique(Id, credsIssuerConfig), // make_unique(Id, "open-duration", Attributes::OpenDuration::Id, credsIssuerConfig), // + make_unique(Id, "default-open-duration", Attributes::DefaultOpenDuration::Id, credsIssuerConfig), // make_unique(Id, "auto-close-time", Attributes::AutoCloseTime::Id, credsIssuerConfig), // make_unique(Id, "remaining-duration", Attributes::RemainingDuration::Id, credsIssuerConfig), // make_unique(Id, "current-state", Attributes::CurrentState::Id, credsIssuerConfig), // make_unique(Id, "target-state", Attributes::TargetState::Id, credsIssuerConfig), // - make_unique(Id, "start-up-state", Attributes::StartUpState::Id, credsIssuerConfig), // make_unique(Id, "current-level", Attributes::CurrentLevel::Id, credsIssuerConfig), // make_unique(Id, "target-level", Attributes::TargetLevel::Id, credsIssuerConfig), // - make_unique(Id, "open-level", Attributes::OpenLevel::Id, credsIssuerConfig), // + make_unique(Id, "default-open-level", Attributes::DefaultOpenLevel::Id, credsIssuerConfig), // make_unique(Id, "valve-fault", Attributes::ValveFault::Id, credsIssuerConfig), // make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // @@ -19282,7 +19242,10 @@ void registerClusterValveConfigurationAndControl(Commands & commands, Credential make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // make_unique>(Id, credsIssuerConfig), // make_unique>>( - Id, "open-duration", 0, UINT32_MAX, Attributes::OpenDuration::Id, WriteCommandType::kWrite, credsIssuerConfig), // + Id, "open-duration", 0, UINT32_MAX, Attributes::OpenDuration::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>(Id, "default-open-duration", 0, UINT32_MAX, + Attributes::DefaultOpenDuration::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>(Id, "auto-close-time", 0, UINT64_MAX, Attributes::AutoCloseTime::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // @@ -19295,14 +19258,12 @@ void registerClusterValveConfigurationAndControl(Commands & commands, Credential make_unique< WriteAttribute>>( Id, "target-state", 0, UINT8_MAX, Attributes::TargetState::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>( - Id, "start-up-state", 0, UINT8_MAX, Attributes::StartUpState::Id, WriteCommandType::kWrite, credsIssuerConfig), // make_unique>>( Id, "current-level", 0, UINT8_MAX, Attributes::CurrentLevel::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>( Id, "target-level", 0, UINT8_MAX, Attributes::TargetLevel::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>>( - Id, "open-level", 0, UINT8_MAX, Attributes::OpenLevel::Id, WriteCommandType::kWrite, credsIssuerConfig), // + make_unique>(Id, "default-open-level", 0, UINT8_MAX, Attributes::DefaultOpenLevel::Id, + WriteCommandType::kWrite, credsIssuerConfig), // make_unique>>( Id, "valve-fault", 0, UINT16_MAX, Attributes::ValveFault::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>( @@ -19320,14 +19281,14 @@ void registerClusterValveConfigurationAndControl(Commands & commands, Credential WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique(Id, credsIssuerConfig), // make_unique(Id, "open-duration", Attributes::OpenDuration::Id, credsIssuerConfig), // + make_unique(Id, "default-open-duration", Attributes::DefaultOpenDuration::Id, credsIssuerConfig), // make_unique(Id, "auto-close-time", Attributes::AutoCloseTime::Id, credsIssuerConfig), // make_unique(Id, "remaining-duration", Attributes::RemainingDuration::Id, credsIssuerConfig), // make_unique(Id, "current-state", Attributes::CurrentState::Id, credsIssuerConfig), // make_unique(Id, "target-state", Attributes::TargetState::Id, credsIssuerConfig), // - make_unique(Id, "start-up-state", Attributes::StartUpState::Id, credsIssuerConfig), // make_unique(Id, "current-level", Attributes::CurrentLevel::Id, credsIssuerConfig), // make_unique(Id, "target-level", Attributes::TargetLevel::Id, credsIssuerConfig), // - make_unique(Id, "open-level", Attributes::OpenLevel::Id, credsIssuerConfig), // + make_unique(Id, "default-open-level", Attributes::DefaultOpenLevel::Id, credsIssuerConfig), // make_unique(Id, "valve-fault", Attributes::ValveFault::Id, credsIssuerConfig), // make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // 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 63017e72e36b37..f0cfd8ca0cbf2d 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -5524,6 +5524,14 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return err; } } + { + CHIP_ERROR err = DataModelLogger::LogValue("ValveLevel", indent + 1, value.valveLevel); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'ValveLevel'"); + return err; + } + } DataModelLogger::LogString(indent, "}"); return CHIP_NO_ERROR; @@ -11590,6 +11598,11 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("OpenDuration", 1, value); } + case ValveConfigurationAndControl::Attributes::DefaultOpenDuration::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("DefaultOpenDuration", 1, value); + } case ValveConfigurationAndControl::Attributes::AutoCloseTime::Id: { chip::app::DataModel::Nullable value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); @@ -11610,11 +11623,6 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("TargetState", 1, value); } - case ValveConfigurationAndControl::Attributes::StartUpState::Id: { - chip::app::Clusters::ValveConfigurationAndControl::ValveStateEnum value; - ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("StartUpState", 1, value); - } case ValveConfigurationAndControl::Attributes::CurrentLevel::Id: { chip::app::DataModel::Nullable value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); @@ -11625,10 +11633,10 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("TargetLevel", 1, value); } - case ValveConfigurationAndControl::Attributes::OpenLevel::Id: { - chip::app::DataModel::Nullable value; + case ValveConfigurationAndControl::Attributes::DefaultOpenLevel::Id: { + chip::Percent value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("OpenLevel", 1, value); + return DataModelLogger::LogValue("DefaultOpenLevel", 1, value); } case ValveConfigurationAndControl::Attributes::ValveFault::Id: { chip::BitMask value; diff --git a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h index 80646cb029a5d7..86aa49e51208e3 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -74328,18 +74328,17 @@ class SubscribeAttributeBooleanSensorConfigurationClusterRevision : public Subsc | Commands: | | | * Open | 0x00 | | * Close | 0x01 | -| * SetLevel | 0x02 | |------------------------------------------------------------------------------| | Attributes: | | | * OpenDuration | 0x0000 | -| * AutoCloseTime | 0x0001 | -| * RemainingDuration | 0x0002 | -| * CurrentState | 0x0003 | -| * TargetState | 0x0004 | -| * StartUpState | 0x0005 | +| * DefaultOpenDuration | 0x0001 | +| * AutoCloseTime | 0x0002 | +| * RemainingDuration | 0x0003 | +| * CurrentState | 0x0004 | +| * TargetState | 0x0005 | | * CurrentLevel | 0x0006 | | * TargetLevel | 0x0007 | -| * OpenLevel | 0x0008 | +| * DefaultOpenLevel | 0x0008 | | * ValveFault | 0x0009 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | @@ -74364,6 +74363,9 @@ class ValveConfigurationAndControlOpen : public ClusterCommand { { #if MTR_ENABLE_PROVISIONAL AddArgument("OpenDuration", 0, UINT32_MAX, &mRequest.openDuration); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("TargetLevel", 0, UINT8_MAX, &mRequest.targetLevel); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } @@ -74381,10 +74383,21 @@ class ValveConfigurationAndControlOpen : public ClusterCommand { params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL if (mRequest.openDuration.HasValue()) { - params.openDuration = [NSNumber numberWithUnsignedInt:mRequest.openDuration.Value()]; + if (mRequest.openDuration.Value().IsNull()) { + params.openDuration = nil; + } else { + params.openDuration = [NSNumber numberWithUnsignedInt:mRequest.openDuration.Value().Value()]; + } } else { params.openDuration = nil; } +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + if (mRequest.targetLevel.HasValue()) { + params.targetLevel = [NSNumber numberWithUnsignedChar:mRequest.targetLevel.Value()]; + } else { + params.targetLevel = nil; + } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; @@ -74455,69 +74468,6 @@ class ValveConfigurationAndControlClose : public ClusterCommand { private: }; -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL -/* - * Command SetLevel - */ -class ValveConfigurationAndControlSetLevel : public ClusterCommand { -public: - ValveConfigurationAndControlSetLevel() - : ClusterCommand("set-level") - { -#if MTR_ENABLE_PROVISIONAL - AddArgument("Level", 0, UINT8_MAX, &mRequest.level); -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL - AddArgument("OpenDuration", 0, UINT32_MAX, &mRequest.openDuration); -#endif // MTR_ENABLE_PROVISIONAL - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::ValveConfigurationAndControl::Commands::SetLevel::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 = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRValveConfigurationAndControlClusterSetLevelParams alloc] init]; - params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; -#if MTR_ENABLE_PROVISIONAL - params.level = [NSNumber numberWithUnsignedChar:mRequest.level]; -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL - if (mRequest.openDuration.HasValue()) { - params.openDuration = [NSNumber numberWithUnsignedInt:mRequest.openDuration.Value()]; - } else { - params.openDuration = nil; - } -#endif // MTR_ENABLE_PROVISIONAL - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster setLevelWithParams: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::ValveConfigurationAndControl::Commands::SetLevel::Type mRequest; -}; - #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL @@ -74559,65 +74509,106 @@ class ReadValveConfigurationAndControlOpenDuration : public ReadAttribute { } }; -class WriteValveConfigurationAndControlOpenDuration : public WriteAttribute { +class SubscribeAttributeValveConfigurationAndControlOpenDuration : public SubscribeAttribute { public: - WriteValveConfigurationAndControlOpenDuration() - : WriteAttribute("open-duration") + SubscribeAttributeValveConfigurationAndControlOpenDuration() + : SubscribeAttribute("open-duration") { - AddArgument("attr-name", "open-duration"); - AddArgument("attr-value", 0, UINT32_MAX, &mValue); - WriteAttribute::AddArguments(); } - ~WriteValveConfigurationAndControlOpenDuration() + ~SubscribeAttributeValveConfigurationAndControlOpenDuration() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::OpenDuration::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::OpenDuration::Id; - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + 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 = [[MTRBaseClusterValveConfigurationAndControl 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 * _Nullable value = nil; - if (!mValue.IsNull()) { - value = [NSNumber numberWithUnsignedInt:mValue.Value()]; + __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 subscribeAttributeOpenDurationWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ValveConfigurationAndControl.OpenDuration response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; - [cluster writeAttributeOpenDurationWithValue:value params:params completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("ValveConfigurationAndControl OpenDuration write Error", error); + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute DefaultOpenDuration + */ +class ReadValveConfigurationAndControlDefaultOpenDuration : public ReadAttribute { +public: + ReadValveConfigurationAndControlDefaultOpenDuration() + : ReadAttribute("default-open-duration") + { + } + + ~ReadValveConfigurationAndControlDefaultOpenDuration() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::DefaultOpenDuration::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 = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeDefaultOpenDurationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ValveConfigurationAndControl.DefaultOpenDuration response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ValveConfigurationAndControl DefaultOpenDuration read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } - -private: - chip::app::DataModel::Nullable mValue; }; -class SubscribeAttributeValveConfigurationAndControlOpenDuration : public SubscribeAttribute { +class SubscribeAttributeValveConfigurationAndControlDefaultOpenDuration : public SubscribeAttribute { public: - SubscribeAttributeValveConfigurationAndControlOpenDuration() - : SubscribeAttribute("open-duration") + SubscribeAttributeValveConfigurationAndControlDefaultOpenDuration() + : SubscribeAttribute("default-open-duration") { } - ~SubscribeAttributeValveConfigurationAndControlOpenDuration() + ~SubscribeAttributeValveConfigurationAndControlDefaultOpenDuration() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; - constexpr chip::CommandId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::OpenDuration::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::DefaultOpenDuration::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); @@ -74632,10 +74623,10 @@ class SubscribeAttributeValveConfigurationAndControlOpenDuration : public Subscr if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } - [cluster subscribeAttributeOpenDurationWithParams:params + [cluster subscribeAttributeDefaultOpenDurationWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ValveConfigurationAndControl.OpenDuration response %@", [value description]); + NSLog(@"ValveConfigurationAndControl.DefaultOpenDuration response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { @@ -74991,132 +74982,6 @@ class SubscribeAttributeValveConfigurationAndControlTargetState : public Subscri #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL -/* - * Attribute StartUpState - */ -class ReadValveConfigurationAndControlStartUpState : public ReadAttribute { -public: - ReadValveConfigurationAndControlStartUpState() - : ReadAttribute("start-up-state") - { - } - - ~ReadValveConfigurationAndControlStartUpState() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::StartUpState::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 = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeStartUpStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ValveConfigurationAndControl.StartUpState response %@", [value description]); - if (error == nil) { - RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); - } else { - LogNSError("ValveConfigurationAndControl StartUpState read Error", error); - RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteValveConfigurationAndControlStartUpState : public WriteAttribute { -public: - WriteValveConfigurationAndControlStartUpState() - : WriteAttribute("start-up-state") - { - AddArgument("attr-name", "start-up-state"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteValveConfigurationAndControlStartUpState() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::StartUpState::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 = [[MTRBaseClusterValveConfigurationAndControl 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 writeAttributeStartUpStateWithValue:value params:params completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("ValveConfigurationAndControl StartUpState write Error", error); - RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeValveConfigurationAndControlStartUpState : public SubscribeAttribute { -public: - SubscribeAttributeValveConfigurationAndControlStartUpState() - : SubscribeAttribute("start-up-state") - { - } - - ~SubscribeAttributeValveConfigurationAndControlStartUpState() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; - constexpr chip::CommandId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::StartUpState::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 = [[MTRBaseClusterValveConfigurationAndControl 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 subscribeAttributeStartUpStateWithParams:params - subscriptionEstablished:^() { mSubscriptionEstablished = YES; } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ValveConfigurationAndControl.StartUpState 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 CurrentLevel */ @@ -75288,34 +75153,34 @@ class SubscribeAttributeValveConfigurationAndControlTargetLevel : public Subscri #if MTR_ENABLE_PROVISIONAL /* - * Attribute OpenLevel + * Attribute DefaultOpenLevel */ -class ReadValveConfigurationAndControlOpenLevel : public ReadAttribute { +class ReadValveConfigurationAndControlDefaultOpenLevel : public ReadAttribute { public: - ReadValveConfigurationAndControlOpenLevel() - : ReadAttribute("open-level") + ReadValveConfigurationAndControlDefaultOpenLevel() + : ReadAttribute("default-open-level") { } - ~ReadValveConfigurationAndControlOpenLevel() + ~ReadValveConfigurationAndControlDefaultOpenLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::OpenLevel::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::DefaultOpenLevel::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 = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeOpenLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ValveConfigurationAndControl.OpenLevel response %@", [value description]); + [cluster readAttributeDefaultOpenLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ValveConfigurationAndControl.DefaultOpenLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { - LogNSError("ValveConfigurationAndControl OpenLevel read Error", error); + LogNSError("ValveConfigurationAndControl DefaultOpenLevel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); @@ -75324,24 +75189,24 @@ class ReadValveConfigurationAndControlOpenLevel : public ReadAttribute { } }; -class WriteValveConfigurationAndControlOpenLevel : public WriteAttribute { +class WriteValveConfigurationAndControlDefaultOpenLevel : public WriteAttribute { public: - WriteValveConfigurationAndControlOpenLevel() - : WriteAttribute("open-level") + WriteValveConfigurationAndControlDefaultOpenLevel() + : WriteAttribute("default-open-level") { - AddArgument("attr-name", "open-level"); + AddArgument("attr-name", "default-open-level"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } - ~WriteValveConfigurationAndControlOpenLevel() + ~WriteValveConfigurationAndControlDefaultOpenLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::OpenLevel::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::DefaultOpenLevel::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); @@ -75349,14 +75214,11 @@ class WriteValveConfigurationAndControlOpenLevel : public WriteAttribute { __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 * _Nullable value = nil; - if (!mValue.IsNull()) { - value = [NSNumber numberWithUnsignedChar:mValue.Value()]; - } + NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - [cluster writeAttributeOpenLevelWithValue:value params:params completion:^(NSError * _Nullable error) { + [cluster writeAttributeDefaultOpenLevelWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { - LogNSError("ValveConfigurationAndControl OpenLevel write Error", error); + LogNSError("ValveConfigurationAndControl DefaultOpenLevel write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); @@ -75365,24 +75227,24 @@ class WriteValveConfigurationAndControlOpenLevel : public WriteAttribute { } private: - chip::app::DataModel::Nullable mValue; + chip::Percent mValue; }; -class SubscribeAttributeValveConfigurationAndControlOpenLevel : public SubscribeAttribute { +class SubscribeAttributeValveConfigurationAndControlDefaultOpenLevel : public SubscribeAttribute { public: - SubscribeAttributeValveConfigurationAndControlOpenLevel() - : SubscribeAttribute("open-level") + SubscribeAttributeValveConfigurationAndControlDefaultOpenLevel() + : SubscribeAttribute("default-open-level") { } - ~SubscribeAttributeValveConfigurationAndControlOpenLevel() + ~SubscribeAttributeValveConfigurationAndControlDefaultOpenLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; - constexpr chip::CommandId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::OpenLevel::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::DefaultOpenLevel::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); @@ -75397,10 +75259,10 @@ class SubscribeAttributeValveConfigurationAndControlOpenLevel : public Subscribe if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } - [cluster subscribeAttributeOpenLevelWithParams:params + [cluster subscribeAttributeDefaultOpenLevelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ValveConfigurationAndControl.OpenLevel response %@", [value description]); + NSLog(@"ValveConfigurationAndControl.DefaultOpenLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { @@ -176353,18 +176215,18 @@ void registerClusterValveConfigurationAndControl(Commands & commands) #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(), // 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(), // @@ -176381,11 +176243,6 @@ void registerClusterValveConfigurationAndControl(Commands & commands) 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(), // @@ -176395,9 +176252,9 @@ void registerClusterValveConfigurationAndControl(Commands & commands) make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL - make_unique(), // - make_unique(), // - make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), //