From e7902afb049273264d8a8feb3ef4428d96b04248 Mon Sep 17 00:00:00 2001 From: senthil kumar E K Date: Thu, 13 Feb 2025 18:31:00 +0530 Subject: [PATCH 1/7] closure control cluster XML genartion with alchemy --- .github/workflows/tests.yaml | 1 + scripts/rules.matterlint | 1 + .../chip/closure-control-cluster.xml | 250 ++++++++++++++++++ .../zcl/zcl-with-test-extensions.json | 1 + src/app/zap-templates/zcl/zcl.json | 1 + src/app/zap_cluster_list.json | 2 + 6 files changed, 256 insertions(+) create mode 100644 src/app/zap-templates/zcl/data-model/chip/closure-control-cluster.xml diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index d742598edb1614..c001a6385a9783 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -93,6 +93,7 @@ jobs: --log-level info \ src/app/zap-templates/zcl/data-model/chip/global-attributes.xml \ src/app/zap-templates/zcl/data-model/chip/chime-cluster.xml \ + src/app/zap-templates/zcl/data-model/chip/closure-control-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/global-bitmaps.xml \ src/app/zap-templates/zcl/data-model/chip/global-enums.xml \ src/app/zap-templates/zcl/data-model/chip/global-structs.xml \ diff --git a/scripts/rules.matterlint b/scripts/rules.matterlint index ad2a2b04a190da..5e1f8959119d57 100644 --- a/scripts/rules.matterlint +++ b/scripts/rules.matterlint @@ -20,6 +20,7 @@ load "../src/app/zap-templates/zcl/data-model/chip/channel-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/chime-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/chip-ota.xml"; load "../src/app/zap-templates/zcl/data-model/chip/chip-types.xml"; +load "../src/app/zap-templates/zcl/data-model/chip/closure-control-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/clusters-extensions.xml"; load "../src/app/zap-templates/zcl/data-model/chip/color-control-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/commissioner-control-cluster.xml"; diff --git a/src/app/zap-templates/zcl/data-model/chip/closure-control-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/closure-control-cluster.xml new file mode 100644 index 00000000000000..2c5fe3cd02288b --- /dev/null +++ b/src/app/zap-templates/zcl/data-model/chip/closure-control-cluster.xml @@ -0,0 +1,250 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Closures + Closure Control + 0x0104 + CLOSURE_CONTROL_CLUSTER + + true + true + + + CountdownTime + + + MainState + CurrentErrorList + OverallState + OverallTarget + + RestingProcedure + + + + + + TriggerCondition + + + + + + TriggerPosition + + + + + + WaitingDelay + + + + + + KickoffTimer + + + + + + On receipt of this command, the device SHALL stop its operation if it is at a position where it is safe to do so and/or permitted. + + + + + + + + + Upon receipt, this SHALL move the product in the most fitting state following the data as follows: + + + + + + + Upon receipt, this SHALL initiate a calibration. + + + + + + + + Upon receipt, this SHALL configure the Fallback feature behavior using the data as follows: + + + + + + + + + + + Upon receipt, this SHALL cancel the current PendingFallback. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/app/zap-templates/zcl/zcl-with-test-extensions.json b/src/app/zap-templates/zcl/zcl-with-test-extensions.json index 5a9636d4b3ff1c..d532ca61e860b8 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -32,6 +32,7 @@ "chime-cluster.xml", "chip-ota.xml", "channel-cluster.xml", + "closure-control-cluster.xml", "clusters-extensions.xml", "color-control-cluster.xml", "commissioner-control-cluster.xml", diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index 64ec88e471fd21..35b21709743f3f 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -27,6 +27,7 @@ "chime-cluster.xml", "chip-ota.xml", "channel-cluster.xml", + "closure-control-cluster.xml", "clusters-extensions.xml", "color-control-cluster.xml", "commissioner-control-cluster.xml", diff --git a/src/app/zap_cluster_list.json b/src/app/zap_cluster_list.json index 971d7abede1c89..64daf5314d6c7c 100644 --- a/src/app/zap_cluster_list.json +++ b/src/app/zap_cluster_list.json @@ -23,6 +23,7 @@ "CHANNEL_CLUSTER": [], "CHIME_CLUSTER": [], "CLIENT_MONITORING_CLUSTER": [], + "CLOSURE_CONTROL_CLUSTER": [], "COLOR_CONTROL_CLUSTER": [], "COMMISSIONER_CONTROL_CLUSTER": [], "COMMISSIONING_CLUSTER": [], @@ -176,6 +177,7 @@ ], "CHANNEL_CLUSTER": ["channel-server"], "CHIME_CLUSTER": ["chime-server"], + "CLOSURE_CONTROL_CLUSTER": [], "COLOR_CONTROL_CLUSTER": ["color-control-server"], "COMMISSIONER_CONTROL_CLUSTER": ["commissioner-control-server"], "COMMISSIONING_CLUSTER": [], From c49578f8f120afa7bfe3d7fa8b1d90353e3d90da Mon Sep 17 00:00:00 2001 From: senthil kumar E K Date: Fri, 14 Feb 2025 11:24:18 +0530 Subject: [PATCH 2/7] closure control cluster zap generated code --- docs/ids_and_codes/zap_clusters.md | 1 + .../app-templates/gen_config.h | 2 + .../lighting-app/app-templates/gen_config.h | 2 + .../chip/closure-control-cluster.xml | 9 +- .../zcl/zcl-with-test-extensions.json | 5 + src/app/zap-templates/zcl/zcl.json | 5 + .../data_model/controller-clusters.matter | 141 ++ .../chip/devicecontroller/ChipClusters.java | 587 ++++++ .../chip/devicecontroller/ChipStructs.java | 167 ++ .../devicecontroller/ClusterIDMapping.java | 152 ++ .../devicecontroller/ClusterInfoMapping.java | 272 +++ .../devicecontroller/ClusterReadMapping.java | 159 ++ .../devicecontroller/ClusterWriteMapping.java | 2 + .../chip/devicecontroller/cluster/files.gni | 2 + ...ClosureControlClusterOverallStateStruct.kt | 102 + ...losureControlClusterOverallTargetStruct.kt | 89 + .../cluster/clusters/ClosureControlCluster.kt | 1735 +++++++++++++++++ .../java/matter/controller/cluster/files.gni | 3 + ...ClosureControlClusterOverallStateStruct.kt | 102 + ...losureControlClusterOverallTargetStruct.kt | 89 + .../CHIPAttributeTLVValueDecoder.cpp | 460 +++++ .../CHIPEventTLVValueDecoder.cpp | 10 + .../python/chip/clusters/CHIPClusters.py | 137 ++ .../python/chip/clusters/Objects.py | 518 +++++ .../MTRAttributeSpecifiedCheck.mm | 57 + .../MTRAttributeTLVValueDecoder.mm | 187 ++ .../CHIP/zap-generated/MTRBaseClusters.h | 238 +++ .../CHIP/zap-generated/MTRBaseClusters.mm | 685 +++++++ .../CHIP/zap-generated/MTRClusterConstants.h | 25 + .../CHIP/zap-generated/MTRClusterNames.mm | 124 ++ .../CHIP/zap-generated/MTRClusters.h | 70 + .../CHIP/zap-generated/MTRClusters.mm | 234 +++ .../zap-generated/MTRCommandPayloadsObjc.h | 154 ++ .../zap-generated/MTRCommandPayloadsObjc.mm | 428 ++++ .../MTRCommandPayloads_Internal.h | 30 + .../zap-generated/MTRCommandTimedCheck.mm | 12 + .../zap-generated/MTREventTLVValueDecoder.mm | 15 + .../CHIP/zap-generated/MTRStructsObjc.h | 15 + .../CHIP/zap-generated/MTRStructsObjc.mm | 69 + .../zap-generated/attributes/Accessors.cpp | 429 ++++ .../zap-generated/attributes/Accessors.h | 67 + .../app-common/zap-generated/callback.h | 74 + .../zap-generated/cluster-enums-check.h | 133 ++ .../app-common/zap-generated/cluster-enums.h | 150 ++ .../zap-generated/cluster-objects.cpp | 308 +++ .../zap-generated/cluster-objects.h | 440 +++++ .../app-common/zap-generated/ids/Attributes.h | 66 + .../app-common/zap-generated/ids/Clusters.h | 3 + .../app-common/zap-generated/ids/Commands.h | 26 + .../zap-generated/cluster/Commands.h | 320 +++ .../cluster/ComplexArgumentParser.cpp | 90 + .../cluster/ComplexArgumentParser.h | 10 + .../cluster/logging/DataModelLogger.cpp | 155 ++ .../cluster/logging/DataModelLogger.h | 6 + .../cluster/logging/EntryToText.cpp | 56 + .../zap-generated/cluster/Commands.h | 1704 ++++++++++++++++ 56 files changed, 11129 insertions(+), 2 deletions(-) create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ClosureControlClusterOverallStateStruct.kt create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ClosureControlClusterOverallTargetStruct.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/clusters/ClosureControlCluster.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/ClosureControlClusterOverallStateStruct.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/ClosureControlClusterOverallTargetStruct.kt diff --git a/docs/ids_and_codes/zap_clusters.md b/docs/ids_and_codes/zap_clusters.md index e5cd002d72c223..f1e018fcf471af 100644 --- a/docs/ids_and_codes/zap_clusters.md +++ b/docs/ids_and_codes/zap_clusters.md @@ -89,6 +89,7 @@ Generally regenerate using one of: | 159 | 0x9F | DeviceEnergyManagementMode | | 257 | 0x101 | DoorLock | | 258 | 0x102 | WindowCovering | +| 260 | 0x104 | ClosureControl | | 336 | 0x150 | ServiceArea | | 512 | 0x200 | PumpConfigurationAndControl | | 513 | 0x201 | Thermostat | diff --git a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/gen_config.h b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/gen_config.h index 8339313e052548..53a63cd305b7ba 100644 --- a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/gen_config.h +++ b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/gen_config.h @@ -98,6 +98,7 @@ #define MATTER_DM_DEVICE_ENERGY_MANAGEMENT_MODE_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define MATTER_DM_DOOR_LOCK_CLUSTER_SERVER_ENDPOINT_COUNT (0) #define MATTER_DM_WINDOW_COVERING_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define MATTER_DM_CLOSURE_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (0) #define MATTER_DM_SERVICE_AREA_CLUSTER_SERVER_ENDPOINT_COUNT (0) #define MATTER_DM_PUMP_CONFIGURATION_AND_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT (1) @@ -229,6 +230,7 @@ #define MATTER_DM_DEVICE_ENERGY_MANAGEMENT_MODE_CLUSTER_CLIENT_ENDPOINT_COUNT (0) #define MATTER_DM_DOOR_LOCK_CLUSTER_CLIENT_ENDPOINT_COUNT (0) #define MATTER_DM_WINDOW_COVERING_CLUSTER_CLIENT_ENDPOINT_COUNT (0) +#define MATTER_DM_CLOSURE_CONTROL_CLUSTER_CLIENT_ENDPOINT_COUNT (0) #define MATTER_DM_SERVICE_AREA_CLUSTER_CLIENT_ENDPOINT_COUNT (0) #define MATTER_DM_PUMP_CONFIGURATION_AND_CONTROL_CLUSTER_CLIENT_ENDPOINT_COUNT (0) #define MATTER_DM_THERMOSTAT_CLUSTER_CLIENT_ENDPOINT_COUNT (0) diff --git a/scripts/tools/zap/tests/outputs/lighting-app/app-templates/gen_config.h b/scripts/tools/zap/tests/outputs/lighting-app/app-templates/gen_config.h index 3a34ba24d6a57f..a844fceb4e80d0 100644 --- a/scripts/tools/zap/tests/outputs/lighting-app/app-templates/gen_config.h +++ b/scripts/tools/zap/tests/outputs/lighting-app/app-templates/gen_config.h @@ -98,6 +98,7 @@ #define MATTER_DM_DEVICE_ENERGY_MANAGEMENT_MODE_CLUSTER_SERVER_ENDPOINT_COUNT (0) #define MATTER_DM_DOOR_LOCK_CLUSTER_SERVER_ENDPOINT_COUNT (0) #define MATTER_DM_WINDOW_COVERING_CLUSTER_SERVER_ENDPOINT_COUNT (0) +#define MATTER_DM_CLOSURE_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (0) #define MATTER_DM_SERVICE_AREA_CLUSTER_SERVER_ENDPOINT_COUNT (0) #define MATTER_DM_PUMP_CONFIGURATION_AND_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (0) #define MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT (0) @@ -229,6 +230,7 @@ #define MATTER_DM_DEVICE_ENERGY_MANAGEMENT_MODE_CLUSTER_CLIENT_ENDPOINT_COUNT (0) #define MATTER_DM_DOOR_LOCK_CLUSTER_CLIENT_ENDPOINT_COUNT (0) #define MATTER_DM_WINDOW_COVERING_CLUSTER_CLIENT_ENDPOINT_COUNT (0) +#define MATTER_DM_CLOSURE_CONTROL_CLUSTER_CLIENT_ENDPOINT_COUNT (0) #define MATTER_DM_SERVICE_AREA_CLUSTER_CLIENT_ENDPOINT_COUNT (0) #define MATTER_DM_PUMP_CONFIGURATION_AND_CONTROL_CLUSTER_CLIENT_ENDPOINT_COUNT (0) #define MATTER_DM_THERMOSTAT_CLUSTER_CLIENT_ENDPOINT_COUNT (0) diff --git a/src/app/zap-templates/zcl/data-model/chip/closure-control-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/closure-control-cluster.xml index 2c5fe3cd02288b..3fcd9c8b57c872 100644 --- a/src/app/zap-templates/zcl/data-model/chip/closure-control-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/closure-control-cluster.xml @@ -93,6 +93,11 @@ Git: 0.7-summer-2025-5-g06c4d5596-dirty + + + + + @@ -139,7 +144,7 @@ Git: 0.7-summer-2025-5-g06c4d5596-dirty - + TriggerPosition @@ -185,7 +190,7 @@ Git: 0.7-summer-2025-5-g06c4d5596-dirty Upon receipt, this SHALL configure the Fallback feature behavior using the data as follows: - + diff --git a/src/app/zap-templates/zcl/zcl-with-test-extensions.json b/src/app/zap-templates/zcl/zcl-with-test-extensions.json index d532ca61e860b8..4589ff436eab4c 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -201,6 +201,11 @@ ], "Bridged Device Basic Information": ["ProductAppearance"], "Chime": ["ActiveChimeID", "Enabled"], + "Closure Control": [ + "OverallState", + "OverallTarget", + "FeatureMap" + ], "Descriptor": ["ClusterRevision", "FeatureMap"], "Device Energy Management": [ "ESAType", diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index 35b21709743f3f..c14cb2aeaa039b 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -195,6 +195,11 @@ ], "Bridged Device Basic Information": ["ProductAppearance"], "Chime": ["ActiveChimeID", "Enabled"], + "Closure Control": [ + "OverallState", + "OverallTarget", + "FeatureMap" + ], "Descriptor": ["ClusterRevision", "FeatureMap"], "Device Energy Management": [ "ESAType", diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 2c9d83a6046910..776f74d9416295 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -6478,6 +6478,147 @@ cluster WindowCovering = 258 { command GoToTiltPercentage(GoToTiltPercentageRequest): DefaultSuccess = 8; } +/** */ +cluster ClosureControl = 260 { + revision 1; + + enum ClosureErrorEnum : enum8 { + kBlocked = 0; + kTemperatureLimited = 1; + kMaintenanceRequired = 2; + kInternalInterference = 3; + } + + enum LatchingEnum : enum8 { + kLatchedAndSecured = 0; + kLatchedButNotSecured = 1; + kNotLatched = 2; + } + + enum MainStateEnum : enum8 { + kStopped = 0; + kMoving = 1; + kWaitingForMotion = 2; + kError = 3; + kCalibrating = 4; + kProtected = 5; + kDisengaged = 6; + kSetupRequired = 7; + kPendingFallback = 8; + } + + enum PositioningEnum : enum8 { + kFullyClosed = 0; + kFullyOpened = 1; + kPartiallyOpened = 2; + kOpenedForPedestrian = 3; + kOpenedForVentilation = 4; + kOpenedAtSignature = 5; + } + + enum RestingProcedureEnum : enum8 { + kDoNothing = 0; + kReturnToFullyOpened = 1; + kReturnToFullyClosed = 2; + } + + enum TagLatchEnum : enum8 { + kLatch = 0; + kUnlatch = 1; + } + + enum TagPositionEnum : enum8 { + kCloseInFull = 0; + kOpenInFull = 1; + kPedestrian = 2; + kVentilation = 3; + kSignature = 4; + kSequenceNextStep = 5; + kPedestrianNextStep = 6; + } + + enum TriggerConditionEnum : enum8 { + kAfterDelay = 0; + kAfterApplicativeTrigger = 1; + kAfterDelayOrApplicativeTrigger = 2; + } + + enum TriggerPositionEnum : enum8 { + kAtFullyClosed = 0; + kAtFullyOpened = 1; + kInBetween = 2; + kAtVentilation = 3; + kAtPedestrian = 4; + } + + bitmap Feature : bitmap32 { + kPositioning = 0x1; + kMotionLatching = 0x2; + kInstantaneous = 0x4; + kSpeed = 0x8; + kVentilation = 0x10; + kPedestrian = 0x20; + kCalibration = 0x40; + kProtection = 0x80; + kManuallyOperable = 0x100; + kFallback = 0x200; + } + + struct OverallStateStruct { + optional PositioningEnum positioning = 0; + optional LatchingEnum latching = 1; + optional ThreeLevelAutoEnum speed = 2; + optional bitmap32 extraInfo = 3; + } + + struct OverallTargetStruct { + optional TagPositionEnum tagPosition = 0; + optional TagLatchEnum tagLatch = 1; + optional ThreeLevelAutoEnum speed = 2; + } + + readonly attribute optional nullable elapsed_s countdownTime = 0; + readonly attribute MainStateEnum mainState = 1; + readonly attribute ClosureErrorEnum currentErrorList[] = 2; + readonly attribute nullable OverallStateStruct overallState = 3; + readonly attribute nullable OverallTargetStruct overallTarget = 4; + readonly attribute optional RestingProcedureEnum restingProcedure = 5; + readonly attribute optional TriggerConditionEnum triggerCondition = 6; + readonly attribute optional TriggerPositionEnum triggerPosition = 7; + readonly attribute optional elapsed_s waitingDelay = 8; + readonly attribute optional elapsed_s kickoffTimer = 9; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct MoveToRequest { + optional TagPositionEnum tag = 0; + optional TagLatchEnum latch = 1; + optional ThreeLevelAutoEnum speed = 2; + } + + request struct ConfigureFallbackRequest { + optional RestingProcedureEnum restingProcedure = 0; + optional TriggerConditionEnum triggerCondition = 1; + optional TriggerPositionEnum triggerPosition = 2; + optional elapsed_s waitingDelay = 3; + } + + /** On receipt of this command, the device SHALL stop its operation if it is at a position where it is safe to do so and/or permitted. */ + command Stop(): DefaultSuccess = 0; + /** Upon receipt, this SHALL move the product in the most fitting state following the data as follows: */ + command MoveTo(MoveToRequest): DefaultSuccess = 1; + /** Upon receipt, this SHALL initiate a calibration. */ + command access(invoke: manage) Calibrate(): DefaultSuccess = 2; + /** Upon receipt, this SHALL configure the Fallback feature behavior using the data as follows: */ + command ConfigureFallback(ConfigureFallbackRequest): DefaultSuccess = 3; + /** Upon receipt, this SHALL cancel the current PendingFallback. */ + command CancelFallback(): DefaultSuccess = 4; +} + /** The Service Area cluster provides an interface for controlling the areas where a device should operate, and for querying the current area being serviced. */ provisional cluster ServiceArea = 336 { revision 1; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index 11f48e86beedee..b38d2b97c23bc5 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -37544,6 +37544,593 @@ public void onSuccess(byte[] tlv) { } } + public static class ClosureControlCluster extends BaseChipCluster { + public static final long CLUSTER_ID = 260L; + + private static final long COUNTDOWN_TIME_ATTRIBUTE_ID = 0L; + private static final long MAIN_STATE_ATTRIBUTE_ID = 1L; + private static final long CURRENT_ERROR_LIST_ATTRIBUTE_ID = 2L; + private static final long OVERALL_STATE_ATTRIBUTE_ID = 3L; + private static final long OVERALL_TARGET_ATTRIBUTE_ID = 4L; + private static final long RESTING_PROCEDURE_ATTRIBUTE_ID = 5L; + private static final long TRIGGER_CONDITION_ATTRIBUTE_ID = 6L; + private static final long TRIGGER_POSITION_ATTRIBUTE_ID = 7L; + private static final long WAITING_DELAY_ATTRIBUTE_ID = 8L; + private static final long KICKOFF_TIMER_ATTRIBUTE_ID = 9L; + private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L; + private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L; + private static final long EVENT_LIST_ATTRIBUTE_ID = 65530L; + private static final long ATTRIBUTE_LIST_ATTRIBUTE_ID = 65531L; + private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L; + private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L; + + public ClosureControlCluster(long devicePtr, int endpointId) { + super(devicePtr, endpointId, CLUSTER_ID); + } + + @Override + @Deprecated + public long initWithDevice(long devicePtr, int endpointId) { + return 0L; + } + + public void stop(DefaultClusterCallback callback) { + stop(callback, 0); + } + + public void stop(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + final long commandId = 0L; + + ArrayList elements = new ArrayList<>(); + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public void moveTo(DefaultClusterCallback callback, Optional tag, Optional latch, Optional speed) { + moveTo(callback, tag, latch, speed, 0); + } + + public void moveTo(DefaultClusterCallback callback, Optional tag, Optional latch, Optional speed, int timedInvokeTimeoutMs) { + final long commandId = 1L; + + ArrayList elements = new ArrayList<>(); + final long tagFieldID = 0L; + BaseTLVType tagtlvValue = tag.map((nonOptionaltag) -> new UIntType(nonOptionaltag)).orElse(new EmptyType()); + elements.add(new StructElement(tagFieldID, tagtlvValue)); + + final long latchFieldID = 1L; + BaseTLVType latchtlvValue = latch.map((nonOptionallatch) -> new UIntType(nonOptionallatch)).orElse(new EmptyType()); + elements.add(new StructElement(latchFieldID, latchtlvValue)); + + final long speedFieldID = 2L; + BaseTLVType speedtlvValue = speed.map((nonOptionalspeed) -> new UIntType(nonOptionalspeed)).orElse(new EmptyType()); + elements.add(new StructElement(speedFieldID, speedtlvValue)); + + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public void calibrate(DefaultClusterCallback callback) { + calibrate(callback, 0); + } + + public void calibrate(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + final long commandId = 2L; + + ArrayList elements = new ArrayList<>(); + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public void configureFallback(DefaultClusterCallback callback, Optional restingProcedure, Optional triggerCondition, Optional triggerPosition, Optional waitingDelay) { + configureFallback(callback, restingProcedure, triggerCondition, triggerPosition, waitingDelay, 0); + } + + public void configureFallback(DefaultClusterCallback callback, Optional restingProcedure, Optional triggerCondition, Optional triggerPosition, Optional waitingDelay, int timedInvokeTimeoutMs) { + final long commandId = 3L; + + ArrayList elements = new ArrayList<>(); + final long restingProcedureFieldID = 0L; + BaseTLVType restingProceduretlvValue = restingProcedure.map((nonOptionalrestingProcedure) -> new UIntType(nonOptionalrestingProcedure)).orElse(new EmptyType()); + elements.add(new StructElement(restingProcedureFieldID, restingProceduretlvValue)); + + final long triggerConditionFieldID = 1L; + BaseTLVType triggerConditiontlvValue = triggerCondition.map((nonOptionaltriggerCondition) -> new UIntType(nonOptionaltriggerCondition)).orElse(new EmptyType()); + elements.add(new StructElement(triggerConditionFieldID, triggerConditiontlvValue)); + + final long triggerPositionFieldID = 2L; + BaseTLVType triggerPositiontlvValue = triggerPosition.map((nonOptionaltriggerPosition) -> new UIntType(nonOptionaltriggerPosition)).orElse(new EmptyType()); + elements.add(new StructElement(triggerPositionFieldID, triggerPositiontlvValue)); + + final long waitingDelayFieldID = 3L; + BaseTLVType waitingDelaytlvValue = waitingDelay.map((nonOptionalwaitingDelay) -> new UIntType(nonOptionalwaitingDelay)).orElse(new EmptyType()); + elements.add(new StructElement(waitingDelayFieldID, waitingDelaytlvValue)); + + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public void cancelFallback(DefaultClusterCallback callback) { + cancelFallback(callback, 0); + } + + public void cancelFallback(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + final long commandId = 4L; + + ArrayList elements = new ArrayList<>(); + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public interface CountdownTimeAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable Long value); + } + + public interface CurrentErrorListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface OverallStateAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable ChipStructs.ClosureControlClusterOverallStateStruct value); + } + + public interface OverallTargetAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable ChipStructs.ClosureControlClusterOverallTargetStruct value); + } + + public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface AcceptedCommandListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface EventListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface AttributeListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public void readCountdownTimeAttribute( + CountdownTimeAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COUNTDOWN_TIME_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, COUNTDOWN_TIME_ATTRIBUTE_ID, true); + } + + public void subscribeCountdownTimeAttribute( + CountdownTimeAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COUNTDOWN_TIME_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, COUNTDOWN_TIME_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readMainStateAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, MAIN_STATE_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, MAIN_STATE_ATTRIBUTE_ID, true); + } + + public void subscribeMainStateAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, MAIN_STATE_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, MAIN_STATE_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readCurrentErrorListAttribute( + CurrentErrorListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_ERROR_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CURRENT_ERROR_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeCurrentErrorListAttribute( + CurrentErrorListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_ERROR_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CURRENT_ERROR_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readOverallStateAttribute( + OverallStateAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, OVERALL_STATE_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable ChipStructs.ClosureControlClusterOverallStateStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, OVERALL_STATE_ATTRIBUTE_ID, true); + } + + public void subscribeOverallStateAttribute( + OverallStateAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, OVERALL_STATE_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable ChipStructs.ClosureControlClusterOverallStateStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, OVERALL_STATE_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readOverallTargetAttribute( + OverallTargetAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, OVERALL_TARGET_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable ChipStructs.ClosureControlClusterOverallTargetStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, OVERALL_TARGET_ATTRIBUTE_ID, true); + } + + public void subscribeOverallTargetAttribute( + OverallTargetAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, OVERALL_TARGET_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable ChipStructs.ClosureControlClusterOverallTargetStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, OVERALL_TARGET_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readRestingProcedureAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, RESTING_PROCEDURE_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, RESTING_PROCEDURE_ATTRIBUTE_ID, true); + } + + public void subscribeRestingProcedureAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, RESTING_PROCEDURE_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, RESTING_PROCEDURE_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readTriggerConditionAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, TRIGGER_CONDITION_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, TRIGGER_CONDITION_ATTRIBUTE_ID, true); + } + + public void subscribeTriggerConditionAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, TRIGGER_CONDITION_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, TRIGGER_CONDITION_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readTriggerPositionAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, TRIGGER_POSITION_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, TRIGGER_POSITION_ATTRIBUTE_ID, true); + } + + public void subscribeTriggerPositionAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, TRIGGER_POSITION_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, TRIGGER_POSITION_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readWaitingDelayAttribute( + LongAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, WAITING_DELAY_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, WAITING_DELAY_ATTRIBUTE_ID, true); + } + + public void subscribeWaitingDelayAttribute( + LongAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, WAITING_DELAY_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, WAITING_DELAY_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readKickoffTimerAttribute( + LongAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, KICKOFF_TIMER_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, KICKOFF_TIMER_ATTRIBUTE_ID, true); + } + + public void subscribeKickoffTimerAttribute( + LongAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, KICKOFF_TIMER_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, KICKOFF_TIMER_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readGeneratedCommandListAttribute( + GeneratedCommandListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeGeneratedCommandListAttribute( + GeneratedCommandListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readAcceptedCommandListAttribute( + AcceptedCommandListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeAcceptedCommandListAttribute( + AcceptedCommandListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readEventListAttribute( + EventListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, EVENT_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeEventListAttribute( + EventListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readAttributeListAttribute( + AttributeListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ATTRIBUTE_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ATTRIBUTE_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ATTRIBUTE_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readFeatureMapAttribute( + LongAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FEATURE_MAP_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, FEATURE_MAP_ATTRIBUTE_ID, true); + } + + public void subscribeFeatureMapAttribute( + LongAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FEATURE_MAP_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readClusterRevisionAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CLUSTER_REVISION_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CLUSTER_REVISION_ATTRIBUTE_ID, true); + } + + public void subscribeClusterRevisionAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CLUSTER_REVISION_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); + } + } + public static class ServiceAreaCluster extends BaseChipCluster { public static final long CLUSTER_ID = 336L; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index 88fa4ac440e12b..dcedf7c0539591 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -9292,6 +9292,173 @@ public String toString() { return output.toString(); } } +public static class ClosureControlClusterOverallStateStruct { + public Optional positioning; + public Optional latching; + public Optional speed; + public Optional extraInfo; + private static final long POSITIONING_ID = 0L; + private static final long LATCHING_ID = 1L; + private static final long SPEED_ID = 2L; + private static final long EXTRA_INFO_ID = 3L; + + public ClosureControlClusterOverallStateStruct( + Optional positioning, + Optional latching, + Optional speed, + Optional extraInfo + ) { + this.positioning = positioning; + this.latching = latching; + this.speed = speed; + this.extraInfo = extraInfo; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(POSITIONING_ID, positioning.map((nonOptionalpositioning) -> new UIntType(nonOptionalpositioning)).orElse(new EmptyType()))); + values.add(new StructElement(LATCHING_ID, latching.map((nonOptionallatching) -> new UIntType(nonOptionallatching)).orElse(new EmptyType()))); + values.add(new StructElement(SPEED_ID, speed.map((nonOptionalspeed) -> new UIntType(nonOptionalspeed)).orElse(new EmptyType()))); + values.add(new StructElement(EXTRA_INFO_ID, extraInfo.map((nonOptionalextraInfo) -> new UIntType(nonOptionalextraInfo)).orElse(new EmptyType()))); + + return new StructType(values); + } + + public static ClosureControlClusterOverallStateStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Optional positioning = Optional.empty(); + Optional latching = Optional.empty(); + Optional speed = Optional.empty(); + Optional extraInfo = Optional.empty(); + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == POSITIONING_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + positioning = Optional.of(castingValue.value(Integer.class)); + } + } else if (element.contextTagNum() == LATCHING_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + latching = Optional.of(castingValue.value(Integer.class)); + } + } else if (element.contextTagNum() == SPEED_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + speed = Optional.of(castingValue.value(Integer.class)); + } + } else if (element.contextTagNum() == EXTRA_INFO_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + extraInfo = Optional.of(castingValue.value(Long.class)); + } + } + } + return new ClosureControlClusterOverallStateStruct( + positioning, + latching, + speed, + extraInfo + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ClosureControlClusterOverallStateStruct {\n"); + output.append("\tpositioning: "); + output.append(positioning); + output.append("\n"); + output.append("\tlatching: "); + output.append(latching); + output.append("\n"); + output.append("\tspeed: "); + output.append(speed); + output.append("\n"); + output.append("\textraInfo: "); + output.append(extraInfo); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class ClosureControlClusterOverallTargetStruct { + public Optional tagPosition; + public Optional tagLatch; + public Optional speed; + private static final long TAG_POSITION_ID = 0L; + private static final long TAG_LATCH_ID = 1L; + private static final long SPEED_ID = 2L; + + public ClosureControlClusterOverallTargetStruct( + Optional tagPosition, + Optional tagLatch, + Optional speed + ) { + this.tagPosition = tagPosition; + this.tagLatch = tagLatch; + this.speed = speed; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(TAG_POSITION_ID, tagPosition.map((nonOptionaltagPosition) -> new UIntType(nonOptionaltagPosition)).orElse(new EmptyType()))); + values.add(new StructElement(TAG_LATCH_ID, tagLatch.map((nonOptionaltagLatch) -> new UIntType(nonOptionaltagLatch)).orElse(new EmptyType()))); + values.add(new StructElement(SPEED_ID, speed.map((nonOptionalspeed) -> new UIntType(nonOptionalspeed)).orElse(new EmptyType()))); + + return new StructType(values); + } + + public static ClosureControlClusterOverallTargetStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Optional tagPosition = Optional.empty(); + Optional tagLatch = Optional.empty(); + Optional speed = Optional.empty(); + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == TAG_POSITION_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + tagPosition = Optional.of(castingValue.value(Integer.class)); + } + } else if (element.contextTagNum() == TAG_LATCH_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + tagLatch = Optional.of(castingValue.value(Integer.class)); + } + } else if (element.contextTagNum() == SPEED_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + speed = Optional.of(castingValue.value(Integer.class)); + } + } + } + return new ClosureControlClusterOverallTargetStruct( + tagPosition, + tagLatch, + speed + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ClosureControlClusterOverallTargetStruct {\n"); + output.append("\ttagPosition: "); + output.append(tagPosition); + output.append("\n"); + output.append("\ttagLatch: "); + output.append(tagLatch); + output.append("\n"); + output.append("\tspeed: "); + output.append(speed); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} public static class ServiceAreaClusterLandmarkInfoStruct { public Integer landmarkTag; public @Nullable Integer relativePositionTag; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java index a0718acb1c73b2..c8f8714a76dbaa 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java @@ -259,6 +259,9 @@ public static BaseCluster getCluster(long clusterId) { if (clusterId == WindowCovering.ID) { return new WindowCovering(); } + if (clusterId == ClosureControl.ID) { + return new ClosureControl(); + } if (clusterId == ServiceArea.ID) { return new ServiceArea(); } @@ -11295,6 +11298,155 @@ public long getCommandID(String name) throws IllegalArgumentException { return Command.valueOf(name).getID(); } } + public static class ClosureControl implements BaseCluster { + public static final long ID = 260L; + public long getID() { + return ID; + } + + public enum Attribute { + CountdownTime(0L), + MainState(1L), + CurrentErrorList(2L), + OverallState(3L), + OverallTarget(4L), + RestingProcedure(5L), + TriggerCondition(6L), + TriggerPosition(7L), + WaitingDelay(8L), + KickoffTimer(9L), + GeneratedCommandList(65528L), + AcceptedCommandList(65529L), + EventList(65530L), + AttributeList(65531L), + FeatureMap(65532L), + ClusterRevision(65533L),; + private final long id; + Attribute(long id) { + this.id = id; + } + + public long getID() { + return id; + } + + public static Attribute value(long id) throws NoSuchFieldError { + for (Attribute attribute : Attribute.values()) { + if (attribute.getID() == id) { + return attribute; + } + } + throw new NoSuchFieldError(); + } + } + + public enum Event {; + private final long id; + Event(long id) { + this.id = id; + } + + public long getID() { + return id; + } + + public static Event value(long id) throws NoSuchFieldError { + for (Event event : Event.values()) { + if (event.getID() == id) { + return event; + } + } + throw new NoSuchFieldError(); + } + } + + public enum Command { + Stop(0L), + MoveTo(1L), + Calibrate(2L), + ConfigureFallback(3L), + CancelFallback(4L),; + private final long id; + Command(long id) { + this.id = id; + } + + public long getID() { + return id; + } + + public static Command value(long id) throws NoSuchFieldError { + for (Command command : Command.values()) { + if (command.getID() == id) { + return command; + } + } + throw new NoSuchFieldError(); + } + }public enum MoveToCommandField {Tag(0),Latch(1),Speed(2),; + private final int id; + MoveToCommandField(int id) { + this.id = id; + } + + public int getID() { + return id; + } + public static MoveToCommandField value(int id) throws NoSuchFieldError { + for (MoveToCommandField field : MoveToCommandField.values()) { + if (field.getID() == id) { + return field; + } + } + throw new NoSuchFieldError(); + } + }public enum ConfigureFallbackCommandField {RestingProcedure(0),TriggerCondition(1),TriggerPosition(2),WaitingDelay(3),; + private final int id; + ConfigureFallbackCommandField(int id) { + this.id = id; + } + + public int getID() { + return id; + } + public static ConfigureFallbackCommandField value(int id) throws NoSuchFieldError { + for (ConfigureFallbackCommandField field : ConfigureFallbackCommandField.values()) { + if (field.getID() == id) { + return field; + } + } + throw new NoSuchFieldError(); + } + }@Override + public String getAttributeName(long id) throws NoSuchFieldError { + return Attribute.value(id).toString(); + } + + @Override + public String getEventName(long id) throws NoSuchFieldError { + return Event.value(id).toString(); + } + + @Override + public String getCommandName(long id) throws NoSuchFieldError { + return Command.value(id).toString(); + } + + @Override + public long getAttributeID(String name) throws IllegalArgumentException { + return Attribute.valueOf(name).getID(); + } + + @Override + public long getEventID(String name) throws IllegalArgumentException { + return Event.valueOf(name).getID(); + } + + @Override + public long getCommandID(String name) throws IllegalArgumentException { + return Command.valueOf(name).getID(); + } + } public static class ServiceArea implements BaseCluster { public static final long ID = 336L; public long getID() { diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java index 73cd2334b5614b..60e446a4b0ca58 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java @@ -12783,6 +12783,174 @@ public void onError(Exception ex) { } } + public static class DelegatedClosureControlClusterCountdownTimeAttributeCallback implements ChipClusters.ClosureControlCluster.CountdownTimeAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable Long value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedClosureControlClusterCurrentErrorListAttributeCallback implements ChipClusters.ClosureControlCluster.CurrentErrorListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedClosureControlClusterOverallStateAttributeCallback implements ChipClusters.ClosureControlCluster.OverallStateAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable ChipStructs.ClosureControlClusterOverallStateStruct value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "ChipStructs.ClosureControlClusterOverallStateStruct"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedClosureControlClusterOverallTargetAttributeCallback implements ChipClusters.ClosureControlCluster.OverallTargetAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable ChipStructs.ClosureControlClusterOverallTargetStruct value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "ChipStructs.ClosureControlClusterOverallTargetStruct"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedClosureControlClusterGeneratedCommandListAttributeCallback implements ChipClusters.ClosureControlCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedClosureControlClusterAcceptedCommandListAttributeCallback implements ChipClusters.ClosureControlCluster.AcceptedCommandListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedClosureControlClusterEventListAttributeCallback implements ChipClusters.ClosureControlCluster.EventListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedClosureControlClusterAttributeListAttributeCallback implements ChipClusters.ClosureControlCluster.AttributeListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + public static class DelegatedServiceAreaClusterSelectAreasResponseCallback implements ChipClusters.ServiceAreaCluster.SelectAreasResponseCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @@ -23599,6 +23767,10 @@ public Map initializeClusterMap() { (ptr, endpointId) -> new ChipClusters.WindowCoveringCluster(ptr, endpointId), new HashMap<>()); clusterMap.put("windowCovering", windowCoveringClusterInfo); + ClusterInfo closureControlClusterInfo = new ClusterInfo( + (ptr, endpointId) -> new ChipClusters.ClosureControlCluster(ptr, endpointId), new HashMap<>()); + clusterMap.put("closureControl", closureControlClusterInfo); + ClusterInfo serviceAreaClusterInfo = new ClusterInfo( (ptr, endpointId) -> new ChipClusters.ServiceAreaCluster(ptr, endpointId), new HashMap<>()); clusterMap.put("serviceArea", serviceAreaClusterInfo); @@ -23892,6 +24064,7 @@ public void combineCommand(Map destination, Map> getCommandMap() { commandMap.put("windowCovering", windowCoveringClusterInteractionInfoMap); + Map closureControlClusterInteractionInfoMap = new LinkedHashMap<>(); + + Map closureControlstopCommandParams = new LinkedHashMap(); + InteractionInfo closureControlstopInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ClosureControlCluster) cluster) + .stop((DefaultClusterCallback) callback + ); + }, + () -> new DelegatedDefaultClusterCallback(), + closureControlstopCommandParams + ); + closureControlClusterInteractionInfoMap.put("stop", closureControlstopInteractionInfo); + + Map closureControlmoveToCommandParams = new LinkedHashMap(); + + CommandParameterInfo closureControlmoveTotagCommandParameterInfo = new CommandParameterInfo("tag", Optional.class, Integer.class); + closureControlmoveToCommandParams.put("tag",closureControlmoveTotagCommandParameterInfo); + + CommandParameterInfo closureControlmoveTolatchCommandParameterInfo = new CommandParameterInfo("latch", Optional.class, Integer.class); + closureControlmoveToCommandParams.put("latch",closureControlmoveTolatchCommandParameterInfo); + + CommandParameterInfo closureControlmoveTospeedCommandParameterInfo = new CommandParameterInfo("speed", Optional.class, Integer.class); + closureControlmoveToCommandParams.put("speed",closureControlmoveTospeedCommandParameterInfo); + InteractionInfo closureControlmoveToInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ClosureControlCluster) cluster) + .moveTo((DefaultClusterCallback) callback + , (Optional) + commandArguments.get("tag") + , (Optional) + commandArguments.get("latch") + , (Optional) + commandArguments.get("speed") + ); + }, + () -> new DelegatedDefaultClusterCallback(), + closureControlmoveToCommandParams + ); + closureControlClusterInteractionInfoMap.put("moveTo", closureControlmoveToInteractionInfo); + + Map closureControlcalibrateCommandParams = new LinkedHashMap(); + InteractionInfo closureControlcalibrateInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ClosureControlCluster) cluster) + .calibrate((DefaultClusterCallback) callback + ); + }, + () -> new DelegatedDefaultClusterCallback(), + closureControlcalibrateCommandParams + ); + closureControlClusterInteractionInfoMap.put("calibrate", closureControlcalibrateInteractionInfo); + + Map closureControlconfigureFallbackCommandParams = new LinkedHashMap(); + + CommandParameterInfo closureControlconfigureFallbackrestingProcedureCommandParameterInfo = new CommandParameterInfo("restingProcedure", Optional.class, Integer.class); + closureControlconfigureFallbackCommandParams.put("restingProcedure",closureControlconfigureFallbackrestingProcedureCommandParameterInfo); + + CommandParameterInfo closureControlconfigureFallbacktriggerConditionCommandParameterInfo = new CommandParameterInfo("triggerCondition", Optional.class, Integer.class); + closureControlconfigureFallbackCommandParams.put("triggerCondition",closureControlconfigureFallbacktriggerConditionCommandParameterInfo); + + CommandParameterInfo closureControlconfigureFallbacktriggerPositionCommandParameterInfo = new CommandParameterInfo("triggerPosition", Optional.class, Integer.class); + closureControlconfigureFallbackCommandParams.put("triggerPosition",closureControlconfigureFallbacktriggerPositionCommandParameterInfo); + + CommandParameterInfo closureControlconfigureFallbackwaitingDelayCommandParameterInfo = new CommandParameterInfo("waitingDelay", Optional.class, Long.class); + closureControlconfigureFallbackCommandParams.put("waitingDelay",closureControlconfigureFallbackwaitingDelayCommandParameterInfo); + InteractionInfo closureControlconfigureFallbackInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ClosureControlCluster) cluster) + .configureFallback((DefaultClusterCallback) callback + , (Optional) + commandArguments.get("restingProcedure") + , (Optional) + commandArguments.get("triggerCondition") + , (Optional) + commandArguments.get("triggerPosition") + , (Optional) + commandArguments.get("waitingDelay") + ); + }, + () -> new DelegatedDefaultClusterCallback(), + closureControlconfigureFallbackCommandParams + ); + closureControlClusterInteractionInfoMap.put("configureFallback", closureControlconfigureFallbackInteractionInfo); + + Map closureControlcancelFallbackCommandParams = new LinkedHashMap(); + InteractionInfo closureControlcancelFallbackInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ClosureControlCluster) cluster) + .cancelFallback((DefaultClusterCallback) callback + ); + }, + () -> new DelegatedDefaultClusterCallback(), + closureControlcancelFallbackCommandParams + ); + closureControlClusterInteractionInfoMap.put("cancelFallback", closureControlcancelFallbackInteractionInfo); + + commandMap.put("closureControl", closureControlClusterInteractionInfoMap); + Map serviceAreaClusterInteractionInfoMap = new LinkedHashMap<>(); Map serviceAreaselectAreasCommandParams = 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 79829bf02a2748..ff8503bec2e239 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java @@ -11366,6 +11366,164 @@ private static Map readWindowCoveringInteractionInfo() return result; } + private static Map readClosureControlInteractionInfo() { + Map result = new LinkedHashMap<>();Map readClosureControlCountdownTimeCommandParams = new LinkedHashMap(); + InteractionInfo readClosureControlCountdownTimeAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ClosureControlCluster) cluster).readCountdownTimeAttribute( + (ChipClusters.ClosureControlCluster.CountdownTimeAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedClosureControlClusterCountdownTimeAttributeCallback(), + readClosureControlCountdownTimeCommandParams + ); + result.put("readCountdownTimeAttribute", readClosureControlCountdownTimeAttributeInteractionInfo); + Map readClosureControlMainStateCommandParams = new LinkedHashMap(); + InteractionInfo readClosureControlMainStateAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ClosureControlCluster) cluster).readMainStateAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readClosureControlMainStateCommandParams + ); + result.put("readMainStateAttribute", readClosureControlMainStateAttributeInteractionInfo); + Map readClosureControlCurrentErrorListCommandParams = new LinkedHashMap(); + InteractionInfo readClosureControlCurrentErrorListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ClosureControlCluster) cluster).readCurrentErrorListAttribute( + (ChipClusters.ClosureControlCluster.CurrentErrorListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedClosureControlClusterCurrentErrorListAttributeCallback(), + readClosureControlCurrentErrorListCommandParams + ); + result.put("readCurrentErrorListAttribute", readClosureControlCurrentErrorListAttributeInteractionInfo); + Map readClosureControlRestingProcedureCommandParams = new LinkedHashMap(); + InteractionInfo readClosureControlRestingProcedureAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ClosureControlCluster) cluster).readRestingProcedureAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readClosureControlRestingProcedureCommandParams + ); + result.put("readRestingProcedureAttribute", readClosureControlRestingProcedureAttributeInteractionInfo); + Map readClosureControlTriggerConditionCommandParams = new LinkedHashMap(); + InteractionInfo readClosureControlTriggerConditionAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ClosureControlCluster) cluster).readTriggerConditionAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readClosureControlTriggerConditionCommandParams + ); + result.put("readTriggerConditionAttribute", readClosureControlTriggerConditionAttributeInteractionInfo); + Map readClosureControlTriggerPositionCommandParams = new LinkedHashMap(); + InteractionInfo readClosureControlTriggerPositionAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ClosureControlCluster) cluster).readTriggerPositionAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readClosureControlTriggerPositionCommandParams + ); + result.put("readTriggerPositionAttribute", readClosureControlTriggerPositionAttributeInteractionInfo); + Map readClosureControlWaitingDelayCommandParams = new LinkedHashMap(); + InteractionInfo readClosureControlWaitingDelayAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ClosureControlCluster) cluster).readWaitingDelayAttribute( + (ChipClusters.LongAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + readClosureControlWaitingDelayCommandParams + ); + result.put("readWaitingDelayAttribute", readClosureControlWaitingDelayAttributeInteractionInfo); + Map readClosureControlKickoffTimerCommandParams = new LinkedHashMap(); + InteractionInfo readClosureControlKickoffTimerAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ClosureControlCluster) cluster).readKickoffTimerAttribute( + (ChipClusters.LongAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + readClosureControlKickoffTimerCommandParams + ); + result.put("readKickoffTimerAttribute", readClosureControlKickoffTimerAttributeInteractionInfo); + Map readClosureControlGeneratedCommandListCommandParams = new LinkedHashMap(); + InteractionInfo readClosureControlGeneratedCommandListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ClosureControlCluster) cluster).readGeneratedCommandListAttribute( + (ChipClusters.ClosureControlCluster.GeneratedCommandListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedClosureControlClusterGeneratedCommandListAttributeCallback(), + readClosureControlGeneratedCommandListCommandParams + ); + result.put("readGeneratedCommandListAttribute", readClosureControlGeneratedCommandListAttributeInteractionInfo); + Map readClosureControlAcceptedCommandListCommandParams = new LinkedHashMap(); + InteractionInfo readClosureControlAcceptedCommandListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ClosureControlCluster) cluster).readAcceptedCommandListAttribute( + (ChipClusters.ClosureControlCluster.AcceptedCommandListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedClosureControlClusterAcceptedCommandListAttributeCallback(), + readClosureControlAcceptedCommandListCommandParams + ); + result.put("readAcceptedCommandListAttribute", readClosureControlAcceptedCommandListAttributeInteractionInfo); + Map readClosureControlEventListCommandParams = new LinkedHashMap(); + InteractionInfo readClosureControlEventListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ClosureControlCluster) cluster).readEventListAttribute( + (ChipClusters.ClosureControlCluster.EventListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedClosureControlClusterEventListAttributeCallback(), + readClosureControlEventListCommandParams + ); + result.put("readEventListAttribute", readClosureControlEventListAttributeInteractionInfo); + Map readClosureControlAttributeListCommandParams = new LinkedHashMap(); + InteractionInfo readClosureControlAttributeListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ClosureControlCluster) cluster).readAttributeListAttribute( + (ChipClusters.ClosureControlCluster.AttributeListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedClosureControlClusterAttributeListAttributeCallback(), + readClosureControlAttributeListCommandParams + ); + result.put("readAttributeListAttribute", readClosureControlAttributeListAttributeInteractionInfo); + Map readClosureControlFeatureMapCommandParams = new LinkedHashMap(); + InteractionInfo readClosureControlFeatureMapAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ClosureControlCluster) cluster).readFeatureMapAttribute( + (ChipClusters.LongAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + readClosureControlFeatureMapCommandParams + ); + result.put("readFeatureMapAttribute", readClosureControlFeatureMapAttributeInteractionInfo); + Map readClosureControlClusterRevisionCommandParams = new LinkedHashMap(); + InteractionInfo readClosureControlClusterRevisionAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ClosureControlCluster) cluster).readClusterRevisionAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readClosureControlClusterRevisionCommandParams + ); + result.put("readClusterRevisionAttribute", readClosureControlClusterRevisionAttributeInteractionInfo); + + return result; + } private static Map readServiceAreaInteractionInfo() { Map result = new LinkedHashMap<>();Map readServiceAreaSupportedAreasCommandParams = new LinkedHashMap(); InteractionInfo readServiceAreaSupportedAreasAttributeInteractionInfo = new InteractionInfo( @@ -20811,6 +20969,7 @@ public Map> getReadAttributeMap() { put("deviceEnergyManagementMode", readDeviceEnergyManagementModeInteractionInfo()); put("doorLock", readDoorLockInteractionInfo()); put("windowCovering", readWindowCoveringInteractionInfo()); + put("closureControl", readClosureControlInteractionInfo()); put("serviceArea", readServiceAreaInteractionInfo()); put("pumpConfigurationAndControl", readPumpConfigurationAndControlInteractionInfo()); put("thermostat", readThermostatInteractionInfo()); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java index 0b5bc328568bd9..123f1da613439a 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java @@ -1632,6 +1632,8 @@ public Map> getWriteAttributeMap() { ); writeWindowCoveringInteractionInfo.put("writeModeAttribute", writeWindowCoveringModeAttributeInteractionInfo); writeAttributeMap.put("windowCovering", writeWindowCoveringInteractionInfo); + Map writeClosureControlInteractionInfo = new LinkedHashMap<>(); + writeAttributeMap.put("closureControl", writeClosureControlInteractionInfo); Map writeServiceAreaInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("serviceArea", writeServiceAreaInteractionInfo); Map writePumpConfigurationAndControlInteractionInfo = new LinkedHashMap<>(); diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni index ff7b3d9f5d6976..d5c85a30254287 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni @@ -41,6 +41,8 @@ structs_sources = [ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ChannelClusterProgramStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ChannelClusterSeriesInfoStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ChimeClusterChimeSoundStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ClosureControlClusterOverallStateStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ClosureControlClusterOverallTargetStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentControlClusterRatingNameStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterAdditionalInfoStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterBrandingInformationStruct.kt", diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ClosureControlClusterOverallStateStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ClosureControlClusterOverallStateStruct.kt new file mode 100644 index 00000000000000..8292b970ae2395 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ClosureControlClusterOverallStateStruct.kt @@ -0,0 +1,102 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import java.util.Optional +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ClosureControlClusterOverallStateStruct( + val positioning: Optional, + val latching: Optional, + val speed: Optional, + val extraInfo: Optional, +) { + override fun toString(): String = buildString { + append("ClosureControlClusterOverallStateStruct {\n") + append("\tpositioning : $positioning\n") + append("\tlatching : $latching\n") + append("\tspeed : $speed\n") + append("\textraInfo : $extraInfo\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (positioning.isPresent) { + val optpositioning = positioning.get() + put(ContextSpecificTag(TAG_POSITIONING), optpositioning) + } + if (latching.isPresent) { + val optlatching = latching.get() + put(ContextSpecificTag(TAG_LATCHING), optlatching) + } + if (speed.isPresent) { + val optspeed = speed.get() + put(ContextSpecificTag(TAG_SPEED), optspeed) + } + if (extraInfo.isPresent) { + val optextraInfo = extraInfo.get() + put(ContextSpecificTag(TAG_EXTRA_INFO), optextraInfo) + } + endStructure() + } + } + + companion object { + private const val TAG_POSITIONING = 0 + private const val TAG_LATCHING = 1 + private const val TAG_SPEED = 2 + private const val TAG_EXTRA_INFO = 3 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ClosureControlClusterOverallStateStruct { + tlvReader.enterStructure(tlvTag) + val positioning = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_POSITIONING))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_POSITIONING))) + } else { + Optional.empty() + } + val latching = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_LATCHING))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_LATCHING))) + } else { + Optional.empty() + } + val speed = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_SPEED))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_SPEED))) + } else { + Optional.empty() + } + val extraInfo = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_EXTRA_INFO))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_EXTRA_INFO))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ClosureControlClusterOverallStateStruct(positioning, latching, speed, extraInfo) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ClosureControlClusterOverallTargetStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ClosureControlClusterOverallTargetStruct.kt new file mode 100644 index 00000000000000..bc3c0b737fe9d3 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ClosureControlClusterOverallTargetStruct.kt @@ -0,0 +1,89 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import java.util.Optional +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ClosureControlClusterOverallTargetStruct( + val tagPosition: Optional, + val tagLatch: Optional, + val speed: Optional, +) { + override fun toString(): String = buildString { + append("ClosureControlClusterOverallTargetStruct {\n") + append("\ttagPosition : $tagPosition\n") + append("\ttagLatch : $tagLatch\n") + append("\tspeed : $speed\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (tagPosition.isPresent) { + val opttagPosition = tagPosition.get() + put(ContextSpecificTag(TAG_TAG_POSITION), opttagPosition) + } + if (tagLatch.isPresent) { + val opttagLatch = tagLatch.get() + put(ContextSpecificTag(TAG_TAG_LATCH), opttagLatch) + } + if (speed.isPresent) { + val optspeed = speed.get() + put(ContextSpecificTag(TAG_SPEED), optspeed) + } + endStructure() + } + } + + companion object { + private const val TAG_TAG_POSITION = 0 + private const val TAG_TAG_LATCH = 1 + private const val TAG_SPEED = 2 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ClosureControlClusterOverallTargetStruct { + tlvReader.enterStructure(tlvTag) + val tagPosition = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_TAG_POSITION))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_TAG_POSITION))) + } else { + Optional.empty() + } + val tagLatch = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_TAG_LATCH))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_TAG_LATCH))) + } else { + Optional.empty() + } + val speed = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_SPEED))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_SPEED))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ClosureControlClusterOverallTargetStruct(tagPosition, tagLatch, speed) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/ClosureControlCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/ClosureControlCluster.kt new file mode 100644 index 00000000000000..4820ca28c43259 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/ClosureControlCluster.kt @@ -0,0 +1,1735 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package matter.controller.cluster.clusters + +import java.time.Duration +import java.util.logging.Level +import java.util.logging.Logger +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.transform +import matter.controller.InvokeRequest +import matter.controller.InvokeResponse +import matter.controller.MatterController +import matter.controller.ReadData +import matter.controller.ReadRequest +import matter.controller.SubscribeRequest +import matter.controller.SubscriptionState +import matter.controller.UByteSubscriptionState +import matter.controller.UIntSubscriptionState +import matter.controller.UShortSubscriptionState +import matter.controller.cluster.structs.* +import matter.controller.model.AttributePath +import matter.controller.model.CommandPath +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ClosureControlCluster( + private val controller: MatterController, + private val endpointId: UShort, +) { + class CountdownTimeAttribute(val value: UInt?) + + sealed class CountdownTimeAttributeSubscriptionState { + data class Success(val value: UInt?) : CountdownTimeAttributeSubscriptionState() + + data class Error(val exception: Exception) : CountdownTimeAttributeSubscriptionState() + + object SubscriptionEstablished : CountdownTimeAttributeSubscriptionState() + } + + class CurrentErrorListAttribute(val value: List) + + sealed class CurrentErrorListAttributeSubscriptionState { + data class Success(val value: List) : CurrentErrorListAttributeSubscriptionState() + + data class Error(val exception: Exception) : CurrentErrorListAttributeSubscriptionState() + + object SubscriptionEstablished : CurrentErrorListAttributeSubscriptionState() + } + + class OverallStateAttribute(val value: ClosureControlClusterOverallStateStruct?) + + sealed class OverallStateAttributeSubscriptionState { + data class Success(val value: ClosureControlClusterOverallStateStruct?) : + OverallStateAttributeSubscriptionState() + + data class Error(val exception: Exception) : OverallStateAttributeSubscriptionState() + + object SubscriptionEstablished : OverallStateAttributeSubscriptionState() + } + + class OverallTargetAttribute(val value: ClosureControlClusterOverallTargetStruct?) + + sealed class OverallTargetAttributeSubscriptionState { + data class Success(val value: ClosureControlClusterOverallTargetStruct?) : + OverallTargetAttributeSubscriptionState() + + data class Error(val exception: Exception) : OverallTargetAttributeSubscriptionState() + + object SubscriptionEstablished : OverallTargetAttributeSubscriptionState() + } + + class GeneratedCommandListAttribute(val value: List) + + sealed class GeneratedCommandListAttributeSubscriptionState { + data class Success(val value: List) : GeneratedCommandListAttributeSubscriptionState() + + data class Error(val exception: Exception) : GeneratedCommandListAttributeSubscriptionState() + + object SubscriptionEstablished : GeneratedCommandListAttributeSubscriptionState() + } + + class AcceptedCommandListAttribute(val value: List) + + sealed class AcceptedCommandListAttributeSubscriptionState { + data class Success(val value: List) : AcceptedCommandListAttributeSubscriptionState() + + data class Error(val exception: Exception) : AcceptedCommandListAttributeSubscriptionState() + + object SubscriptionEstablished : AcceptedCommandListAttributeSubscriptionState() + } + + class EventListAttribute(val value: List) + + sealed class EventListAttributeSubscriptionState { + data class Success(val value: List) : EventListAttributeSubscriptionState() + + data class Error(val exception: Exception) : EventListAttributeSubscriptionState() + + object SubscriptionEstablished : EventListAttributeSubscriptionState() + } + + class AttributeListAttribute(val value: List) + + sealed class AttributeListAttributeSubscriptionState { + data class Success(val value: List) : AttributeListAttributeSubscriptionState() + + data class Error(val exception: Exception) : AttributeListAttributeSubscriptionState() + + object SubscriptionEstablished : AttributeListAttributeSubscriptionState() + } + + suspend fun stop(timedInvokeTimeout: Duration? = null) { + val commandId: UInt = 0u + + val tlvWriter = TlvWriter() + tlvWriter.startStructure(AnonymousTag) + tlvWriter.endStructure() + + val request: InvokeRequest = + InvokeRequest( + CommandPath(endpointId, clusterId = CLUSTER_ID, commandId), + tlvPayload = tlvWriter.getEncoded(), + timedRequest = timedInvokeTimeout, + ) + + val response: InvokeResponse = controller.invoke(request) + logger.log(Level.FINE, "Invoke command succeeded: ${response}") + } + + suspend fun moveTo( + tag: UByte?, + latch: UByte?, + speed: UByte?, + timedInvokeTimeout: Duration? = null, + ) { + val commandId: UInt = 1u + + val tlvWriter = TlvWriter() + tlvWriter.startStructure(AnonymousTag) + + val TAG_TAG_REQ: Int = 0 + tag?.let { tlvWriter.put(ContextSpecificTag(TAG_TAG_REQ), tag) } + + val TAG_LATCH_REQ: Int = 1 + latch?.let { tlvWriter.put(ContextSpecificTag(TAG_LATCH_REQ), latch) } + + val TAG_SPEED_REQ: Int = 2 + speed?.let { tlvWriter.put(ContextSpecificTag(TAG_SPEED_REQ), speed) } + tlvWriter.endStructure() + + val request: InvokeRequest = + InvokeRequest( + CommandPath(endpointId, clusterId = CLUSTER_ID, commandId), + tlvPayload = tlvWriter.getEncoded(), + timedRequest = timedInvokeTimeout, + ) + + val response: InvokeResponse = controller.invoke(request) + logger.log(Level.FINE, "Invoke command succeeded: ${response}") + } + + suspend fun calibrate(timedInvokeTimeout: Duration? = null) { + val commandId: UInt = 2u + + val tlvWriter = TlvWriter() + tlvWriter.startStructure(AnonymousTag) + tlvWriter.endStructure() + + val request: InvokeRequest = + InvokeRequest( + CommandPath(endpointId, clusterId = CLUSTER_ID, commandId), + tlvPayload = tlvWriter.getEncoded(), + timedRequest = timedInvokeTimeout, + ) + + val response: InvokeResponse = controller.invoke(request) + logger.log(Level.FINE, "Invoke command succeeded: ${response}") + } + + suspend fun configureFallback( + restingProcedure: UByte?, + triggerCondition: UByte?, + triggerPosition: UByte?, + waitingDelay: UInt?, + timedInvokeTimeout: Duration? = null, + ) { + val commandId: UInt = 3u + + val tlvWriter = TlvWriter() + tlvWriter.startStructure(AnonymousTag) + + val TAG_RESTING_PROCEDURE_REQ: Int = 0 + restingProcedure?.let { + tlvWriter.put(ContextSpecificTag(TAG_RESTING_PROCEDURE_REQ), restingProcedure) + } + + val TAG_TRIGGER_CONDITION_REQ: Int = 1 + triggerCondition?.let { + tlvWriter.put(ContextSpecificTag(TAG_TRIGGER_CONDITION_REQ), triggerCondition) + } + + val TAG_TRIGGER_POSITION_REQ: Int = 2 + triggerPosition?.let { + tlvWriter.put(ContextSpecificTag(TAG_TRIGGER_POSITION_REQ), triggerPosition) + } + + val TAG_WAITING_DELAY_REQ: Int = 3 + waitingDelay?.let { tlvWriter.put(ContextSpecificTag(TAG_WAITING_DELAY_REQ), waitingDelay) } + tlvWriter.endStructure() + + val request: InvokeRequest = + InvokeRequest( + CommandPath(endpointId, clusterId = CLUSTER_ID, commandId), + tlvPayload = tlvWriter.getEncoded(), + timedRequest = timedInvokeTimeout, + ) + + val response: InvokeResponse = controller.invoke(request) + logger.log(Level.FINE, "Invoke command succeeded: ${response}") + } + + suspend fun cancelFallback(timedInvokeTimeout: Duration? = null) { + val commandId: UInt = 4u + + val tlvWriter = TlvWriter() + tlvWriter.startStructure(AnonymousTag) + tlvWriter.endStructure() + + val request: InvokeRequest = + InvokeRequest( + CommandPath(endpointId, clusterId = CLUSTER_ID, commandId), + tlvPayload = tlvWriter.getEncoded(), + timedRequest = timedInvokeTimeout, + ) + + val response: InvokeResponse = controller.invoke(request) + logger.log(Level.FINE, "Invoke command succeeded: ${response}") + } + + suspend fun readCountdownTimeAttribute(): CountdownTimeAttribute { + val ATTRIBUTE_ID: UInt = 0u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Countdowntime attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getUInt(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return CountdownTimeAttribute(decodedValue) + } + + suspend fun subscribeCountdownTimeAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 0u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + CountdownTimeAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Countdowntime attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getUInt(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(CountdownTimeAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(CountdownTimeAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readMainStateAttribute(): UByte { + val ATTRIBUTE_ID: UInt = 1u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Mainstate attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UByte = tlvReader.getUByte(AnonymousTag) + + return decodedValue + } + + suspend fun subscribeMainStateAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 1u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + UByteSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Mainstate attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UByte = tlvReader.getUByte(AnonymousTag) + + emit(UByteSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(UByteSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readCurrentErrorListAttribute(): CurrentErrorListAttribute { + val ATTRIBUTE_ID: UInt = 2u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Currenterrorlist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUByte(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return CurrentErrorListAttribute(decodedValue) + } + + suspend fun subscribeCurrentErrorListAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 2u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + CurrentErrorListAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Currenterrorlist attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUByte(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(CurrentErrorListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(CurrentErrorListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readOverallStateAttribute(): OverallStateAttribute { + val ATTRIBUTE_ID: UInt = 3u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Overallstate attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: ClosureControlClusterOverallStateStruct? = + if (!tlvReader.isNull()) { + ClosureControlClusterOverallStateStruct.fromTlv(AnonymousTag, tlvReader) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return OverallStateAttribute(decodedValue) + } + + suspend fun subscribeOverallStateAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 3u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + OverallStateAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Overallstate attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: ClosureControlClusterOverallStateStruct? = + if (!tlvReader.isNull()) { + ClosureControlClusterOverallStateStruct.fromTlv(AnonymousTag, tlvReader) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(OverallStateAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(OverallStateAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readOverallTargetAttribute(): OverallTargetAttribute { + val ATTRIBUTE_ID: UInt = 4u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Overalltarget attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: ClosureControlClusterOverallTargetStruct? = + if (!tlvReader.isNull()) { + ClosureControlClusterOverallTargetStruct.fromTlv(AnonymousTag, tlvReader) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return OverallTargetAttribute(decodedValue) + } + + suspend fun subscribeOverallTargetAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 4u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + OverallTargetAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Overalltarget attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: ClosureControlClusterOverallTargetStruct? = + if (!tlvReader.isNull()) { + ClosureControlClusterOverallTargetStruct.fromTlv(AnonymousTag, tlvReader) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(OverallTargetAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(OverallTargetAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readRestingProcedureAttribute(): UByte? { + val ATTRIBUTE_ID: UInt = 5u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Restingprocedure 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)) { + tlvReader.getUByte(AnonymousTag) + } else { + null + } + + return decodedValue + } + + suspend fun subscribeRestingProcedureAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 5u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + UByteSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Restingprocedure attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UByte? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getUByte(AnonymousTag) + } else { + null + } + + decodedValue?.let { emit(UByteSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(UByteSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readTriggerConditionAttribute(): UByte? { + val ATTRIBUTE_ID: UInt = 6u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Triggercondition 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)) { + tlvReader.getUByte(AnonymousTag) + } else { + null + } + + return decodedValue + } + + suspend fun subscribeTriggerConditionAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 6u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + UByteSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Triggercondition attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UByte? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getUByte(AnonymousTag) + } else { + null + } + + decodedValue?.let { emit(UByteSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(UByteSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readTriggerPositionAttribute(): UByte? { + val ATTRIBUTE_ID: UInt = 7u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Triggerposition 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)) { + tlvReader.getUByte(AnonymousTag) + } else { + null + } + + return decodedValue + } + + suspend fun subscribeTriggerPositionAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 7u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + UByteSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Triggerposition attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UByte? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getUByte(AnonymousTag) + } else { + null + } + + decodedValue?.let { emit(UByteSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(UByteSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readWaitingDelayAttribute(): UInt? { + val ATTRIBUTE_ID: UInt = 8u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Waitingdelay attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getUInt(AnonymousTag) + } else { + null + } + + return decodedValue + } + + suspend fun subscribeWaitingDelayAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 8u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + UIntSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Waitingdelay attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getUInt(AnonymousTag) + } else { + null + } + + decodedValue?.let { emit(UIntSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(UIntSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readKickoffTimerAttribute(): UInt? { + val ATTRIBUTE_ID: UInt = 9u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Kickofftimer attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getUInt(AnonymousTag) + } else { + null + } + + return decodedValue + } + + suspend fun subscribeKickoffTimerAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 9u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + UIntSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Kickofftimer attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getUInt(AnonymousTag) + } else { + null + } + + decodedValue?.let { emit(UIntSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(UIntSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readGeneratedCommandListAttribute(): GeneratedCommandListAttribute { + val ATTRIBUTE_ID: UInt = 65528u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Generatedcommandlist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return GeneratedCommandListAttribute(decodedValue) + } + + suspend fun subscribeGeneratedCommandListAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65528u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + GeneratedCommandListAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Generatedcommandlist attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(GeneratedCommandListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(GeneratedCommandListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readAcceptedCommandListAttribute(): AcceptedCommandListAttribute { + val ATTRIBUTE_ID: UInt = 65529u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Acceptedcommandlist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return AcceptedCommandListAttribute(decodedValue) + } + + suspend fun subscribeAcceptedCommandListAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65529u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + AcceptedCommandListAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Acceptedcommandlist attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(AcceptedCommandListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(AcceptedCommandListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readEventListAttribute(): EventListAttribute { + val ATTRIBUTE_ID: UInt = 65530u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Eventlist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return EventListAttribute(decodedValue) + } + + suspend fun subscribeEventListAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65530u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + EventListAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Eventlist attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(EventListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(EventListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readAttributeListAttribute(): AttributeListAttribute { + val ATTRIBUTE_ID: UInt = 65531u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Attributelist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return AttributeListAttribute(decodedValue) + } + + suspend fun subscribeAttributeListAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65531u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + AttributeListAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Attributelist attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(AttributeListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(AttributeListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readFeatureMapAttribute(): UInt { + val ATTRIBUTE_ID: UInt = 65532u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Featuremap attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt = tlvReader.getUInt(AnonymousTag) + + return decodedValue + } + + suspend fun subscribeFeatureMapAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65532u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + UIntSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Featuremap attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt = tlvReader.getUInt(AnonymousTag) + + emit(UIntSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(UIntSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readClusterRevisionAttribute(): UShort { + val ATTRIBUTE_ID: UInt = 65533u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Clusterrevision attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UShort = tlvReader.getUShort(AnonymousTag) + + return decodedValue + } + + suspend fun subscribeClusterRevisionAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65533u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + UShortSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Clusterrevision attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UShort = tlvReader.getUShort(AnonymousTag) + + emit(UShortSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(UShortSubscriptionState.SubscriptionEstablished) + } + } + } + } + + companion object { + private val logger = Logger.getLogger(ClosureControlCluster::class.java.name) + const val CLUSTER_ID: UInt = 260u + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/files.gni b/src/controller/java/generated/java/matter/controller/cluster/files.gni index 61f3b274ebc4dd..9cf22185f9a8d5 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/files.gni +++ b/src/controller/java/generated/java/matter/controller/cluster/files.gni @@ -41,6 +41,8 @@ matter_structs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ChannelClusterProgramStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ChannelClusterSeriesInfoStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ChimeClusterChimeSoundStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ClosureControlClusterOverallStateStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ClosureControlClusterOverallTargetStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ContentControlClusterRatingNameStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ContentLauncherClusterAdditionalInfoStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ContentLauncherClusterBrandingInformationStruct.kt", @@ -308,6 +310,7 @@ matter_clusters_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/CarbonMonoxideConcentrationMeasurementCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/ChannelCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/ChimeCluster.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/ClosureControlCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/ColorControlCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/CommissionerControlCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/ContentAppObserverCluster.kt", diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ClosureControlClusterOverallStateStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ClosureControlClusterOverallStateStruct.kt new file mode 100644 index 00000000000000..a742048f40c2be --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ClosureControlClusterOverallStateStruct.kt @@ -0,0 +1,102 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package matter.controller.cluster.structs + +import java.util.Optional +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ClosureControlClusterOverallStateStruct( + val positioning: Optional, + val latching: Optional, + val speed: Optional, + val extraInfo: Optional, +) { + override fun toString(): String = buildString { + append("ClosureControlClusterOverallStateStruct {\n") + append("\tpositioning : $positioning\n") + append("\tlatching : $latching\n") + append("\tspeed : $speed\n") + append("\textraInfo : $extraInfo\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (positioning.isPresent) { + val optpositioning = positioning.get() + put(ContextSpecificTag(TAG_POSITIONING), optpositioning) + } + if (latching.isPresent) { + val optlatching = latching.get() + put(ContextSpecificTag(TAG_LATCHING), optlatching) + } + if (speed.isPresent) { + val optspeed = speed.get() + put(ContextSpecificTag(TAG_SPEED), optspeed) + } + if (extraInfo.isPresent) { + val optextraInfo = extraInfo.get() + put(ContextSpecificTag(TAG_EXTRA_INFO), optextraInfo) + } + endStructure() + } + } + + companion object { + private const val TAG_POSITIONING = 0 + private const val TAG_LATCHING = 1 + private const val TAG_SPEED = 2 + private const val TAG_EXTRA_INFO = 3 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ClosureControlClusterOverallStateStruct { + tlvReader.enterStructure(tlvTag) + val positioning = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_POSITIONING))) { + Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_POSITIONING))) + } else { + Optional.empty() + } + val latching = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_LATCHING))) { + Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_LATCHING))) + } else { + Optional.empty() + } + val speed = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_SPEED))) { + Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_SPEED))) + } else { + Optional.empty() + } + val extraInfo = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_EXTRA_INFO))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_EXTRA_INFO))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ClosureControlClusterOverallStateStruct(positioning, latching, speed, extraInfo) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ClosureControlClusterOverallTargetStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ClosureControlClusterOverallTargetStruct.kt new file mode 100644 index 00000000000000..1a1ed8e9c793c7 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ClosureControlClusterOverallTargetStruct.kt @@ -0,0 +1,89 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package matter.controller.cluster.structs + +import java.util.Optional +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ClosureControlClusterOverallTargetStruct( + val tagPosition: Optional, + val tagLatch: Optional, + val speed: Optional, +) { + override fun toString(): String = buildString { + append("ClosureControlClusterOverallTargetStruct {\n") + append("\ttagPosition : $tagPosition\n") + append("\ttagLatch : $tagLatch\n") + append("\tspeed : $speed\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (tagPosition.isPresent) { + val opttagPosition = tagPosition.get() + put(ContextSpecificTag(TAG_TAG_POSITION), opttagPosition) + } + if (tagLatch.isPresent) { + val opttagLatch = tagLatch.get() + put(ContextSpecificTag(TAG_TAG_LATCH), opttagLatch) + } + if (speed.isPresent) { + val optspeed = speed.get() + put(ContextSpecificTag(TAG_SPEED), optspeed) + } + endStructure() + } + } + + companion object { + private const val TAG_TAG_POSITION = 0 + private const val TAG_TAG_LATCH = 1 + private const val TAG_SPEED = 2 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ClosureControlClusterOverallTargetStruct { + tlvReader.enterStructure(tlvTag) + val tagPosition = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_TAG_POSITION))) { + Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_TAG_POSITION))) + } else { + Optional.empty() + } + val tagLatch = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_TAG_LATCH))) { + Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_TAG_LATCH))) + } else { + Optional.empty() + } + val speed = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_SPEED))) { + Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_SPEED))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ClosureControlClusterOverallTargetStruct(tagPosition, tagLatch, speed) + } + } +} diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index 2779d18140f5a6..1b50adca846c00 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -26096,6 +26096,466 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } break; } + case app::Clusters::ClosureControl::Id: { + using namespace app::Clusters::ClosureControl; + switch (aPath.mAttributeId) + { + case Attributes::CountdownTime::Id: { + using TypeInfo = Attributes::CountdownTime::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::MainState::Id: { + using TypeInfo = Attributes::MainState::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::CurrentErrorList::Id: { + using TypeInfo = Attributes::CurrentErrorList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Integer"; + std::string newElement_0CtorSignature = "(I)V"; + jint jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::OverallState::Id: { + using TypeInfo = Attributes::OverallState::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + jobject value_positioning; + if (!cppValue.Value().positioning.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_positioning); + } + else + { + jobject value_positioningInsideOptional; + std::string value_positioningInsideOptionalClassName = "java/lang/Integer"; + std::string value_positioningInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_positioningInsideOptional = static_cast(cppValue.Value().positioning.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_positioningInsideOptionalClassName.c_str(), value_positioningInsideOptionalCtorSignature.c_str(), + jnivalue_positioningInsideOptional, value_positioningInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_positioningInsideOptional, value_positioning); + } + jobject value_latching; + if (!cppValue.Value().latching.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_latching); + } + else + { + jobject value_latchingInsideOptional; + std::string value_latchingInsideOptionalClassName = "java/lang/Integer"; + std::string value_latchingInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_latchingInsideOptional = static_cast(cppValue.Value().latching.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_latchingInsideOptionalClassName.c_str(), value_latchingInsideOptionalCtorSignature.c_str(), + jnivalue_latchingInsideOptional, value_latchingInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_latchingInsideOptional, value_latching); + } + jobject value_speed; + if (!cppValue.Value().speed.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_speed); + } + else + { + jobject value_speedInsideOptional; + std::string value_speedInsideOptionalClassName = "java/lang/Integer"; + std::string value_speedInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_speedInsideOptional = static_cast(cppValue.Value().speed.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_speedInsideOptionalClassName.c_str(), value_speedInsideOptionalCtorSignature.c_str(), + jnivalue_speedInsideOptional, value_speedInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_speedInsideOptional, value_speed); + } + jobject value_extraInfo; + if (!cppValue.Value().extraInfo.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_extraInfo); + } + else + { + jobject value_extraInfoInsideOptional; + std::string value_extraInfoInsideOptionalClassName = "java/lang/Long"; + std::string value_extraInfoInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_extraInfoInsideOptional = static_cast(cppValue.Value().extraInfo.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_extraInfoInsideOptionalClassName.c_str(), value_extraInfoInsideOptionalCtorSignature.c_str(), + jnivalue_extraInfoInsideOptional, value_extraInfoInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_extraInfoInsideOptional, value_extraInfo); + } + + { + jclass overallStateStructStructClass_1; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$ClosureControlClusterOverallStateStruct", + overallStateStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$ClosureControlClusterOverallStateStruct"); + return nullptr; + } + + jmethodID overallStateStructStructCtor_1; + err = chip::JniReferences::GetInstance().FindMethod( + env, overallStateStructStructClass_1, "", + "(Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V", + &overallStateStructStructCtor_1); + if (err != CHIP_NO_ERROR || overallStateStructStructCtor_1 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$ClosureControlClusterOverallStateStruct constructor"); + return nullptr; + } + + value = env->NewObject(overallStateStructStructClass_1, overallStateStructStructCtor_1, value_positioning, + value_latching, value_speed, value_extraInfo); + } + } + return value; + } + case Attributes::OverallTarget::Id: { + using TypeInfo = Attributes::OverallTarget::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + jobject value_tagPosition; + if (!cppValue.Value().tagPosition.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_tagPosition); + } + else + { + jobject value_tagPositionInsideOptional; + std::string value_tagPositionInsideOptionalClassName = "java/lang/Integer"; + std::string value_tagPositionInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_tagPositionInsideOptional = static_cast(cppValue.Value().tagPosition.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_tagPositionInsideOptionalClassName.c_str(), value_tagPositionInsideOptionalCtorSignature.c_str(), + jnivalue_tagPositionInsideOptional, value_tagPositionInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_tagPositionInsideOptional, value_tagPosition); + } + jobject value_tagLatch; + if (!cppValue.Value().tagLatch.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_tagLatch); + } + else + { + jobject value_tagLatchInsideOptional; + std::string value_tagLatchInsideOptionalClassName = "java/lang/Integer"; + std::string value_tagLatchInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_tagLatchInsideOptional = static_cast(cppValue.Value().tagLatch.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_tagLatchInsideOptionalClassName.c_str(), value_tagLatchInsideOptionalCtorSignature.c_str(), + jnivalue_tagLatchInsideOptional, value_tagLatchInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_tagLatchInsideOptional, value_tagLatch); + } + jobject value_speed; + if (!cppValue.Value().speed.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_speed); + } + else + { + jobject value_speedInsideOptional; + std::string value_speedInsideOptionalClassName = "java/lang/Integer"; + std::string value_speedInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_speedInsideOptional = static_cast(cppValue.Value().speed.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_speedInsideOptionalClassName.c_str(), value_speedInsideOptionalCtorSignature.c_str(), + jnivalue_speedInsideOptional, value_speedInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_speedInsideOptional, value_speed); + } + + { + jclass overallTargetStructStructClass_1; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$ClosureControlClusterOverallTargetStruct", + overallTargetStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$ClosureControlClusterOverallTargetStruct"); + return nullptr; + } + + jmethodID overallTargetStructStructCtor_1; + err = chip::JniReferences::GetInstance().FindMethod( + env, overallTargetStructStructClass_1, "", + "(Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V", &overallTargetStructStructCtor_1); + if (err != CHIP_NO_ERROR || overallTargetStructStructCtor_1 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$ClosureControlClusterOverallTargetStruct constructor"); + return nullptr; + } + + value = env->NewObject(overallTargetStructStructClass_1, overallTargetStructStructCtor_1, value_tagPosition, + value_tagLatch, value_speed); + } + } + return value; + } + case Attributes::RestingProcedure::Id: { + using TypeInfo = Attributes::RestingProcedure::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::TriggerCondition::Id: { + using TypeInfo = Attributes::TriggerCondition::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::TriggerPosition::Id: { + using TypeInfo = Attributes::TriggerPosition::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::WaitingDelay::Id: { + using TypeInfo = Attributes::WaitingDelay::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + return value; + } + case Attributes::KickoffTimer::Id: { + using TypeInfo = Attributes::KickoffTimer::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Integer"; + std::string valueCtorSignature = "(I)V"; + jint jnivalue = static_cast(cppValue); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), jnivalue, + value); + return value; + } + default: + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + break; + } + break; + } case app::Clusters::ServiceArea::Id: { using namespace app::Clusters::ServiceArea; switch (aPath.mAttributeId) diff --git a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp index 56694c1ea0303f..a1c8b6472cb929 100644 --- a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp @@ -7023,6 +7023,16 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & } break; } + case app::Clusters::ClosureControl::Id: { + using namespace app::Clusters::ClosureControl; + switch (aPath.mEventId) + { + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + break; + } + break; + } case app::Clusters::ServiceArea::Id: { using namespace app::Clusters::ServiceArea; switch (aPath.mEventId) diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index b391ff5252df2f..4670cb876acce4 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -7770,6 +7770,141 @@ class ChipClusters: }, }, } + _CLOSURE_CONTROL_CLUSTER_INFO = { + "clusterName": "ClosureControl", + "clusterId": 0x00000104, + "commands": { + 0x00000000: { + "commandId": 0x00000000, + "commandName": "Stop", + "args": { + }, + }, + 0x00000001: { + "commandId": 0x00000001, + "commandName": "MoveTo", + "args": { + "tag": "int", + "latch": "int", + "speed": "int", + }, + }, + 0x00000002: { + "commandId": 0x00000002, + "commandName": "Calibrate", + "args": { + }, + }, + 0x00000003: { + "commandId": 0x00000003, + "commandName": "ConfigureFallback", + "args": { + "restingProcedure": "int", + "triggerCondition": "int", + "triggerPosition": "int", + "waitingDelay": "int", + }, + }, + 0x00000004: { + "commandId": 0x00000004, + "commandName": "CancelFallback", + "args": { + }, + }, + }, + "attributes": { + 0x00000000: { + "attributeName": "CountdownTime", + "attributeId": 0x00000000, + "type": "int", + "reportable": True, + }, + 0x00000001: { + "attributeName": "MainState", + "attributeId": 0x00000001, + "type": "int", + "reportable": True, + }, + 0x00000002: { + "attributeName": "CurrentErrorList", + "attributeId": 0x00000002, + "type": "int", + "reportable": True, + }, + 0x00000003: { + "attributeName": "OverallState", + "attributeId": 0x00000003, + "type": "", + "reportable": True, + }, + 0x00000004: { + "attributeName": "OverallTarget", + "attributeId": 0x00000004, + "type": "", + "reportable": True, + }, + 0x00000005: { + "attributeName": "RestingProcedure", + "attributeId": 0x00000005, + "type": "int", + "reportable": True, + }, + 0x00000006: { + "attributeName": "TriggerCondition", + "attributeId": 0x00000006, + "type": "int", + "reportable": True, + }, + 0x00000007: { + "attributeName": "TriggerPosition", + "attributeId": 0x00000007, + "type": "int", + "reportable": True, + }, + 0x00000008: { + "attributeName": "WaitingDelay", + "attributeId": 0x00000008, + "type": "int", + "reportable": True, + }, + 0x00000009: { + "attributeName": "KickoffTimer", + "attributeId": 0x00000009, + "type": "int", + "reportable": True, + }, + 0x0000FFF8: { + "attributeName": "GeneratedCommandList", + "attributeId": 0x0000FFF8, + "type": "int", + "reportable": True, + }, + 0x0000FFF9: { + "attributeName": "AcceptedCommandList", + "attributeId": 0x0000FFF9, + "type": "int", + "reportable": True, + }, + 0x0000FFFB: { + "attributeName": "AttributeList", + "attributeId": 0x0000FFFB, + "type": "int", + "reportable": True, + }, + 0x0000FFFC: { + "attributeName": "FeatureMap", + "attributeId": 0x0000FFFC, + "type": "int", + "reportable": True, + }, + 0x0000FFFD: { + "attributeName": "ClusterRevision", + "attributeId": 0x0000FFFD, + "type": "int", + "reportable": True, + }, + }, + } _SERVICE_AREA_CLUSTER_INFO = { "clusterName": "ServiceArea", "clusterId": 0x00000150, @@ -14566,6 +14701,7 @@ class ChipClusters: 0x0000009F: _DEVICE_ENERGY_MANAGEMENT_MODE_CLUSTER_INFO, 0x00000101: _DOOR_LOCK_CLUSTER_INFO, 0x00000102: _WINDOW_COVERING_CLUSTER_INFO, + 0x00000104: _CLOSURE_CONTROL_CLUSTER_INFO, 0x00000150: _SERVICE_AREA_CLUSTER_INFO, 0x00000200: _PUMP_CONFIGURATION_AND_CONTROL_CLUSTER_INFO, 0x00000201: _THERMOSTAT_CLUSTER_INFO, @@ -14699,6 +14835,7 @@ class ChipClusters: "DeviceEnergyManagementMode": _DEVICE_ENERGY_MANAGEMENT_MODE_CLUSTER_INFO, "DoorLock": _DOOR_LOCK_CLUSTER_INFO, "WindowCovering": _WINDOW_COVERING_CLUSTER_INFO, + "ClosureControl": _CLOSURE_CONTROL_CLUSTER_INFO, "ServiceArea": _SERVICE_AREA_CLUSTER_INFO, "PumpConfigurationAndControl": _PUMP_CONFIGURATION_AND_CONTROL_CLUSTER_INFO, "Thermostat": _THERMOSTAT_CLUSTER_INFO, diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 2b0282bb9d166d..7d78b3d0d1725c 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -117,6 +117,7 @@ "DeviceEnergyManagementMode", "DoorLock", "WindowCovering", + "ClosureControl", "ServiceArea", "PumpConfigurationAndControl", "Thermostat", @@ -29161,6 +29162,523 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: uint = 0 +@dataclass +class ClosureControl(Cluster): + id: typing.ClassVar[int] = 0x00000104 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="countdownTime", Tag=0x00000000, Type=typing.Union[None, Nullable, uint]), + ClusterObjectFieldDescriptor(Label="mainState", Tag=0x00000001, Type=ClosureControl.Enums.MainStateEnum), + ClusterObjectFieldDescriptor(Label="currentErrorList", Tag=0x00000002, Type=typing.List[ClosureControl.Enums.ClosureErrorEnum]), + ClusterObjectFieldDescriptor(Label="overallState", Tag=0x00000003, Type=typing.Union[Nullable, ClosureControl.Structs.OverallStateStruct]), + ClusterObjectFieldDescriptor(Label="overallTarget", Tag=0x00000004, Type=typing.Union[Nullable, ClosureControl.Structs.OverallTargetStruct]), + ClusterObjectFieldDescriptor(Label="restingProcedure", Tag=0x00000005, Type=typing.Optional[ClosureControl.Enums.RestingProcedureEnum]), + ClusterObjectFieldDescriptor(Label="triggerCondition", Tag=0x00000006, Type=typing.Optional[ClosureControl.Enums.TriggerConditionEnum]), + ClusterObjectFieldDescriptor(Label="triggerPosition", Tag=0x00000007, Type=typing.Optional[ClosureControl.Enums.TriggerPositionEnum]), + ClusterObjectFieldDescriptor(Label="waitingDelay", Tag=0x00000008, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="kickoffTimer", Tag=0x00000009, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="attributeList", Tag=0x0000FFFB, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="featureMap", Tag=0x0000FFFC, Type=uint), + ClusterObjectFieldDescriptor(Label="clusterRevision", Tag=0x0000FFFD, Type=uint), + ]) + + countdownTime: typing.Union[None, Nullable, uint] = None + mainState: ClosureControl.Enums.MainStateEnum = 0 + currentErrorList: typing.List[ClosureControl.Enums.ClosureErrorEnum] = field(default_factory=lambda: []) + overallState: typing.Union[Nullable, ClosureControl.Structs.OverallStateStruct] = NullValue + overallTarget: typing.Union[Nullable, ClosureControl.Structs.OverallTargetStruct] = NullValue + restingProcedure: typing.Optional[ClosureControl.Enums.RestingProcedureEnum] = None + triggerCondition: typing.Optional[ClosureControl.Enums.TriggerConditionEnum] = None + triggerPosition: typing.Optional[ClosureControl.Enums.TriggerPositionEnum] = None + waitingDelay: typing.Optional[uint] = None + kickoffTimer: typing.Optional[uint] = None + generatedCommandList: typing.List[uint] = field(default_factory=lambda: []) + acceptedCommandList: typing.List[uint] = field(default_factory=lambda: []) + attributeList: typing.List[uint] = field(default_factory=lambda: []) + featureMap: uint = 0 + clusterRevision: uint = 0 + + class Enums: + class ClosureErrorEnum(MatterIntEnum): + kBlocked = 0x00 + kTemperatureLimited = 0x01 + kMaintenanceRequired = 0x02 + kInternalInterference = 0x03 + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. + kUnknownEnumValue = 4 + + class LatchingEnum(MatterIntEnum): + kLatchedAndSecured = 0x00 + kLatchedButNotSecured = 0x01 + kNotLatched = 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 an unknown + # enum value. This specific value should never be transmitted. + kUnknownEnumValue = 3 + + class MainStateEnum(MatterIntEnum): + kStopped = 0x00 + kMoving = 0x01 + kWaitingForMotion = 0x02 + kError = 0x03 + kCalibrating = 0x04 + kProtected = 0x05 + kDisengaged = 0x06 + kSetupRequired = 0x07 + kPendingFallback = 0x08 + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. + kUnknownEnumValue = 9 + + class PositioningEnum(MatterIntEnum): + kFullyClosed = 0x00 + kFullyOpened = 0x01 + kPartiallyOpened = 0x02 + kOpenedForPedestrian = 0x03 + kOpenedForVentilation = 0x04 + kOpenedAtSignature = 0x05 + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. + kUnknownEnumValue = 6 + + class RestingProcedureEnum(MatterIntEnum): + kDoNothing = 0x00 + kReturnToFullyOpened = 0x01 + kReturnToFullyClosed = 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 an unknown + # enum value. This specific value should never be transmitted. + kUnknownEnumValue = 3 + + class TagLatchEnum(MatterIntEnum): + kLatch = 0x00 + kUnlatch = 0x01 + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. + kUnknownEnumValue = 2 + + class TagPositionEnum(MatterIntEnum): + kCloseInFull = 0x00 + kOpenInFull = 0x01 + kPedestrian = 0x02 + kVentilation = 0x03 + kSignature = 0x04 + kSequenceNextStep = 0x05 + kPedestrianNextStep = 0x06 + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. + kUnknownEnumValue = 7 + + class TriggerConditionEnum(MatterIntEnum): + kAfterDelay = 0x00 + kAfterApplicativeTrigger = 0x01 + kAfterDelayOrApplicativeTrigger = 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 an unknown + # enum value. This specific value should never be transmitted. + kUnknownEnumValue = 3 + + class TriggerPositionEnum(MatterIntEnum): + kAtFullyClosed = 0x00 + kAtFullyOpened = 0x01 + kInBetween = 0x02 + kAtVentilation = 0x03 + kAtPedestrian = 0x04 + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. + kUnknownEnumValue = 5 + + class Bitmaps: + class Feature(IntFlag): + kPositioning = 0x1 + kMotionLatching = 0x2 + kInstantaneous = 0x4 + kSpeed = 0x8 + kVentilation = 0x10 + kPedestrian = 0x20 + kCalibration = 0x40 + kProtection = 0x80 + kManuallyOperable = 0x100 + kFallback = 0x200 + + class Structs: + @dataclass + class OverallStateStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="positioning", Tag=0, Type=typing.Optional[ClosureControl.Enums.PositioningEnum]), + ClusterObjectFieldDescriptor(Label="latching", Tag=1, Type=typing.Optional[ClosureControl.Enums.LatchingEnum]), + ClusterObjectFieldDescriptor(Label="speed", Tag=2, Type=typing.Optional[Globals.Enums.ThreeLevelAutoEnum]), + ClusterObjectFieldDescriptor(Label="extraInfo", Tag=3, Type=typing.Optional[uint]), + ]) + + positioning: 'typing.Optional[ClosureControl.Enums.PositioningEnum]' = None + latching: 'typing.Optional[ClosureControl.Enums.LatchingEnum]' = None + speed: 'typing.Optional[Globals.Enums.ThreeLevelAutoEnum]' = None + extraInfo: 'typing.Optional[uint]' = None + + @dataclass + class OverallTargetStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="tagPosition", Tag=0, Type=typing.Optional[ClosureControl.Enums.TagPositionEnum]), + ClusterObjectFieldDescriptor(Label="tagLatch", Tag=1, Type=typing.Optional[ClosureControl.Enums.TagLatchEnum]), + ClusterObjectFieldDescriptor(Label="speed", Tag=2, Type=typing.Optional[Globals.Enums.ThreeLevelAutoEnum]), + ]) + + tagPosition: 'typing.Optional[ClosureControl.Enums.TagPositionEnum]' = None + tagLatch: 'typing.Optional[ClosureControl.Enums.TagLatchEnum]' = None + speed: 'typing.Optional[Globals.Enums.ThreeLevelAutoEnum]' = None + + class Commands: + @dataclass + class Stop(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x00000104 + command_id: typing.ClassVar[int] = 0x00000000 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[typing.Optional[str]] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ]) + + @dataclass + class MoveTo(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x00000104 + command_id: typing.ClassVar[int] = 0x00000001 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[typing.Optional[str]] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="tag", Tag=0, Type=typing.Optional[ClosureControl.Enums.TagPositionEnum]), + ClusterObjectFieldDescriptor(Label="latch", Tag=1, Type=typing.Optional[ClosureControl.Enums.TagLatchEnum]), + ClusterObjectFieldDescriptor(Label="speed", Tag=2, Type=typing.Optional[Globals.Enums.ThreeLevelAutoEnum]), + ]) + + tag: typing.Optional[ClosureControl.Enums.TagPositionEnum] = None + latch: typing.Optional[ClosureControl.Enums.TagLatchEnum] = None + speed: typing.Optional[Globals.Enums.ThreeLevelAutoEnum] = None + + @dataclass + class Calibrate(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x00000104 + command_id: typing.ClassVar[int] = 0x00000002 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[typing.Optional[str]] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ]) + + @dataclass + class ConfigureFallback(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x00000104 + command_id: typing.ClassVar[int] = 0x00000003 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[typing.Optional[str]] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="restingProcedure", Tag=0, Type=typing.Optional[ClosureControl.Enums.RestingProcedureEnum]), + ClusterObjectFieldDescriptor(Label="triggerCondition", Tag=1, Type=typing.Optional[ClosureControl.Enums.TriggerConditionEnum]), + ClusterObjectFieldDescriptor(Label="triggerPosition", Tag=2, Type=typing.Optional[ClosureControl.Enums.TriggerPositionEnum]), + ClusterObjectFieldDescriptor(Label="waitingDelay", Tag=3, Type=typing.Optional[uint]), + ]) + + restingProcedure: typing.Optional[ClosureControl.Enums.RestingProcedureEnum] = None + triggerCondition: typing.Optional[ClosureControl.Enums.TriggerConditionEnum] = None + triggerPosition: typing.Optional[ClosureControl.Enums.TriggerPositionEnum] = None + waitingDelay: typing.Optional[uint] = None + + @dataclass + class CancelFallback(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x00000104 + command_id: typing.ClassVar[int] = 0x00000004 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[typing.Optional[str]] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ]) + + class Attributes: + @dataclass + class CountdownTime(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000104 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000000 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, uint]) + + value: typing.Union[None, Nullable, uint] = None + + @dataclass + class MainState(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000104 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000001 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=ClosureControl.Enums.MainStateEnum) + + value: ClosureControl.Enums.MainStateEnum = 0 + + @dataclass + class CurrentErrorList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000104 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000002 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[ClosureControl.Enums.ClosureErrorEnum]) + + value: typing.List[ClosureControl.Enums.ClosureErrorEnum] = field(default_factory=lambda: []) + + @dataclass + class OverallState(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000104 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000003 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, ClosureControl.Structs.OverallStateStruct]) + + value: typing.Union[Nullable, ClosureControl.Structs.OverallStateStruct] = NullValue + + @dataclass + class OverallTarget(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000104 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000004 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, ClosureControl.Structs.OverallTargetStruct]) + + value: typing.Union[Nullable, ClosureControl.Structs.OverallTargetStruct] = NullValue + + @dataclass + class RestingProcedure(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000104 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000005 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Optional[ClosureControl.Enums.RestingProcedureEnum]) + + value: typing.Optional[ClosureControl.Enums.RestingProcedureEnum] = None + + @dataclass + class TriggerCondition(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000104 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000006 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Optional[ClosureControl.Enums.TriggerConditionEnum]) + + value: typing.Optional[ClosureControl.Enums.TriggerConditionEnum] = None + + @dataclass + class TriggerPosition(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000104 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000007 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Optional[ClosureControl.Enums.TriggerPositionEnum]) + + value: typing.Optional[ClosureControl.Enums.TriggerPositionEnum] = None + + @dataclass + class WaitingDelay(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000104 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000008 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Optional[uint]) + + value: typing.Optional[uint] = None + + @dataclass + class KickoffTimer(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000104 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000009 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Optional[uint]) + + value: typing.Optional[uint] = None + + @dataclass + class GeneratedCommandList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000104 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFF8 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: typing.List[uint] = field(default_factory=lambda: []) + + @dataclass + class AcceptedCommandList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000104 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFF9 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: typing.List[uint] = field(default_factory=lambda: []) + + @dataclass + class AttributeList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000104 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFB + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: typing.List[uint] = field(default_factory=lambda: []) + + @dataclass + class FeatureMap(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000104 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFC + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: uint = 0 + + @dataclass + class ClusterRevision(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000104 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFD + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: uint = 0 + + @dataclass class ServiceArea(Cluster): id: typing.ClassVar[int] = 0x00000150 diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm index 592539f41ef0c9..9a16fb4d530724 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm @@ -3452,6 +3452,60 @@ static BOOL AttributeIsSpecifiedInWindowCoveringCluster(AttributeId aAttributeId } } } +static BOOL AttributeIsSpecifiedInClosureControlCluster(AttributeId aAttributeId) +{ + using namespace Clusters::ClosureControl; + switch (aAttributeId) { + case Attributes::CountdownTime::Id: { + return YES; + } + case Attributes::MainState::Id: { + return YES; + } + case Attributes::CurrentErrorList::Id: { + return YES; + } + case Attributes::OverallState::Id: { + return YES; + } + case Attributes::OverallTarget::Id: { + return YES; + } + case Attributes::RestingProcedure::Id: { + return YES; + } + case Attributes::TriggerCondition::Id: { + return YES; + } + case Attributes::TriggerPosition::Id: { + return YES; + } + case Attributes::WaitingDelay::Id: { + return YES; + } + case Attributes::KickoffTimer::Id: { + return YES; + } + case Attributes::GeneratedCommandList::Id: { + return YES; + } + case Attributes::AcceptedCommandList::Id: { + return YES; + } + case Attributes::AttributeList::Id: { + return YES; + } + case Attributes::FeatureMap::Id: { + return YES; + } + case Attributes::ClusterRevision::Id: { + return YES; + } + default: { + return NO; + } + } +} static BOOL AttributeIsSpecifiedInServiceAreaCluster(AttributeId aAttributeId) { using namespace Clusters::ServiceArea; @@ -6522,6 +6576,9 @@ BOOL MTRAttributeIsSpecified(ClusterId aClusterId, AttributeId aAttributeId) case Clusters::WindowCovering::Id: { return AttributeIsSpecifiedInWindowCoveringCluster(aAttributeId); } + case Clusters::ClosureControl::Id: { + return AttributeIsSpecifiedInClosureControlCluster(aAttributeId); + } case Clusters::ServiceArea::Id: { return AttributeIsSpecifiedInServiceAreaCluster(aAttributeId); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index d4d01127b2d988..1030489bc492d6 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -10669,6 +10669,190 @@ static id _Nullable DecodeAttributeValueForWindowCoveringCluster(AttributeId aAt *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; return nil; } +static id _Nullable DecodeAttributeValueForClosureControlCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::ClosureControl; + switch (aAttributeId) { + case Attributes::CountdownTime::Id: { + using TypeInfo = Attributes::CountdownTime::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::MainState::Id: { + using TypeInfo = Attributes::MainState::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::CurrentErrorList::Id: { + using TypeInfo = Attributes::CurrentErrorList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::OverallState::Id: { + using TypeInfo = Attributes::OverallState::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + MTRClosureControlClusterOverallStateStruct * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [MTRClosureControlClusterOverallStateStruct new]; + if (cppValue.Value().positioning.HasValue()) { + value.positioning = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value().positioning.Value())]; + } else { + value.positioning = nil; + } + if (cppValue.Value().latching.HasValue()) { + value.latching = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value().latching.Value())]; + } else { + value.latching = nil; + } + if (cppValue.Value().speed.HasValue()) { + value.speed = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value().speed.Value())]; + } else { + value.speed = nil; + } + if (cppValue.Value().extraInfo.HasValue()) { + value.extraInfo = [NSNumber numberWithUnsignedInt:cppValue.Value().extraInfo.Value()]; + } else { + value.extraInfo = nil; + } + } + return value; + } + case Attributes::OverallTarget::Id: { + using TypeInfo = Attributes::OverallTarget::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + MTRClosureControlClusterOverallTargetStruct * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [MTRClosureControlClusterOverallTargetStruct new]; + if (cppValue.Value().tagPosition.HasValue()) { + value.tagPosition = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value().tagPosition.Value())]; + } else { + value.tagPosition = nil; + } + if (cppValue.Value().tagLatch.HasValue()) { + value.tagLatch = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value().tagLatch.Value())]; + } else { + value.tagLatch = nil; + } + if (cppValue.Value().speed.HasValue()) { + value.speed = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value().speed.Value())]; + } else { + value.speed = nil; + } + } + return value; + } + case Attributes::RestingProcedure::Id: { + using TypeInfo = Attributes::RestingProcedure::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::TriggerCondition::Id: { + using TypeInfo = Attributes::TriggerCondition::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::TriggerPosition::Id: { + using TypeInfo = Attributes::TriggerPosition::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::WaitingDelay::Id: { + using TypeInfo = Attributes::WaitingDelay::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::KickoffTimer::Id: { + using TypeInfo = Attributes::KickoffTimer::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} static id _Nullable DecodeAttributeValueForServiceAreaCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) { using namespace Clusters::ServiceArea; @@ -19981,6 +20165,9 @@ id _Nullable MTRDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::T case Clusters::WindowCovering::Id: { return DecodeAttributeValueForWindowCoveringCluster(aPath.mAttributeId, aReader, aError); } + case Clusters::ClosureControl::Id: { + return DecodeAttributeValueForClosureControlCluster(aPath.mAttributeId, aReader, aError); + } case Clusters::ServiceArea::Id: { return DecodeAttributeValueForServiceAreaCluster(aPath.mAttributeId, aReader, aError); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index 7bd0546659845c..f088c400bcbc6b 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -8768,6 +8768,162 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @end +/** + * Cluster Closure Control + * + * + */ +MTR_PROVISIONALLY_AVAILABLE +@interface MTRBaseClusterClosureControl : MTRGenericBaseCluster + +/** + * Command Stop + * + * On receipt of this command, the device SHALL stop its operation if it is at a position where it is safe to do so and/or permitted. + */ +- (void)stopWithParams:(MTRClosureControlClusterStopParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)stopWithCompletion:(MTRStatusCompletion)completion + MTR_PROVISIONALLY_AVAILABLE; +/** + * Command MoveTo + * + * Upon receipt, this SHALL move the product in the most fitting state following the data as follows: + */ +- (void)moveToWithParams:(MTRClosureControlClusterMoveToParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)moveToWithCompletion:(MTRStatusCompletion)completion + MTR_PROVISIONALLY_AVAILABLE; +/** + * Command Calibrate + * + * Upon receipt, this SHALL initiate a calibration. + */ +- (void)calibrateWithParams:(MTRClosureControlClusterCalibrateParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)calibrateWithCompletion:(MTRStatusCompletion)completion + MTR_PROVISIONALLY_AVAILABLE; +/** + * Command ConfigureFallback + * + * Upon receipt, this SHALL configure the Fallback feature behavior using the data as follows: + */ +- (void)configureFallbackWithParams:(MTRClosureControlClusterConfigureFallbackParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)configureFallbackWithCompletion:(MTRStatusCompletion)completion + MTR_PROVISIONALLY_AVAILABLE; +/** + * Command CancelFallback + * + * Upon receipt, this SHALL cancel the current PendingFallback. + */ +- (void)cancelFallbackWithParams:(MTRClosureControlClusterCancelFallbackParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)cancelFallbackWithCompletion:(MTRStatusCompletion)completion + MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeCountdownTimeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeCountdownTimeWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeCountdownTimeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeMainStateWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeMainStateWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeMainStateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeCurrentErrorListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeCurrentErrorListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeCurrentErrorListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeOverallStateWithCompletion:(void (^)(MTRClosureControlClusterOverallStateStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeOverallStateWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTRClosureControlClusterOverallStateStruct * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeOverallStateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRClosureControlClusterOverallStateStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeOverallTargetWithCompletion:(void (^)(MTRClosureControlClusterOverallTargetStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeOverallTargetWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTRClosureControlClusterOverallTargetStruct * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeOverallTargetWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRClosureControlClusterOverallTargetStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeRestingProcedureWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeRestingProcedureWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeRestingProcedureWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeTriggerConditionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeTriggerConditionWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeTriggerConditionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeTriggerPositionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeTriggerPositionWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeTriggerPositionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeWaitingDelayWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeWaitingDelayWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeWaitingDelayWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeKickoffTimerWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeKickoffTimerWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeKickoffTimerWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; + +@end + +@interface MTRBaseClusterClosureControl (Availability) + +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ +- (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device + endpointID:(NSNumber *)endpointID + queue:(dispatch_queue_t)queue MTR_PROVISIONALLY_AVAILABLE; + +@end + /** * Cluster Service Area * @@ -18986,6 +19142,88 @@ typedef NS_OPTIONS(uint16_t, MTRWindowCoveringSafetyStatus) { MTRWindowCoveringSafetyStatusProtection MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x800, } MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); +typedef NS_ENUM(uint8_t, MTRClosureControlClosureError) { + MTRClosureControlClosureErrorBlocked MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRClosureControlClosureErrorTemperatureLimited MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRClosureControlClosureErrorMaintenanceRequired MTR_PROVISIONALLY_AVAILABLE = 0x02, + MTRClosureControlClosureErrorInternalInterference MTR_PROVISIONALLY_AVAILABLE = 0x03, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_ENUM(uint8_t, MTRClosureControlLatching) { + MTRClosureControlLatchingLatchedAndSecured MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRClosureControlLatchingLatchedButNotSecured MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRClosureControlLatchingNotLatched MTR_PROVISIONALLY_AVAILABLE = 0x02, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_ENUM(uint8_t, MTRClosureControlMainState) { + MTRClosureControlMainStateStopped MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRClosureControlMainStateMoving MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRClosureControlMainStateWaitingForMotion MTR_PROVISIONALLY_AVAILABLE = 0x02, + MTRClosureControlMainStateError MTR_PROVISIONALLY_AVAILABLE = 0x03, + MTRClosureControlMainStateCalibrating MTR_PROVISIONALLY_AVAILABLE = 0x04, + MTRClosureControlMainStateProtected MTR_PROVISIONALLY_AVAILABLE = 0x05, + MTRClosureControlMainStateDisengaged MTR_PROVISIONALLY_AVAILABLE = 0x06, + MTRClosureControlMainStateSetupRequired MTR_PROVISIONALLY_AVAILABLE = 0x07, + MTRClosureControlMainStatePendingFallback MTR_PROVISIONALLY_AVAILABLE = 0x08, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_ENUM(uint8_t, MTRClosureControlPositioning) { + MTRClosureControlPositioningFullyClosed MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRClosureControlPositioningFullyOpened MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRClosureControlPositioningPartiallyOpened MTR_PROVISIONALLY_AVAILABLE = 0x02, + MTRClosureControlPositioningOpenedForPedestrian MTR_PROVISIONALLY_AVAILABLE = 0x03, + MTRClosureControlPositioningOpenedForVentilation MTR_PROVISIONALLY_AVAILABLE = 0x04, + MTRClosureControlPositioningOpenedAtSignature MTR_PROVISIONALLY_AVAILABLE = 0x05, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_ENUM(uint8_t, MTRClosureControlRestingProcedure) { + MTRClosureControlRestingProcedureDoNothing MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRClosureControlRestingProcedureReturnToFullyOpened MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRClosureControlRestingProcedureReturnToFullyClosed MTR_PROVISIONALLY_AVAILABLE = 0x02, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_ENUM(uint8_t, MTRClosureControlTagLatch) { + MTRClosureControlTagLatchLatch MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRClosureControlTagLatchUnlatch MTR_PROVISIONALLY_AVAILABLE = 0x01, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_ENUM(uint8_t, MTRClosureControlTagPosition) { + MTRClosureControlTagPositionCloseInFull MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRClosureControlTagPositionOpenInFull MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRClosureControlTagPositionPedestrian MTR_PROVISIONALLY_AVAILABLE = 0x02, + MTRClosureControlTagPositionVentilation MTR_PROVISIONALLY_AVAILABLE = 0x03, + MTRClosureControlTagPositionSignature MTR_PROVISIONALLY_AVAILABLE = 0x04, + MTRClosureControlTagPositionSequenceNextStep MTR_PROVISIONALLY_AVAILABLE = 0x05, + MTRClosureControlTagPositionPedestrianNextStep MTR_PROVISIONALLY_AVAILABLE = 0x06, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_ENUM(uint8_t, MTRClosureControlTriggerCondition) { + MTRClosureControlTriggerConditionAfterDelay MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRClosureControlTriggerConditionAfterApplicativeTrigger MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRClosureControlTriggerConditionAfterDelayOrApplicativeTrigger MTR_PROVISIONALLY_AVAILABLE = 0x02, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_ENUM(uint8_t, MTRClosureControlTriggerPosition) { + MTRClosureControlTriggerPositionAtFullyClosed MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRClosureControlTriggerPositionAtFullyOpened MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRClosureControlTriggerPositionInBetween MTR_PROVISIONALLY_AVAILABLE = 0x02, + MTRClosureControlTriggerPositionAtVentilation MTR_PROVISIONALLY_AVAILABLE = 0x03, + MTRClosureControlTriggerPositionAtPedestrian MTR_PROVISIONALLY_AVAILABLE = 0x04, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_OPTIONS(uint32_t, MTRClosureControlFeature) { + MTRClosureControlFeaturePositioning MTR_PROVISIONALLY_AVAILABLE = 0x1, + MTRClosureControlFeatureMotionLatching MTR_PROVISIONALLY_AVAILABLE = 0x2, + MTRClosureControlFeatureInstantaneous MTR_PROVISIONALLY_AVAILABLE = 0x4, + MTRClosureControlFeatureSpeed MTR_PROVISIONALLY_AVAILABLE = 0x8, + MTRClosureControlFeatureVentilation MTR_PROVISIONALLY_AVAILABLE = 0x10, + MTRClosureControlFeaturePedestrian MTR_PROVISIONALLY_AVAILABLE = 0x20, + MTRClosureControlFeatureCalibration MTR_PROVISIONALLY_AVAILABLE = 0x40, + MTRClosureControlFeatureProtection MTR_PROVISIONALLY_AVAILABLE = 0x80, + MTRClosureControlFeatureManuallyOperable MTR_PROVISIONALLY_AVAILABLE = 0x100, + MTRClosureControlFeatureFallback MTR_PROVISIONALLY_AVAILABLE = 0x200, +} MTR_PROVISIONALLY_AVAILABLE; + typedef NS_ENUM(uint8_t, MTRServiceAreaOperationalStatus) { MTRServiceAreaOperationalStatusPending MTR_AVAILABLE(ios(18.4), macos(15.4), watchos(11.4), tvos(18.4)) = 0x00, MTRServiceAreaOperationalStatusOperating MTR_AVAILABLE(ios(18.4), macos(15.4), watchos(11.4), tvos(18.4)) = 0x01, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index ff9a7ca7c96a80..d963fd1c84f259 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -58476,6 +58476,691 @@ - (nullable instancetype)initWithDevice:(MTRBaseDevice *)device @end +@implementation MTRBaseClusterClosureControl + +- (void)stopWithCompletion:(MTRStatusCompletion)completion +{ + [self stopWithParams:nil completion:completion]; +} +- (void)stopWithParams:(MTRClosureControlClusterStopParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRClosureControlClusterStopParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = ClosureControl::Commands::Stop::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} +- (void)moveToWithCompletion:(MTRStatusCompletion)completion +{ + [self moveToWithParams:nil completion:completion]; +} +- (void)moveToWithParams:(MTRClosureControlClusterMoveToParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRClosureControlClusterMoveToParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = ClosureControl::Commands::MoveTo::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} +- (void)calibrateWithCompletion:(MTRStatusCompletion)completion +{ + [self calibrateWithParams:nil completion:completion]; +} +- (void)calibrateWithParams:(MTRClosureControlClusterCalibrateParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRClosureControlClusterCalibrateParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = ClosureControl::Commands::Calibrate::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} +- (void)configureFallbackWithCompletion:(MTRStatusCompletion)completion +{ + [self configureFallbackWithParams:nil completion:completion]; +} +- (void)configureFallbackWithParams:(MTRClosureControlClusterConfigureFallbackParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRClosureControlClusterConfigureFallbackParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = ClosureControl::Commands::ConfigureFallback::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} +- (void)cancelFallbackWithCompletion:(MTRStatusCompletion)completion +{ + [self cancelFallbackWithParams:nil completion:completion]; +} +- (void)cancelFallbackWithParams:(MTRClosureControlClusterCancelFallbackParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRClosureControlClusterCancelFallbackParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = ClosureControl::Commands::CancelFallback::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} + +- (void)readAttributeCountdownTimeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ClosureControl::Attributes::CountdownTime::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeCountdownTimeWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ClosureControl::Attributes::CountdownTime::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeCountdownTimeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ClosureControl::Attributes::CountdownTime::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeMainStateWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ClosureControl::Attributes::MainState::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeMainStateWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ClosureControl::Attributes::MainState::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeMainStateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ClosureControl::Attributes::MainState::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeCurrentErrorListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ClosureControl::Attributes::CurrentErrorList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeCurrentErrorListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ClosureControl::Attributes::CurrentErrorList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeCurrentErrorListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ClosureControl::Attributes::CurrentErrorList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeOverallStateWithCompletion:(void (^)(MTRClosureControlClusterOverallStateStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ClosureControl::Attributes::OverallState::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeOverallStateWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTRClosureControlClusterOverallStateStruct * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ClosureControl::Attributes::OverallState::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeOverallStateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRClosureControlClusterOverallStateStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ClosureControl::Attributes::OverallState::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeOverallTargetWithCompletion:(void (^)(MTRClosureControlClusterOverallTargetStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ClosureControl::Attributes::OverallTarget::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeOverallTargetWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTRClosureControlClusterOverallTargetStruct * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ClosureControl::Attributes::OverallTarget::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeOverallTargetWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRClosureControlClusterOverallTargetStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ClosureControl::Attributes::OverallTarget::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeRestingProcedureWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ClosureControl::Attributes::RestingProcedure::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeRestingProcedureWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ClosureControl::Attributes::RestingProcedure::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeRestingProcedureWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ClosureControl::Attributes::RestingProcedure::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeTriggerConditionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ClosureControl::Attributes::TriggerCondition::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeTriggerConditionWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ClosureControl::Attributes::TriggerCondition::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeTriggerConditionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ClosureControl::Attributes::TriggerCondition::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeTriggerPositionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ClosureControl::Attributes::TriggerPosition::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeTriggerPositionWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ClosureControl::Attributes::TriggerPosition::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeTriggerPositionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ClosureControl::Attributes::TriggerPosition::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeWaitingDelayWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ClosureControl::Attributes::WaitingDelay::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeWaitingDelayWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ClosureControl::Attributes::WaitingDelay::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeWaitingDelayWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ClosureControl::Attributes::WaitingDelay::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeKickoffTimerWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ClosureControl::Attributes::KickoffTimer::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeKickoffTimerWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ClosureControl::Attributes::KickoffTimer::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeKickoffTimerWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ClosureControl::Attributes::KickoffTimer::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ClosureControl::Attributes::GeneratedCommandList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ClosureControl::Attributes::GeneratedCommandList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ClosureControl::Attributes::GeneratedCommandList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ClosureControl::Attributes::AcceptedCommandList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ClosureControl::Attributes::AcceptedCommandList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ClosureControl::Attributes::AcceptedCommandList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ClosureControl::Attributes::AttributeList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ClosureControl::Attributes::AttributeList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ClosureControl::Attributes::AttributeList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ClosureControl::Attributes::FeatureMap::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ClosureControl::Attributes::FeatureMap::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ClosureControl::Attributes::FeatureMap::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ClosureControl::Attributes::ClusterRevision::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ClosureControl::Attributes::ClusterRevision::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ClosureControl::Attributes::ClusterRevision::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +@end + @implementation MTRBaseClusterServiceArea - (void)selectAreasWithParams:(MTRServiceAreaClusterSelectAreasParams *)params completion:(void (^)(MTRServiceAreaClusterSelectAreasResponseParams * _Nullable data, NSError * _Nullable error))completion diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index d6f8f73697ae22..ba4e10ff5d32e0 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -157,6 +157,7 @@ typedef NS_ENUM(uint32_t, MTRClusterIDType) { MTRClusterIDTypeDeviceEnergyManagementModeID MTR_AVAILABLE(ios(18.4), macos(15.4), watchos(11.4), tvos(18.4)) = 0x0000009F, MTRClusterIDTypeDoorLockID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000101, MTRClusterIDTypeWindowCoveringID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000102, + MTRClusterIDTypeClosureControlID MTR_PROVISIONALLY_AVAILABLE = 0x00000104, MTRClusterIDTypeServiceAreaID MTR_AVAILABLE(ios(18.4), macos(15.4), watchos(11.4), tvos(18.4)) = 0x00000150, MTRClusterIDTypePumpConfigurationAndControlID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000200, MTRClusterIDTypeThermostatID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000201, @@ -2900,6 +2901,23 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterWindowCoveringAttributeFeatureMapID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = MTRAttributeIDTypeGlobalAttributeFeatureMapID, MTRAttributeIDTypeClusterWindowCoveringAttributeClusterRevisionID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = MTRAttributeIDTypeGlobalAttributeClusterRevisionID, + // Cluster ClosureControl attributes + MTRAttributeIDTypeClusterClosureControlAttributeCountdownTimeID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, + MTRAttributeIDTypeClusterClosureControlAttributeMainStateID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + MTRAttributeIDTypeClusterClosureControlAttributeCurrentErrorListID MTR_PROVISIONALLY_AVAILABLE = 0x00000002, + MTRAttributeIDTypeClusterClosureControlAttributeOverallStateID MTR_PROVISIONALLY_AVAILABLE = 0x00000003, + MTRAttributeIDTypeClusterClosureControlAttributeOverallTargetID MTR_PROVISIONALLY_AVAILABLE = 0x00000004, + MTRAttributeIDTypeClusterClosureControlAttributeRestingProcedureID MTR_PROVISIONALLY_AVAILABLE = 0x00000005, + MTRAttributeIDTypeClusterClosureControlAttributeTriggerConditionID MTR_PROVISIONALLY_AVAILABLE = 0x00000006, + MTRAttributeIDTypeClusterClosureControlAttributeTriggerPositionID MTR_PROVISIONALLY_AVAILABLE = 0x00000007, + MTRAttributeIDTypeClusterClosureControlAttributeWaitingDelayID MTR_PROVISIONALLY_AVAILABLE = 0x00000008, + MTRAttributeIDTypeClusterClosureControlAttributeKickoffTimerID MTR_PROVISIONALLY_AVAILABLE = 0x00000009, + MTRAttributeIDTypeClusterClosureControlAttributeGeneratedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID, + MTRAttributeIDTypeClusterClosureControlAttributeAcceptedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID, + MTRAttributeIDTypeClusterClosureControlAttributeAttributeListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAttributeListID, + MTRAttributeIDTypeClusterClosureControlAttributeFeatureMapID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeFeatureMapID, + MTRAttributeIDTypeClusterClosureControlAttributeClusterRevisionID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeClusterRevisionID, + // Cluster ServiceArea attributes MTRAttributeIDTypeClusterServiceAreaAttributeSupportedAreasID MTR_AVAILABLE(ios(18.4), macos(15.4), watchos(11.4), tvos(18.4)) = 0x00000000, MTRAttributeIDTypeClusterServiceAreaAttributeSupportedMapsID MTR_AVAILABLE(ios(18.4), macos(15.4), watchos(11.4), tvos(18.4)) = 0x00000001, @@ -6575,6 +6593,13 @@ typedef NS_ENUM(uint32_t, MTRCommandIDType) { MTRCommandIDTypeClusterWindowCoveringCommandGoToTiltValueID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000007, MTRCommandIDTypeClusterWindowCoveringCommandGoToTiltPercentageID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000008, + // Cluster ClosureControl commands + MTRCommandIDTypeClusterClosureControlCommandStopID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, + MTRCommandIDTypeClusterClosureControlCommandMoveToID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + MTRCommandIDTypeClusterClosureControlCommandCalibrateID MTR_PROVISIONALLY_AVAILABLE = 0x00000002, + MTRCommandIDTypeClusterClosureControlCommandConfigureFallbackID MTR_PROVISIONALLY_AVAILABLE = 0x00000003, + MTRCommandIDTypeClusterClosureControlCommandCancelFallbackID MTR_PROVISIONALLY_AVAILABLE = 0x00000004, + // Cluster ServiceArea commands MTRCommandIDTypeClusterServiceAreaCommandSelectAreasID MTR_AVAILABLE(ios(18.4), macos(15.4), watchos(11.4), tvos(18.4)) = 0x00000000, MTRCommandIDTypeClusterServiceAreaCommandSelectAreasResponseID MTR_AVAILABLE(ios(18.4), macos(15.4), watchos(11.4), tvos(18.4)) = 0x00000001, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm index f00e246b93d3a8..8038ac3e4ec81b 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm @@ -249,6 +249,9 @@ case MTRClusterIDTypeWindowCoveringID: result = @"WindowCovering"; break; + case MTRClusterIDTypeClosureControlID: + result = @"ClosureControl"; + break; case MTRClusterIDTypeServiceAreaID: result = @"ServiceArea"; break; @@ -4920,6 +4923,77 @@ } break; + case MTRClusterIDTypeClosureControlID: + + switch (attributeID) { + + // Cluster ClosureControl attributes + case MTRAttributeIDTypeClusterClosureControlAttributeCountdownTimeID: + result = @"CountdownTime"; + break; + + case MTRAttributeIDTypeClusterClosureControlAttributeMainStateID: + result = @"MainState"; + break; + + case MTRAttributeIDTypeClusterClosureControlAttributeCurrentErrorListID: + result = @"CurrentErrorList"; + break; + + case MTRAttributeIDTypeClusterClosureControlAttributeOverallStateID: + result = @"OverallState"; + break; + + case MTRAttributeIDTypeClusterClosureControlAttributeOverallTargetID: + result = @"OverallTarget"; + break; + + case MTRAttributeIDTypeClusterClosureControlAttributeRestingProcedureID: + result = @"RestingProcedure"; + break; + + case MTRAttributeIDTypeClusterClosureControlAttributeTriggerConditionID: + result = @"TriggerCondition"; + break; + + case MTRAttributeIDTypeClusterClosureControlAttributeTriggerPositionID: + result = @"TriggerPosition"; + break; + + case MTRAttributeIDTypeClusterClosureControlAttributeWaitingDelayID: + result = @"WaitingDelay"; + break; + + case MTRAttributeIDTypeClusterClosureControlAttributeKickoffTimerID: + result = @"KickoffTimer"; + break; + + case MTRAttributeIDTypeClusterClosureControlAttributeGeneratedCommandListID: + result = @"GeneratedCommandList"; + break; + + case MTRAttributeIDTypeClusterClosureControlAttributeAcceptedCommandListID: + result = @"AcceptedCommandList"; + break; + + case MTRAttributeIDTypeClusterClosureControlAttributeAttributeListID: + result = @"AttributeList"; + break; + + case MTRAttributeIDTypeClusterClosureControlAttributeFeatureMapID: + result = @"FeatureMap"; + break; + + case MTRAttributeIDTypeClusterClosureControlAttributeClusterRevisionID: + result = @"ClusterRevision"; + break; + + default: + result = [NSString stringWithFormat:@"", attributeID]; + break; + } + break; + case MTRClusterIDTypeServiceAreaID: switch (attributeID) { @@ -10128,6 +10202,36 @@ } break; + case MTRClusterIDTypeClosureControlID: + + switch (commandID) { + + case MTRCommandIDTypeClusterClosureControlCommandStopID: + result = @"Stop"; + break; + + case MTRCommandIDTypeClusterClosureControlCommandMoveToID: + result = @"MoveTo"; + break; + + case MTRCommandIDTypeClusterClosureControlCommandCalibrateID: + result = @"Calibrate"; + break; + + case MTRCommandIDTypeClusterClosureControlCommandConfigureFallbackID: + result = @"ConfigureFallback"; + break; + + case MTRCommandIDTypeClusterClosureControlCommandCancelFallbackID: + result = @"CancelFallback"; + break; + + default: + result = [NSString stringWithFormat:@"", commandID]; + break; + } + break; + case MTRClusterIDTypeServiceAreaID: switch (commandID) { @@ -12258,6 +12362,16 @@ } break; + case MTRClusterIDTypeClosureControlID: + + switch (commandID) { + + default: + result = [NSString stringWithFormat:@"", commandID]; + break; + } + break; + case MTRClusterIDTypeServiceAreaID: switch (commandID) { @@ -14131,6 +14245,16 @@ } break; + case MTRClusterIDTypeClosureControlID: + + switch (eventID) { + + default: + result = [NSString stringWithFormat:@"", eventID]; + break; + } + break; + case MTRClusterIDTypeServiceAreaID: switch (eventID) { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index f1af62ad5191cc..1d313db71bdaad 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -4114,6 +4114,76 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @end +/** + * Cluster Closure Control + * + */ +MTR_PROVISIONALLY_AVAILABLE +@interface MTRClusterClosureControl : MTRGenericCluster + +- (void)stopWithParams:(MTRClosureControlClusterStopParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)stopWithExpectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion + MTR_PROVISIONALLY_AVAILABLE; +- (void)moveToWithParams:(MTRClosureControlClusterMoveToParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)moveToWithExpectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion + MTR_PROVISIONALLY_AVAILABLE; +- (void)calibrateWithParams:(MTRClosureControlClusterCalibrateParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)calibrateWithExpectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion + MTR_PROVISIONALLY_AVAILABLE; +- (void)configureFallbackWithParams:(MTRClosureControlClusterConfigureFallbackParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)configureFallbackWithExpectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion + MTR_PROVISIONALLY_AVAILABLE; +- (void)cancelFallbackWithParams:(MTRClosureControlClusterCancelFallbackParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)cancelFallbackWithExpectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion + MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeCountdownTimeWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeMainStateWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeCurrentErrorListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeOverallStateWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeOverallTargetWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeRestingProcedureWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeTriggerConditionWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeTriggerPositionWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeWaitingDelayWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeKickoffTimerWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; + +@end + +@interface MTRClusterClosureControl (Availability) + +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ +- (instancetype _Nullable)initWithDevice:(MTRDevice *)device + endpointID:(NSNumber *)endpointID + queue:(dispatch_queue_t)queue MTR_PROVISIONALLY_AVAILABLE; + +@end + /** * Cluster Service Area * The Service Area cluster provides an interface for controlling the areas where a device should operate, and for querying the current area being serviced. diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm index 7382e8a74d0f2e..5eafb7c45e42ab 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -11735,6 +11735,240 @@ - (void)goToTiltPercentageWithParams:(MTRWindowCoveringClusterGoToTiltPercentage } @end +@implementation MTRClusterClosureControl + +- (void)stopWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion +{ + [self stopWithParams:nil expectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs completion:completion]; +} +- (void)stopWithParams:(MTRClosureControlClusterStopParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRClosureControlClusterStopParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = ClosureControl::Commands::Stop::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} + +- (void)moveToWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion +{ + [self moveToWithParams:nil expectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs completion:completion]; +} +- (void)moveToWithParams:(MTRClosureControlClusterMoveToParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRClosureControlClusterMoveToParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = ClosureControl::Commands::MoveTo::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} + +- (void)calibrateWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion +{ + [self calibrateWithParams:nil expectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs completion:completion]; +} +- (void)calibrateWithParams:(MTRClosureControlClusterCalibrateParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRClosureControlClusterCalibrateParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = ClosureControl::Commands::Calibrate::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} + +- (void)configureFallbackWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion +{ + [self configureFallbackWithParams:nil expectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs completion:completion]; +} +- (void)configureFallbackWithParams:(MTRClosureControlClusterConfigureFallbackParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRClosureControlClusterConfigureFallbackParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = ClosureControl::Commands::ConfigureFallback::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} + +- (void)cancelFallbackWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion +{ + [self cancelFallbackWithParams:nil expectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs completion:completion]; +} +- (void)cancelFallbackWithParams:(MTRClosureControlClusterCancelFallbackParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRClosureControlClusterCancelFallbackParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = ClosureControl::Commands::CancelFallback::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + 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)readAttributeCountdownTimeWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeClosureControlID) attributeID:@(MTRAttributeIDTypeClusterClosureControlAttributeCountdownTimeID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeMainStateWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeClosureControlID) attributeID:@(MTRAttributeIDTypeClusterClosureControlAttributeMainStateID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeCurrentErrorListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeClosureControlID) attributeID:@(MTRAttributeIDTypeClusterClosureControlAttributeCurrentErrorListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeOverallStateWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeClosureControlID) attributeID:@(MTRAttributeIDTypeClusterClosureControlAttributeOverallStateID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeOverallTargetWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeClosureControlID) attributeID:@(MTRAttributeIDTypeClusterClosureControlAttributeOverallTargetID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeRestingProcedureWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeClosureControlID) attributeID:@(MTRAttributeIDTypeClusterClosureControlAttributeRestingProcedureID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeTriggerConditionWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeClosureControlID) attributeID:@(MTRAttributeIDTypeClusterClosureControlAttributeTriggerConditionID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeTriggerPositionWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeClosureControlID) attributeID:@(MTRAttributeIDTypeClusterClosureControlAttributeTriggerPositionID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeWaitingDelayWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeClosureControlID) attributeID:@(MTRAttributeIDTypeClusterClosureControlAttributeWaitingDelayID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeKickoffTimerWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeClosureControlID) attributeID:@(MTRAttributeIDTypeClusterClosureControlAttributeKickoffTimerID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeClosureControlID) attributeID:@(MTRAttributeIDTypeClusterClosureControlAttributeGeneratedCommandListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeClosureControlID) attributeID:@(MTRAttributeIDTypeClusterClosureControlAttributeAcceptedCommandListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeClosureControlID) attributeID:@(MTRAttributeIDTypeClusterClosureControlAttributeAttributeListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeClosureControlID) attributeID:@(MTRAttributeIDTypeClusterClosureControlAttributeFeatureMapID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeClosureControlID) attributeID:@(MTRAttributeIDTypeClusterClosureControlAttributeClusterRevisionID) params:params]; +} + +@end + @implementation MTRClusterServiceArea - (void)selectAreasWithParams:(MTRServiceAreaClusterSelectAreasParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTRServiceAreaClusterSelectAreasResponseParams * _Nullable data, NSError * _Nullable error))completion diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h index fd5bb619f514ce..d4c1559afeefd3 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h @@ -7516,6 +7516,160 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTRClosureControlClusterStopParams : NSObject +/** + * Controls whether the command is a timed command (using Timed Invoke). + * + * If nil (the default value), a regular invoke is done for commands that do + * not require a timed invoke and a timed invoke with some default timed request + * timeout is done for commands that require a timed invoke. + * + * If not nil, a timed invoke is done, with the provided value used as the timed + * request timeout. The value should be chosen small enough to provide the + * desired security properties but large enough that it will allow a round-trip + * from the sever to the client (for the status response and actual invoke + * request) within the timeout window. + * + */ +@property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; + +/** + * Controls how much time, in seconds, we will allow for the server to process the command. + * + * The command will then time out if that much time, plus an allowance for retransmits due to network failures, passes. + * + * If nil, the framework will try to select an appropriate timeout value itself. + */ +@property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRClosureControlClusterMoveToParams : NSObject + +@property (nonatomic, copy) NSNumber * _Nullable tag MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSNumber * _Nullable latch MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSNumber * _Nullable speed 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 MTRClosureControlClusterCalibrateParams : NSObject +/** + * Controls whether the command is a timed command (using Timed Invoke). + * + * If nil (the default value), a regular invoke is done for commands that do + * not require a timed invoke and a timed invoke with some default timed request + * timeout is done for commands that require a timed invoke. + * + * If not nil, a timed invoke is done, with the provided value used as the timed + * request timeout. The value should be chosen small enough to provide the + * desired security properties but large enough that it will allow a round-trip + * from the sever to the client (for the status response and actual invoke + * request) within the timeout window. + * + */ +@property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; + +/** + * Controls how much time, in seconds, we will allow for the server to process the command. + * + * The command will then time out if that much time, plus an allowance for retransmits due to network failures, passes. + * + * If nil, the framework will try to select an appropriate timeout value itself. + */ +@property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRClosureControlClusterConfigureFallbackParams : NSObject + +@property (nonatomic, copy) NSNumber * _Nullable restingProcedure MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSNumber * _Nullable triggerCondition MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSNumber * _Nullable triggerPosition MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSNumber * _Nullable waitingDelay 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 MTRClosureControlClusterCancelFallbackParams : NSObject +/** + * Controls whether the command is a timed command (using Timed Invoke). + * + * If nil (the default value), a regular invoke is done for commands that do + * not require a timed invoke and a timed invoke with some default timed request + * timeout is done for commands that require a timed invoke. + * + * If not nil, a timed invoke is done, with the provided value used as the timed + * request timeout. The value should be chosen small enough to provide the + * desired security properties but large enough that it will allow a round-trip + * from the sever to the client (for the status response and actual invoke + * request) within the timeout window. + * + */ +@property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; + +/** + * Controls how much time, in seconds, we will allow for the server to process the command. + * + * The command will then time out if that much time, plus an allowance for retransmits due to network failures, passes. + * + * If nil, the framework will try to select an appropriate timeout value itself. + */ +@property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; +@end + MTR_AVAILABLE(ios(18.4), macos(15.4), watchos(11.4), tvos(18.4)) @interface MTRServiceAreaClusterSelectAreasParams : NSObject diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index 1923b91f868c66..6b7e9e6ac8f299 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -21497,6 +21497,434 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader } @end +@implementation MTRClosureControlClusterStopParams +- (instancetype)init +{ + if (self = [super init]) { + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRClosureControlClusterStopParams alloc] init]; + + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: >", NSStringFromClass([self class])]; + return descriptionString; +} + +@end + +@implementation MTRClosureControlClusterStopParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ClosureControl::Commands::Stop::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + +@implementation MTRClosureControlClusterMoveToParams +- (instancetype)init +{ + if (self = [super init]) { + + _tag = nil; + + _latch = nil; + + _speed = nil; + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRClosureControlClusterMoveToParams alloc] init]; + + other.tag = self.tag; + other.latch = self.latch; + other.speed = self.speed; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: tag:%@; latch:%@; speed:%@; >", NSStringFromClass([self class]), _tag, _latch, _speed]; + return descriptionString; +} + +@end + +@implementation MTRClosureControlClusterMoveToParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ClosureControl::Commands::MoveTo::Type encodableStruct; + ListFreer listFreer; + { + if (self.tag != nil) { + auto & definedValue_0 = encodableStruct.tag.Emplace(); + definedValue_0 = static_cast>(self.tag.unsignedCharValue); + } + } + { + if (self.latch != nil) { + auto & definedValue_0 = encodableStruct.latch.Emplace(); + definedValue_0 = static_cast>(self.latch.unsignedCharValue); + } + } + { + if (self.speed != nil) { + auto & definedValue_0 = encodableStruct.speed.Emplace(); + definedValue_0 = static_cast>(self.speed.unsignedCharValue); + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + +@implementation MTRClosureControlClusterCalibrateParams +- (instancetype)init +{ + if (self = [super init]) { + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRClosureControlClusterCalibrateParams alloc] init]; + + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: >", NSStringFromClass([self class])]; + return descriptionString; +} + +@end + +@implementation MTRClosureControlClusterCalibrateParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ClosureControl::Commands::Calibrate::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + +@implementation MTRClosureControlClusterConfigureFallbackParams +- (instancetype)init +{ + if (self = [super init]) { + + _restingProcedure = nil; + + _triggerCondition = nil; + + _triggerPosition = nil; + + _waitingDelay = nil; + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRClosureControlClusterConfigureFallbackParams alloc] init]; + + other.restingProcedure = self.restingProcedure; + other.triggerCondition = self.triggerCondition; + other.triggerPosition = self.triggerPosition; + other.waitingDelay = self.waitingDelay; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: restingProcedure:%@; triggerCondition:%@; triggerPosition:%@; waitingDelay:%@; >", NSStringFromClass([self class]), _restingProcedure, _triggerCondition, _triggerPosition, _waitingDelay]; + return descriptionString; +} + +@end + +@implementation MTRClosureControlClusterConfigureFallbackParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ClosureControl::Commands::ConfigureFallback::Type encodableStruct; + ListFreer listFreer; + { + if (self.restingProcedure != nil) { + auto & definedValue_0 = encodableStruct.restingProcedure.Emplace(); + definedValue_0 = static_cast>(self.restingProcedure.unsignedCharValue); + } + } + { + if (self.triggerCondition != nil) { + auto & definedValue_0 = encodableStruct.triggerCondition.Emplace(); + definedValue_0 = static_cast>(self.triggerCondition.unsignedCharValue); + } + } + { + if (self.triggerPosition != nil) { + auto & definedValue_0 = encodableStruct.triggerPosition.Emplace(); + definedValue_0 = static_cast>(self.triggerPosition.unsignedCharValue); + } + } + { + if (self.waitingDelay != nil) { + auto & definedValue_0 = encodableStruct.waitingDelay.Emplace(); + definedValue_0 = self.waitingDelay.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 MTRClosureControlClusterCancelFallbackParams +- (instancetype)init +{ + if (self = [super init]) { + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRClosureControlClusterCancelFallbackParams alloc] init]; + + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: >", NSStringFromClass([self class])]; + return descriptionString; +} + +@end + +@implementation MTRClosureControlClusterCancelFallbackParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ClosureControl::Commands::CancelFallback::Type encodableStruct; + ListFreer listFreer; + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRServiceAreaClusterSelectAreasParams - (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 741ff9f8e96977..2fa1bbe3106747 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h @@ -1408,6 +1408,36 @@ NS_ASSUME_NONNULL_BEGIN @end +@interface MTRClosureControlClusterStopParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRClosureControlClusterMoveToParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRClosureControlClusterCalibrateParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRClosureControlClusterConfigureFallbackParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRClosureControlClusterCancelFallbackParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + @interface MTRServiceAreaClusterSelectAreasParams (InternalMethods) - (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm index a28090af6ad09a..10893571aef07a 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm @@ -749,6 +749,15 @@ static BOOL CommandNeedsTimedInvokeInWindowCoveringCluster(AttributeId aAttribut } } } +static BOOL CommandNeedsTimedInvokeInClosureControlCluster(AttributeId aAttributeId) +{ + using namespace Clusters::ClosureControl; + switch (aAttributeId) { + default: { + return NO; + } + } +} static BOOL CommandNeedsTimedInvokeInServiceAreaCluster(AttributeId aAttributeId) { using namespace Clusters::ServiceArea; @@ -1464,6 +1473,9 @@ BOOL MTRCommandNeedsTimedInvoke(NSNumber * _Nonnull aClusterID, NSNumber * _Nonn case Clusters::WindowCovering::Id: { return CommandNeedsTimedInvokeInWindowCoveringCluster(commandID); } + case Clusters::ClosureControl::Id: { + return CommandNeedsTimedInvokeInClosureControlCluster(commandID); + } case Clusters::ServiceArea::Id: { return CommandNeedsTimedInvokeInServiceAreaCluster(commandID); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm index e0c05e29ef82a4..539e850e5aaec3 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm @@ -3711,6 +3711,18 @@ static id _Nullable DecodeEventPayloadForWindowCoveringCluster(EventId aEventId, *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; return nil; } +static id _Nullable DecodeEventPayloadForClosureControlCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::ClosureControl; + switch (aEventId) { + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} static id _Nullable DecodeEventPayloadForServiceAreaCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) { using namespace Clusters::ServiceArea; @@ -5502,6 +5514,9 @@ id _Nullable MTRDecodeEventPayload(const ConcreteEventPath & aPath, TLV::TLVRead case Clusters::WindowCovering::Id: { return DecodeEventPayloadForWindowCoveringCluster(aPath.mEventId, aReader, aError); } + case Clusters::ClosureControl::Id: { + return DecodeEventPayloadForClosureControlCluster(aPath.mEventId, aReader, aError); + } case Clusters::ServiceArea::Id: { return DecodeEventPayloadForServiceAreaCluster(aPath.mEventId, aReader, aError); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index 278527fb387b76..7d5dbf37d19742 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -1607,6 +1607,21 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @property (nonatomic, copy) NSNumber * _Nullable dataIndex MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTRClosureControlClusterOverallStateStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nullable positioning MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable latching MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable speed MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable extraInfo MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRClosureControlClusterOverallTargetStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nullable tagPosition MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable tagLatch MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable speed MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_AVAILABLE(ios(18.4), macos(15.4), watchos(11.4), tvos(18.4)) @interface MTRServiceAreaClusterLandmarkInfoStruct : NSObject @property (nonatomic, copy) NSNumber * _Nonnull landmarkTag MTR_AVAILABLE(ios(18.4), macos(15.4), watchos(11.4), tvos(18.4)); diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index 166c1569ccbc80..24b5adc876c8f5 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -6705,6 +6705,75 @@ - (NSString *)description @end +@implementation MTRClosureControlClusterOverallStateStruct +- (instancetype)init +{ + if (self = [super init]) { + + _positioning = nil; + + _latching = nil; + + _speed = nil; + + _extraInfo = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRClosureControlClusterOverallStateStruct alloc] init]; + + other.positioning = self.positioning; + other.latching = self.latching; + other.speed = self.speed; + other.extraInfo = self.extraInfo; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: positioning:%@; latching:%@; speed:%@; extraInfo:%@; >", NSStringFromClass([self class]), _positioning, _latching, _speed, _extraInfo]; + return descriptionString; +} + +@end + +@implementation MTRClosureControlClusterOverallTargetStruct +- (instancetype)init +{ + if (self = [super init]) { + + _tagPosition = nil; + + _tagLatch = nil; + + _speed = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRClosureControlClusterOverallTargetStruct alloc] init]; + + other.tagPosition = self.tagPosition; + other.tagLatch = self.tagLatch; + other.speed = self.speed; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: tagPosition:%@; tagLatch:%@; speed:%@; >", NSStringFromClass([self class]), _tagPosition, _tagLatch, _speed]; + return descriptionString; +} + +@end + @implementation MTRServiceAreaClusterLandmarkInfoStruct - (instancetype)init { diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp index f8d7ab3cbb1017..304462dc126bff 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 @@ -19552,6 +19552,435 @@ Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value) } // namespace Attributes } // namespace WindowCovering +namespace ClosureControl { +namespace Attributes { + +namespace CountdownTime { + +Protocols::InteractionModel::Status Get(EndpointId endpoint, DataModel::Nullable & value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::ClosureControl::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (Traits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = Traits::StorageToWorking(temp); + } + return status; +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::ClosureControl::Id, Id), + EmberAfWriteDataInput(writable, ZCL_ELAPSED_S_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::ClosureControl::Id, Id, writable, ZCL_ELAPSED_S_ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status SetNull(EndpointId endpoint, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::ClosureControl::Id, Id), + EmberAfWriteDataInput(writable, ZCL_ELAPSED_S_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); +} + +Protocols::InteractionModel::Status SetNull(EndpointId endpoint) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::ClosureControl::Id, Id, writable, ZCL_ELAPSED_S_ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty) +{ + if (value.IsNull()) + { + return SetNull(endpoint, markDirty); + } + + return Set(endpoint, value.Value(), markDirty); +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, const chip::app::DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace CountdownTime + +namespace MainState { + +Protocols::InteractionModel::Status Get(EndpointId endpoint, chip::app::Clusters::ClosureControl::MainStateEnum * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::ClosureControl::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + *value = Traits::StorageToWorking(temp); + return status; +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::app::Clusters::ClosureControl::MainStateEnum value, + MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::ClosureControl::Id, Id), + EmberAfWriteDataInput(writable, ZCL_ENUM8_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::app::Clusters::ClosureControl::MainStateEnum value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::ClosureControl::Id, Id, writable, ZCL_ENUM8_ATTRIBUTE_TYPE); +} + +} // namespace MainState + +namespace RestingProcedure { + +Protocols::InteractionModel::Status Get(EndpointId endpoint, chip::app::Clusters::ClosureControl::RestingProcedureEnum * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::ClosureControl::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + *value = Traits::StorageToWorking(temp); + return status; +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::app::Clusters::ClosureControl::RestingProcedureEnum value, + MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::ClosureControl::Id, Id), + EmberAfWriteDataInput(writable, ZCL_ENUM8_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::app::Clusters::ClosureControl::RestingProcedureEnum value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::ClosureControl::Id, Id, writable, ZCL_ENUM8_ATTRIBUTE_TYPE); +} + +} // namespace RestingProcedure + +namespace TriggerCondition { + +Protocols::InteractionModel::Status Get(EndpointId endpoint, chip::app::Clusters::ClosureControl::TriggerConditionEnum * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::ClosureControl::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + *value = Traits::StorageToWorking(temp); + return status; +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::app::Clusters::ClosureControl::TriggerConditionEnum value, + MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::ClosureControl::Id, Id), + EmberAfWriteDataInput(writable, ZCL_ENUM8_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::app::Clusters::ClosureControl::TriggerConditionEnum value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::ClosureControl::Id, Id, writable, ZCL_ENUM8_ATTRIBUTE_TYPE); +} + +} // namespace TriggerCondition + +namespace TriggerPosition { + +Protocols::InteractionModel::Status Get(EndpointId endpoint, chip::app::Clusters::ClosureControl::TriggerPositionEnum * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::ClosureControl::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + *value = Traits::StorageToWorking(temp); + return status; +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::app::Clusters::ClosureControl::TriggerPositionEnum value, + MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::ClosureControl::Id, Id), + EmberAfWriteDataInput(writable, ZCL_ENUM8_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::app::Clusters::ClosureControl::TriggerPositionEnum value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::ClosureControl::Id, Id, writable, ZCL_ENUM8_ATTRIBUTE_TYPE); +} + +} // namespace TriggerPosition + +namespace WaitingDelay { + +Protocols::InteractionModel::Status Get(EndpointId endpoint, uint32_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::ClosureControl::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + *value = Traits::StorageToWorking(temp); + return status; +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::ClosureControl::Id, Id), + EmberAfWriteDataInput(writable, ZCL_ELAPSED_S_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::ClosureControl::Id, Id, writable, ZCL_ELAPSED_S_ATTRIBUTE_TYPE); +} + +} // namespace WaitingDelay + +namespace KickoffTimer { + +Protocols::InteractionModel::Status Get(EndpointId endpoint, uint32_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::ClosureControl::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + *value = Traits::StorageToWorking(temp); + return status; +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::ClosureControl::Id, Id), + EmberAfWriteDataInput(writable, ZCL_ELAPSED_S_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::ClosureControl::Id, Id, writable, ZCL_ELAPSED_S_ATTRIBUTE_TYPE); +} + +} // namespace KickoffTimer + +namespace ClusterRevision { + +Protocols::InteractionModel::Status Get(EndpointId endpoint, uint16_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::ClosureControl::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + *value = Traits::StorageToWorking(temp); + return status; +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::ClosureControl::Id, Id), + EmberAfWriteDataInput(writable, ZCL_INT16U_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::ClosureControl::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); +} + +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace ClosureControl + namespace ServiceArea { namespace Attributes { diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h index cd7ad25b3ddcab..8a403aad4078af 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 @@ -3081,6 +3081,73 @@ Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value, Mar } // namespace Attributes } // namespace WindowCovering +namespace ClosureControl { +namespace Attributes { + +namespace CountdownTime { +Protocols::InteractionModel::Status Get(EndpointId endpoint, DataModel::Nullable & value); // elapsed_s +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value); +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status SetNull(EndpointId endpoint); +Protocols::InteractionModel::Status SetNull(EndpointId endpoint, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status Set(EndpointId endpoint, const chip::app::DataModel::Nullable & value); +Protocols::InteractionModel::Status Set(EndpointId endpoint, const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty); +} // namespace CountdownTime + +namespace MainState { +Protocols::InteractionModel::Status Get(EndpointId endpoint, + chip::app::Clusters::ClosureControl::MainStateEnum * value); // MainStateEnum +Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::app::Clusters::ClosureControl::MainStateEnum value); +Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::app::Clusters::ClosureControl::MainStateEnum value, + MarkAttributeDirty markDirty); +} // namespace MainState + +namespace RestingProcedure { +Protocols::InteractionModel::Status Get(EndpointId endpoint, + chip::app::Clusters::ClosureControl::RestingProcedureEnum * value); // RestingProcedureEnum +Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::app::Clusters::ClosureControl::RestingProcedureEnum value); +Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::app::Clusters::ClosureControl::RestingProcedureEnum value, + MarkAttributeDirty markDirty); +} // namespace RestingProcedure + +namespace TriggerCondition { +Protocols::InteractionModel::Status Get(EndpointId endpoint, + chip::app::Clusters::ClosureControl::TriggerConditionEnum * value); // TriggerConditionEnum +Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::app::Clusters::ClosureControl::TriggerConditionEnum value); +Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::app::Clusters::ClosureControl::TriggerConditionEnum value, + MarkAttributeDirty markDirty); +} // namespace TriggerCondition + +namespace TriggerPosition { +Protocols::InteractionModel::Status Get(EndpointId endpoint, + chip::app::Clusters::ClosureControl::TriggerPositionEnum * value); // TriggerPositionEnum +Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::app::Clusters::ClosureControl::TriggerPositionEnum value); +Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::app::Clusters::ClosureControl::TriggerPositionEnum value, + MarkAttributeDirty markDirty); +} // namespace TriggerPosition + +namespace WaitingDelay { +Protocols::InteractionModel::Status Get(EndpointId endpoint, uint32_t * value); // elapsed_s +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value); +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty); +} // namespace WaitingDelay + +namespace KickoffTimer { +Protocols::InteractionModel::Status Get(EndpointId endpoint, uint32_t * value); // elapsed_s +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value); +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty); +} // namespace KickoffTimer + +namespace ClusterRevision { +Protocols::InteractionModel::Status Get(EndpointId endpoint, uint16_t * value); // int16u +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value); +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty); +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace ClosureControl + namespace ServiceArea { namespace Attributes { diff --git a/zzz_generated/app-common/app-common/zap-generated/callback.h b/zzz_generated/app-common/app-common/zap-generated/callback.h index 8987cb4aec9c08..0195a63f42581f 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callback.h +++ b/zzz_generated/app-common/app-common/zap-generated/callback.h @@ -418,6 +418,11 @@ void emberAfDoorLockClusterInitCallback(chip::EndpointId endpoint); */ void emberAfWindowCoveringClusterInitCallback(chip::EndpointId endpoint); +/** + * @param endpoint Endpoint that is being initialized + */ +void emberAfClosureControlClusterInitCallback(chip::EndpointId endpoint); + /** * @param endpoint Endpoint that is being initialized */ @@ -3657,6 +3662,45 @@ MatterWindowCoveringClusterServerPreAttributeChangedCallback(const chip::app::Co */ void emberAfWindowCoveringClusterServerTickCallback(chip::EndpointId endpoint); +// +// Closure Control Cluster +// + +/** + * @param endpoint Endpoint that is being initialized + */ +void emberAfClosureControlClusterServerInitCallback(chip::EndpointId endpoint); + +/** + * @param endpoint Endpoint that is being shutdown + */ +void MatterClosureControlClusterServerShutdownCallback(chip::EndpointId endpoint); + +/** + * @param endpoint Endpoint that is being initialized + */ +void emberAfClosureControlClusterClientInitCallback(chip::EndpointId endpoint); + +/** + * @param attributePath Concrete attribute path that changed + */ +void MatterClosureControlClusterServerAttributeChangedCallback(const chip::app::ConcreteAttributePath & attributePath); + +/** + * @param attributePath Concrete attribute path to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +chip::Protocols::InteractionModel::Status +MatterClosureControlClusterServerPreAttributeChangedCallback(const chip::app::ConcreteAttributePath & attributePath, + EmberAfAttributeType attributeType, uint16_t size, uint8_t * value); + +/** + * @param endpoint Endpoint that is being served + */ +void emberAfClosureControlClusterServerTickCallback(chip::EndpointId endpoint); + // // Service Area Cluster // @@ -6383,6 +6427,36 @@ bool emberAfWindowCoveringClusterGoToTiltValueCallback( bool emberAfWindowCoveringClusterGoToTiltPercentageCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::DecodableType & commandData); +/** + * @brief Closure Control Cluster Stop Command callback (from client) + */ +bool emberAfClosureControlClusterStopCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::ClosureControl::Commands::Stop::DecodableType & commandData); +/** + * @brief Closure Control Cluster MoveTo Command callback (from client) + */ +bool emberAfClosureControlClusterMoveToCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::ClosureControl::Commands::MoveTo::DecodableType & commandData); +/** + * @brief Closure Control Cluster Calibrate Command callback (from client) + */ +bool emberAfClosureControlClusterCalibrateCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::ClosureControl::Commands::Calibrate::DecodableType & commandData); +/** + * @brief Closure Control Cluster ConfigureFallback Command callback (from client) + */ +bool emberAfClosureControlClusterConfigureFallbackCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::ClosureControl::Commands::ConfigureFallback::DecodableType & commandData); +/** + * @brief Closure Control Cluster CancelFallback Command callback (from client) + */ +bool emberAfClosureControlClusterCancelFallbackCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::ClosureControl::Commands::CancelFallback::DecodableType & commandData); /** * @brief Thermostat Cluster SetpointRaiseLower 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 660de32afae160..0722186a741998 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 @@ -2679,6 +2679,139 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(WindowCovering::Type va } } +static auto __attribute__((unused)) EnsureKnownEnumValue(ClosureControl::ClosureErrorEnum val) +{ + using EnumType = ClosureControl::ClosureErrorEnum; + switch (val) + { + case EnumType::kBlocked: + case EnumType::kTemperatureLimited: + case EnumType::kMaintenanceRequired: + case EnumType::kInternalInterference: + return val; + default: + return EnumType::kUnknownEnumValue; + } +} +static auto __attribute__((unused)) EnsureKnownEnumValue(ClosureControl::LatchingEnum val) +{ + using EnumType = ClosureControl::LatchingEnum; + switch (val) + { + case EnumType::kLatchedAndSecured: + case EnumType::kLatchedButNotSecured: + case EnumType::kNotLatched: + return val; + default: + return EnumType::kUnknownEnumValue; + } +} +static auto __attribute__((unused)) EnsureKnownEnumValue(ClosureControl::MainStateEnum val) +{ + using EnumType = ClosureControl::MainStateEnum; + switch (val) + { + case EnumType::kStopped: + case EnumType::kMoving: + case EnumType::kWaitingForMotion: + case EnumType::kError: + case EnumType::kCalibrating: + case EnumType::kProtected: + case EnumType::kDisengaged: + case EnumType::kSetupRequired: + case EnumType::kPendingFallback: + return val; + default: + return EnumType::kUnknownEnumValue; + } +} +static auto __attribute__((unused)) EnsureKnownEnumValue(ClosureControl::PositioningEnum val) +{ + using EnumType = ClosureControl::PositioningEnum; + switch (val) + { + case EnumType::kFullyClosed: + case EnumType::kFullyOpened: + case EnumType::kPartiallyOpened: + case EnumType::kOpenedForPedestrian: + case EnumType::kOpenedForVentilation: + case EnumType::kOpenedAtSignature: + return val; + default: + return EnumType::kUnknownEnumValue; + } +} +static auto __attribute__((unused)) EnsureKnownEnumValue(ClosureControl::RestingProcedureEnum val) +{ + using EnumType = ClosureControl::RestingProcedureEnum; + switch (val) + { + case EnumType::kDoNothing: + case EnumType::kReturnToFullyOpened: + case EnumType::kReturnToFullyClosed: + return val; + default: + return EnumType::kUnknownEnumValue; + } +} +static auto __attribute__((unused)) EnsureKnownEnumValue(ClosureControl::TagLatchEnum val) +{ + using EnumType = ClosureControl::TagLatchEnum; + switch (val) + { + case EnumType::kLatch: + case EnumType::kUnlatch: + return val; + default: + return EnumType::kUnknownEnumValue; + } +} +static auto __attribute__((unused)) EnsureKnownEnumValue(ClosureControl::TagPositionEnum val) +{ + using EnumType = ClosureControl::TagPositionEnum; + switch (val) + { + case EnumType::kCloseInFull: + case EnumType::kOpenInFull: + case EnumType::kPedestrian: + case EnumType::kVentilation: + case EnumType::kSignature: + case EnumType::kSequenceNextStep: + case EnumType::kPedestrianNextStep: + return val; + default: + return EnumType::kUnknownEnumValue; + } +} +static auto __attribute__((unused)) EnsureKnownEnumValue(ClosureControl::TriggerConditionEnum val) +{ + using EnumType = ClosureControl::TriggerConditionEnum; + switch (val) + { + case EnumType::kAfterDelay: + case EnumType::kAfterApplicativeTrigger: + case EnumType::kAfterDelayOrApplicativeTrigger: + return val; + default: + return EnumType::kUnknownEnumValue; + } +} +static auto __attribute__((unused)) EnsureKnownEnumValue(ClosureControl::TriggerPositionEnum val) +{ + using EnumType = ClosureControl::TriggerPositionEnum; + switch (val) + { + case EnumType::kAtFullyClosed: + case EnumType::kAtFullyOpened: + case EnumType::kInBetween: + case EnumType::kAtVentilation: + case EnumType::kAtPedestrian: + return val; + default: + return EnumType::kUnknownEnumValue; + } +} + static auto __attribute__((unused)) EnsureKnownEnumValue(ServiceArea::OperationalStatusEnum val) { using EnumType = ServiceArea::OperationalStatusEnum; 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 b839bccb685c52..b94e402979fa0d 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 @@ -3967,6 +3967,156 @@ enum class SafetyStatus : uint16_t }; } // namespace WindowCovering +namespace ClosureControl { + +// Enum for ClosureErrorEnum +enum class ClosureErrorEnum : uint8_t +{ + kBlocked = 0x00, + kTemperatureLimited = 0x01, + kMaintenanceRequired = 0x02, + kInternalInterference = 0x03, + // All received enum values that are not listed above will be mapped + // to kUnknownEnumValue. This is a helper enum value that should only + // be used by code to process how it handles receiving and unknown + // enum value. This specific should never be transmitted. + kUnknownEnumValue = 4, +}; + +// Enum for LatchingEnum +enum class LatchingEnum : uint8_t +{ + kLatchedAndSecured = 0x00, + kLatchedButNotSecured = 0x01, + kNotLatched = 0x02, + // All received enum values that are not listed above will be mapped + // to kUnknownEnumValue. This is a helper enum value that should only + // be used by code to process how it handles receiving and unknown + // enum value. This specific should never be transmitted. + kUnknownEnumValue = 3, +}; + +// Enum for MainStateEnum +enum class MainStateEnum : uint8_t +{ + kStopped = 0x00, + kMoving = 0x01, + kWaitingForMotion = 0x02, + kError = 0x03, + kCalibrating = 0x04, + kProtected = 0x05, + kDisengaged = 0x06, + kSetupRequired = 0x07, + kPendingFallback = 0x08, + // 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 = 9, +}; + +// Enum for PositioningEnum +enum class PositioningEnum : uint8_t +{ + kFullyClosed = 0x00, + kFullyOpened = 0x01, + kPartiallyOpened = 0x02, + kOpenedForPedestrian = 0x03, + kOpenedForVentilation = 0x04, + kOpenedAtSignature = 0x05, + // 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 = 6, +}; + +// Enum for RestingProcedureEnum +enum class RestingProcedureEnum : uint8_t +{ + kDoNothing = 0x00, + kReturnToFullyOpened = 0x01, + kReturnToFullyClosed = 0x02, + // All received enum values that are not listed above will be mapped + // to kUnknownEnumValue. This is a helper enum value that should only + // be used by code to process how it handles receiving and unknown + // enum value. This specific should never be transmitted. + kUnknownEnumValue = 3, +}; + +// Enum for TagLatchEnum +enum class TagLatchEnum : uint8_t +{ + kLatch = 0x00, + kUnlatch = 0x01, + // All received enum values that are not listed above will be mapped + // to kUnknownEnumValue. This is a helper enum value that should only + // be used by code to process how it handles receiving and unknown + // enum value. This specific should never be transmitted. + kUnknownEnumValue = 2, +}; + +// Enum for TagPositionEnum +enum class TagPositionEnum : uint8_t +{ + kCloseInFull = 0x00, + kOpenInFull = 0x01, + kPedestrian = 0x02, + kVentilation = 0x03, + kSignature = 0x04, + kSequenceNextStep = 0x05, + kPedestrianNextStep = 0x06, + // 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 = 7, +}; + +// Enum for TriggerConditionEnum +enum class TriggerConditionEnum : uint8_t +{ + kAfterDelay = 0x00, + kAfterApplicativeTrigger = 0x01, + kAfterDelayOrApplicativeTrigger = 0x02, + // All received enum values that are not listed above will be mapped + // to kUnknownEnumValue. This is a helper enum value that should only + // be used by code to process how it handles receiving and unknown + // enum value. This specific should never be transmitted. + kUnknownEnumValue = 3, +}; + +// Enum for TriggerPositionEnum +enum class TriggerPositionEnum : uint8_t +{ + kAtFullyClosed = 0x00, + kAtFullyOpened = 0x01, + kInBetween = 0x02, + kAtVentilation = 0x03, + kAtPedestrian = 0x04, + // 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 = 5, +}; + +// Bitmap for Feature +enum class Feature : uint32_t +{ + kPositioning = 0x1, + kMotionLatching = 0x2, + kInstantaneous = 0x4, + kSpeed = 0x8, + kVentilation = 0x10, + kPedestrian = 0x20, + kCalibration = 0x40, + kProtection = 0x80, + kManuallyOperable = 0x100, + kFallback = 0x200, +}; +} // namespace ClosureControl + namespace ServiceArea { // Enum for OperationalStatusEnum 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 e26e842ed4f00a..0a5464f6f751cc 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 @@ -20241,6 +20241,307 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre namespace Events {} // namespace Events } // namespace WindowCovering +namespace ClosureControl { +namespace Structs { + +namespace OverallStateStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kPositioning), positioning); + encoder.Encode(to_underlying(Fields::kLatching), latching); + encoder.Encode(to_underlying(Fields::kSpeed), speed); + encoder.Encode(to_underlying(Fields::kExtraInfo), extraInfo); + 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::kPositioning)) + { + err = DataModel::Decode(reader, positioning); + } + else if (__context_tag == to_underlying(Fields::kLatching)) + { + err = DataModel::Decode(reader, latching); + } + else if (__context_tag == to_underlying(Fields::kSpeed)) + { + err = DataModel::Decode(reader, speed); + } + else if (__context_tag == to_underlying(Fields::kExtraInfo)) + { + err = DataModel::Decode(reader, extraInfo); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace OverallStateStruct + +namespace OverallTargetStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kTagPosition), tagPosition); + encoder.Encode(to_underlying(Fields::kTagLatch), tagLatch); + encoder.Encode(to_underlying(Fields::kSpeed), speed); + 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::kTagPosition)) + { + err = DataModel::Decode(reader, tagPosition); + } + else if (__context_tag == to_underlying(Fields::kTagLatch)) + { + err = DataModel::Decode(reader, tagLatch); + } + else if (__context_tag == to_underlying(Fields::kSpeed)) + { + err = DataModel::Decode(reader, speed); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace OverallTargetStruct +} // namespace Structs + +namespace Commands { +namespace Stop { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + } +} +} // namespace Stop. +namespace MoveTo { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kTag), tag); + encoder.Encode(to_underlying(Fields::kLatch), latch); + encoder.Encode(to_underlying(Fields::kSpeed), speed); + 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::kTag)) + { + err = DataModel::Decode(reader, tag); + } + else if (__context_tag == to_underlying(Fields::kLatch)) + { + err = DataModel::Decode(reader, latch); + } + else if (__context_tag == to_underlying(Fields::kSpeed)) + { + err = DataModel::Decode(reader, speed); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace MoveTo. +namespace Calibrate { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + } +} +} // namespace Calibrate. +namespace ConfigureFallback { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kRestingProcedure), restingProcedure); + encoder.Encode(to_underlying(Fields::kTriggerCondition), triggerCondition); + encoder.Encode(to_underlying(Fields::kTriggerPosition), triggerPosition); + encoder.Encode(to_underlying(Fields::kWaitingDelay), waitingDelay); + 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::kRestingProcedure)) + { + err = DataModel::Decode(reader, restingProcedure); + } + else if (__context_tag == to_underlying(Fields::kTriggerCondition)) + { + err = DataModel::Decode(reader, triggerCondition); + } + else if (__context_tag == to_underlying(Fields::kTriggerPosition)) + { + err = DataModel::Decode(reader, triggerPosition); + } + else if (__context_tag == to_underlying(Fields::kWaitingDelay)) + { + err = DataModel::Decode(reader, waitingDelay); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace ConfigureFallback. +namespace CancelFallback { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + } +} +} // namespace CancelFallback. +} // namespace Commands + +namespace Attributes { +CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path) +{ + switch (path.mAttributeId) + { + case Attributes::CountdownTime::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, countdownTime); + case Attributes::MainState::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, mainState); + case Attributes::CurrentErrorList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, currentErrorList); + case Attributes::OverallState::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, overallState); + case Attributes::OverallTarget::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, overallTarget); + case Attributes::RestingProcedure::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, restingProcedure); + case Attributes::TriggerCondition::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, triggerCondition); + case Attributes::TriggerPosition::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, triggerPosition); + case Attributes::WaitingDelay::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, waitingDelay); + case Attributes::KickoffTimer::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, kickoffTimer); + case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, generatedCommandList); + case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, acceptedCommandList); + case Attributes::AttributeList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, attributeList); + case Attributes::FeatureMap::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, featureMap); + case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, clusterRevision); + default: + return CHIP_NO_ERROR; + } +} +} // namespace Attributes + +namespace Events {} // namespace Events + +} // namespace ClosureControl namespace ServiceArea { namespace Structs { @@ -36699,6 +37000,13 @@ bool CommandIsFabricScoped(ClusterId aCluster, CommandId aCommand) return false; } } + case Clusters::ClosureControl::Id: { + switch (aCommand) + { + default: + return false; + } + } case Clusters::ServiceArea::Id: { switch (aCommand) { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h index 266b897a04a534..e7fe47d90da7f7 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 @@ -27343,6 +27343,446 @@ struct TypeInfo }; } // namespace Attributes } // namespace WindowCovering +namespace ClosureControl { +namespace Structs { +namespace OverallStateStruct { +enum class Fields : uint8_t +{ + kPositioning = 0, + kLatching = 1, + kSpeed = 2, + kExtraInfo = 3, +}; + +struct Type +{ +public: + Optional positioning; + Optional latching; + Optional speed; + Optional extraInfo; + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace OverallStateStruct +namespace OverallTargetStruct { +enum class Fields : uint8_t +{ + kTagPosition = 0, + kTagLatch = 1, + kSpeed = 2, +}; + +struct Type +{ +public: + Optional tagPosition; + Optional tagLatch; + Optional speed; + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace OverallTargetStruct +} // namespace Structs + +namespace Commands { +// Forward-declarations so we can reference these later. + +namespace Stop { +struct Type; +struct DecodableType; +} // namespace Stop + +namespace MoveTo { +struct Type; +struct DecodableType; +} // namespace MoveTo + +namespace Calibrate { +struct Type; +struct DecodableType; +} // namespace Calibrate + +namespace ConfigureFallback { +struct Type; +struct DecodableType; +} // namespace ConfigureFallback + +namespace CancelFallback { +struct Type; +struct DecodableType; +} // namespace CancelFallback + +} // namespace Commands + +namespace Commands { +namespace Stop { +enum class Fields : uint8_t +{ +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::Stop::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ClosureControl::Id; } + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; + + using ResponseType = DataModel::NullObjectType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::Stop::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ClosureControl::Id; } + + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace Stop +namespace MoveTo { +enum class Fields : uint8_t +{ + kTag = 0, + kLatch = 1, + kSpeed = 2, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::MoveTo::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ClosureControl::Id; } + + Optional tag; + Optional latch; + Optional speed; + + 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::MoveTo::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ClosureControl::Id; } + + Optional tag; + Optional latch; + Optional speed; + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace MoveTo +namespace Calibrate { +enum class Fields : uint8_t +{ +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::Calibrate::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ClosureControl::Id; } + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; + + using ResponseType = DataModel::NullObjectType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::Calibrate::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ClosureControl::Id; } + + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace Calibrate +namespace ConfigureFallback { +enum class Fields : uint8_t +{ + kRestingProcedure = 0, + kTriggerCondition = 1, + kTriggerPosition = 2, + kWaitingDelay = 3, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::ConfigureFallback::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ClosureControl::Id; } + + Optional restingProcedure; + Optional triggerCondition; + Optional triggerPosition; + Optional waitingDelay; + + 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::ConfigureFallback::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ClosureControl::Id; } + + Optional restingProcedure; + Optional triggerCondition; + Optional triggerPosition; + Optional waitingDelay; + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace ConfigureFallback +namespace CancelFallback { +enum class Fields : uint8_t +{ +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::CancelFallback::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ClosureControl::Id; } + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; + + using ResponseType = DataModel::NullObjectType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::CancelFallback::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ClosureControl::Id; } + + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace CancelFallback +} // namespace Commands + +namespace Attributes { + +namespace CountdownTime { +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::ClosureControl::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::CountdownTime::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace CountdownTime +namespace MainState { +struct TypeInfo +{ + using Type = chip::app::Clusters::ClosureControl::MainStateEnum; + using DecodableType = chip::app::Clusters::ClosureControl::MainStateEnum; + using DecodableArgType = chip::app::Clusters::ClosureControl::MainStateEnum; + + static constexpr ClusterId GetClusterId() { return Clusters::ClosureControl::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::MainState::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace MainState +namespace CurrentErrorList { +struct TypeInfo +{ + using Type = chip::app::DataModel::List; + using DecodableType = chip::app::DataModel::DecodableList; + using DecodableArgType = const chip::app::DataModel::DecodableList &; + + static constexpr ClusterId GetClusterId() { return Clusters::ClosureControl::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::CurrentErrorList::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace CurrentErrorList +namespace OverallState { +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::ClosureControl::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::OverallState::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace OverallState +namespace OverallTarget { +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::ClosureControl::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::OverallTarget::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace OverallTarget +namespace RestingProcedure { +struct TypeInfo +{ + using Type = chip::app::Clusters::ClosureControl::RestingProcedureEnum; + using DecodableType = chip::app::Clusters::ClosureControl::RestingProcedureEnum; + using DecodableArgType = chip::app::Clusters::ClosureControl::RestingProcedureEnum; + + static constexpr ClusterId GetClusterId() { return Clusters::ClosureControl::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::RestingProcedure::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace RestingProcedure +namespace TriggerCondition { +struct TypeInfo +{ + using Type = chip::app::Clusters::ClosureControl::TriggerConditionEnum; + using DecodableType = chip::app::Clusters::ClosureControl::TriggerConditionEnum; + using DecodableArgType = chip::app::Clusters::ClosureControl::TriggerConditionEnum; + + static constexpr ClusterId GetClusterId() { return Clusters::ClosureControl::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::TriggerCondition::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace TriggerCondition +namespace TriggerPosition { +struct TypeInfo +{ + using Type = chip::app::Clusters::ClosureControl::TriggerPositionEnum; + using DecodableType = chip::app::Clusters::ClosureControl::TriggerPositionEnum; + using DecodableArgType = chip::app::Clusters::ClosureControl::TriggerPositionEnum; + + static constexpr ClusterId GetClusterId() { return Clusters::ClosureControl::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::TriggerPosition::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace TriggerPosition +namespace WaitingDelay { +struct TypeInfo +{ + using Type = uint32_t; + using DecodableType = uint32_t; + using DecodableArgType = uint32_t; + + static constexpr ClusterId GetClusterId() { return Clusters::ClosureControl::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::WaitingDelay::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace WaitingDelay +namespace KickoffTimer { +struct TypeInfo +{ + using Type = uint32_t; + using DecodableType = uint32_t; + using DecodableArgType = uint32_t; + + static constexpr ClusterId GetClusterId() { return Clusters::ClosureControl::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::KickoffTimer::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace KickoffTimer +namespace GeneratedCommandList { +struct TypeInfo : public Clusters::Globals::Attributes::GeneratedCommandList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::ClosureControl::Id; } +}; +} // namespace GeneratedCommandList +namespace AcceptedCommandList { +struct TypeInfo : public Clusters::Globals::Attributes::AcceptedCommandList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::ClosureControl::Id; } +}; +} // namespace AcceptedCommandList +namespace AttributeList { +struct TypeInfo : public Clusters::Globals::Attributes::AttributeList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::ClosureControl::Id; } +}; +} // namespace AttributeList +namespace FeatureMap { +struct TypeInfo : public Clusters::Globals::Attributes::FeatureMap::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::ClosureControl::Id; } +}; +} // namespace FeatureMap +namespace ClusterRevision { +struct TypeInfo : public Clusters::Globals::Attributes::ClusterRevision::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::ClosureControl::Id; } +}; +} // namespace ClusterRevision + +struct TypeInfo +{ + struct DecodableType + { + static constexpr ClusterId GetClusterId() { return Clusters::ClosureControl::Id; } + + CHIP_ERROR Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path); + + Attributes::CountdownTime::TypeInfo::DecodableType countdownTime; + Attributes::MainState::TypeInfo::DecodableType mainState = + static_cast(0); + Attributes::CurrentErrorList::TypeInfo::DecodableType currentErrorList; + Attributes::OverallState::TypeInfo::DecodableType overallState; + Attributes::OverallTarget::TypeInfo::DecodableType overallTarget; + Attributes::RestingProcedure::TypeInfo::DecodableType restingProcedure = + static_cast(0); + Attributes::TriggerCondition::TypeInfo::DecodableType triggerCondition = + static_cast(0); + Attributes::TriggerPosition::TypeInfo::DecodableType triggerPosition = + static_cast(0); + Attributes::WaitingDelay::TypeInfo::DecodableType waitingDelay = static_cast(0); + Attributes::KickoffTimer::TypeInfo::DecodableType kickoffTimer = static_cast(0); + Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; + Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; + Attributes::AttributeList::TypeInfo::DecodableType attributeList; + Attributes::FeatureMap::TypeInfo::DecodableType featureMap = static_cast(0); + Attributes::ClusterRevision::TypeInfo::DecodableType clusterRevision = static_cast(0); + }; +}; +} // namespace Attributes +} // namespace ClosureControl namespace ServiceArea { namespace Structs { namespace LandmarkInfoStruct { 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 c2a61f1ea699d1..5b07520dfb7ab7 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 @@ -4289,6 +4289,72 @@ static constexpr AttributeId Id = Globals::Attributes::ClusterRevision::Id; } // namespace Attributes } // namespace WindowCovering +namespace ClosureControl { +namespace Attributes { + +namespace CountdownTime { +static constexpr AttributeId Id = 0x00000000; +} // namespace CountdownTime + +namespace MainState { +static constexpr AttributeId Id = 0x00000001; +} // namespace MainState + +namespace CurrentErrorList { +static constexpr AttributeId Id = 0x00000002; +} // namespace CurrentErrorList + +namespace OverallState { +static constexpr AttributeId Id = 0x00000003; +} // namespace OverallState + +namespace OverallTarget { +static constexpr AttributeId Id = 0x00000004; +} // namespace OverallTarget + +namespace RestingProcedure { +static constexpr AttributeId Id = 0x00000005; +} // namespace RestingProcedure + +namespace TriggerCondition { +static constexpr AttributeId Id = 0x00000006; +} // namespace TriggerCondition + +namespace TriggerPosition { +static constexpr AttributeId Id = 0x00000007; +} // namespace TriggerPosition + +namespace WaitingDelay { +static constexpr AttributeId Id = 0x00000008; +} // namespace WaitingDelay + +namespace KickoffTimer { +static constexpr AttributeId Id = 0x00000009; +} // namespace KickoffTimer + +namespace GeneratedCommandList { +static constexpr AttributeId Id = Globals::Attributes::GeneratedCommandList::Id; +} // namespace GeneratedCommandList + +namespace AcceptedCommandList { +static constexpr AttributeId Id = Globals::Attributes::AcceptedCommandList::Id; +} // namespace AcceptedCommandList + +namespace AttributeList { +static constexpr AttributeId Id = Globals::Attributes::AttributeList::Id; +} // namespace AttributeList + +namespace FeatureMap { +static constexpr AttributeId Id = Globals::Attributes::FeatureMap::Id; +} // namespace FeatureMap + +namespace ClusterRevision { +static constexpr AttributeId Id = Globals::Attributes::ClusterRevision::Id; +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace ClosureControl + namespace ServiceArea { namespace Attributes { diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h b/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h index 1a94b9f45efa5b..bc444abb249091 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h @@ -256,6 +256,9 @@ static constexpr ClusterId Id = 0x00000101; namespace WindowCovering { static constexpr ClusterId Id = 0x00000102; } // namespace WindowCovering +namespace ClosureControl { +static constexpr ClusterId Id = 0x00000104; +} // namespace ClosureControl namespace ServiceArea { static constexpr ClusterId Id = 0x00000150; } // namespace ServiceArea 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 4834307ce383b4..3b5fff22a02ea6 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 @@ -1281,6 +1281,32 @@ static constexpr CommandId Id = 0x00000008; } // namespace Commands } // namespace WindowCovering +namespace ClosureControl { +namespace Commands { + +namespace Stop { +static constexpr CommandId Id = 0x00000000; +} // namespace Stop + +namespace MoveTo { +static constexpr CommandId Id = 0x00000001; +} // namespace MoveTo + +namespace Calibrate { +static constexpr CommandId Id = 0x00000002; +} // namespace Calibrate + +namespace ConfigureFallback { +static constexpr CommandId Id = 0x00000003; +} // namespace ConfigureFallback + +namespace CancelFallback { +static constexpr CommandId Id = 0x00000004; +} // namespace CancelFallback + +} // namespace Commands +} // namespace ClosureControl + namespace ServiceArea { namespace Commands { diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 594e2a7ed88589..f9142395d372b5 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -112,6 +112,7 @@ | DeviceEnergyManagementMode | 0x009F | | DoorLock | 0x0101 | | WindowCovering | 0x0102 | +| ClosureControl | 0x0104 | | ServiceArea | 0x0150 | | PumpConfigurationAndControl | 0x0200 | | Thermostat | 0x0201 | @@ -9133,6 +9134,225 @@ class WindowCoveringGoToTiltPercentage : public ClusterCommand chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type mRequest; }; +/*----------------------------------------------------------------------------*\ +| Cluster ClosureControl | 0x0104 | +|------------------------------------------------------------------------------| +| Commands: | | +| * Stop | 0x00 | +| * MoveTo | 0x01 | +| * Calibrate | 0x02 | +| * ConfigureFallback | 0x03 | +| * CancelFallback | 0x04 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * CountdownTime | 0x0000 | +| * MainState | 0x0001 | +| * CurrentErrorList | 0x0002 | +| * OverallState | 0x0003 | +| * OverallTarget | 0x0004 | +| * RestingProcedure | 0x0005 | +| * TriggerCondition | 0x0006 | +| * TriggerPosition | 0x0007 | +| * WaitingDelay | 0x0008 | +| * KickoffTimer | 0x0009 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ + +/* + * Command Stop + */ +class ClosureControlStop : public ClusterCommand +{ +public: + ClosureControlStop(CredentialIssuerCommands * credsIssuerConfig) : ClusterCommand("stop", credsIssuerConfig) + { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ClosureControl::Commands::Stop::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::ClosureControl::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ClosureControl::Commands::Stop::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::ClosureControl::Commands::Stop::Type mRequest; +}; + +/* + * Command MoveTo + */ +class ClosureControlMoveTo : public ClusterCommand +{ +public: + ClosureControlMoveTo(CredentialIssuerCommands * credsIssuerConfig) : ClusterCommand("move-to", credsIssuerConfig) + { + AddArgument("Tag", 0, UINT8_MAX, &mRequest.tag); + AddArgument("Latch", 0, UINT8_MAX, &mRequest.latch); + AddArgument("Speed", 0, UINT8_MAX, &mRequest.speed); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ClosureControl::Commands::MoveTo::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::ClosureControl::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ClosureControl::Commands::MoveTo::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::ClosureControl::Commands::MoveTo::Type mRequest; +}; + +/* + * Command Calibrate + */ +class ClosureControlCalibrate : public ClusterCommand +{ +public: + ClosureControlCalibrate(CredentialIssuerCommands * credsIssuerConfig) : ClusterCommand("calibrate", credsIssuerConfig) + { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ClosureControl::Commands::Calibrate::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::ClosureControl::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ClosureControl::Commands::Calibrate::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::ClosureControl::Commands::Calibrate::Type mRequest; +}; + +/* + * Command ConfigureFallback + */ +class ClosureControlConfigureFallback : public ClusterCommand +{ +public: + ClosureControlConfigureFallback(CredentialIssuerCommands * credsIssuerConfig) : + ClusterCommand("configure-fallback", credsIssuerConfig) + { + AddArgument("RestingProcedure", 0, UINT8_MAX, &mRequest.restingProcedure); + AddArgument("TriggerCondition", 0, UINT8_MAX, &mRequest.triggerCondition); + AddArgument("TriggerPosition", 0, UINT8_MAX, &mRequest.triggerPosition); + AddArgument("WaitingDelay", 0, UINT32_MAX, &mRequest.waitingDelay); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ClosureControl::Commands::ConfigureFallback::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::ClosureControl::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ClosureControl::Commands::ConfigureFallback::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::ClosureControl::Commands::ConfigureFallback::Type mRequest; +}; + +/* + * Command CancelFallback + */ +class ClosureControlCancelFallback : public ClusterCommand +{ +public: + ClosureControlCancelFallback(CredentialIssuerCommands * credsIssuerConfig) : + ClusterCommand("cancel-fallback", credsIssuerConfig) + { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ClosureControl::Commands::CancelFallback::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::ClosureControl::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ClosureControl::Commands::CancelFallback::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::ClosureControl::Commands::CancelFallback::Type mRequest; +}; + /*----------------------------------------------------------------------------*\ | Cluster ServiceArea | 0x0150 | |------------------------------------------------------------------------------| @@ -23752,6 +23972,105 @@ void registerClusterWindowCovering(Commands & commands, CredentialIssuerCommands commands.RegisterCluster(clusterName, clusterCommands); } +void registerClusterClosureControl(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) +{ + using namespace chip::app::Clusters::ClosureControl; + + const char * clusterName = "ClosureControl"; + + commands_list clusterCommands = { + // + // Commands + // + make_unique(Id, credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // + // + // Attributes + // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "countdown-time", Attributes::CountdownTime::Id, credsIssuerConfig), // + make_unique(Id, "main-state", Attributes::MainState::Id, credsIssuerConfig), // + make_unique(Id, "current-error-list", Attributes::CurrentErrorList::Id, credsIssuerConfig), // + make_unique(Id, "overall-state", Attributes::OverallState::Id, credsIssuerConfig), // + make_unique(Id, "overall-target", Attributes::OverallTarget::Id, credsIssuerConfig), // + make_unique(Id, "resting-procedure", Attributes::RestingProcedure::Id, credsIssuerConfig), // + make_unique(Id, "trigger-condition", Attributes::TriggerCondition::Id, credsIssuerConfig), // + make_unique(Id, "trigger-position", Attributes::TriggerPosition::Id, credsIssuerConfig), // + make_unique(Id, "waiting-delay", Attributes::WaitingDelay::Id, credsIssuerConfig), // + make_unique(Id, "kickoff-timer", Attributes::KickoffTimer::Id, credsIssuerConfig), // + make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // + make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // + make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // + make_unique>(Id, credsIssuerConfig), // + make_unique>>(Id, "countdown-time", 0, UINT32_MAX, + Attributes::CountdownTime::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>( + Id, "main-state", 0, UINT8_MAX, Attributes::MainState::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique< + WriteAttributeAsComplex>>( + Id, "current-error-list", Attributes::CurrentErrorList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "overall-state", Attributes::OverallState::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "overall-target", Attributes::OverallTarget::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>( + Id, "resting-procedure", 0, UINT8_MAX, Attributes::RestingProcedure::Id, WriteCommandType::kForceWrite, + credsIssuerConfig), // + make_unique>( + Id, "trigger-condition", 0, UINT8_MAX, Attributes::TriggerCondition::Id, WriteCommandType::kForceWrite, + credsIssuerConfig), // + make_unique>( + Id, "trigger-position", 0, UINT8_MAX, Attributes::TriggerPosition::Id, WriteCommandType::kForceWrite, + credsIssuerConfig), // + make_unique>(Id, "waiting-delay", 0, UINT32_MAX, Attributes::WaitingDelay::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "kickoff-timer", 0, UINT32_MAX, Attributes::KickoffTimer::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "generated-command-list", Attributes::GeneratedCommandList::Id, WriteCommandType::kForceWrite, + credsIssuerConfig), // + make_unique>>( + Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "attribute-list", Attributes::AttributeList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "feature-map", 0, UINT32_MAX, Attributes::FeatureMap::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "cluster-revision", 0, UINT16_MAX, Attributes::ClusterRevision::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "countdown-time", Attributes::CountdownTime::Id, credsIssuerConfig), // + make_unique(Id, "main-state", Attributes::MainState::Id, credsIssuerConfig), // + make_unique(Id, "current-error-list", Attributes::CurrentErrorList::Id, credsIssuerConfig), // + make_unique(Id, "overall-state", Attributes::OverallState::Id, credsIssuerConfig), // + make_unique(Id, "overall-target", Attributes::OverallTarget::Id, credsIssuerConfig), // + make_unique(Id, "resting-procedure", Attributes::RestingProcedure::Id, credsIssuerConfig), // + make_unique(Id, "trigger-condition", Attributes::TriggerCondition::Id, credsIssuerConfig), // + make_unique(Id, "trigger-position", Attributes::TriggerPosition::Id, credsIssuerConfig), // + make_unique(Id, "waiting-delay", Attributes::WaitingDelay::Id, credsIssuerConfig), // + make_unique(Id, "kickoff-timer", Attributes::KickoffTimer::Id, credsIssuerConfig), // + make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // + make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // + make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // + // + // Events + // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + }; + + commands.RegisterCluster(clusterName, clusterCommands); +} void registerClusterServiceArea(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { using namespace chip::app::Clusters::ServiceArea; @@ -29172,6 +29491,7 @@ void registerClusters(Commands & commands, CredentialIssuerCommands * credsIssue registerClusterDeviceEnergyManagementMode(commands, credsIssuerConfig); registerClusterDoorLock(commands, credsIssuerConfig); registerClusterWindowCovering(commands, credsIssuerConfig); + registerClusterClosureControl(commands, credsIssuerConfig); registerClusterServiceArea(commands, credsIssuerConfig); registerClusterPumpConfigurationAndControl(commands, credsIssuerConfig); registerClusterThermostat(commands, credsIssuerConfig); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index 93332effce659f..ad88826578a3f6 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -4195,6 +4195,96 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::DoorLock::Structs::Cre ComplexArgumentParser::Finalize(request.credentialIndex); } +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ClosureControl::Structs::OverallStateStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + char labelWithMember[kMaxLabelLength]; + if (value.isMember("positioning")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "positioning"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.positioning, value["positioning"])); + } + valueCopy.removeMember("positioning"); + + if (value.isMember("latching")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "latching"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.latching, value["latching"])); + } + valueCopy.removeMember("latching"); + + if (value.isMember("speed")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "speed"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.speed, value["speed"])); + } + valueCopy.removeMember("speed"); + + if (value.isMember("extraInfo")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "extraInfo"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.extraInfo, value["extraInfo"])); + } + valueCopy.removeMember("extraInfo"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::ClosureControl::Structs::OverallStateStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.positioning); + ComplexArgumentParser::Finalize(request.latching); + ComplexArgumentParser::Finalize(request.speed); + ComplexArgumentParser::Finalize(request.extraInfo); +} + +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ClosureControl::Structs::OverallTargetStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + char labelWithMember[kMaxLabelLength]; + if (value.isMember("tagPosition")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "tagPosition"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.tagPosition, value["tagPosition"])); + } + valueCopy.removeMember("tagPosition"); + + if (value.isMember("tagLatch")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "tagLatch"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.tagLatch, value["tagLatch"])); + } + valueCopy.removeMember("tagLatch"); + + if (value.isMember("speed")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "speed"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.speed, value["speed"])); + } + valueCopy.removeMember("speed"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::ClosureControl::Structs::OverallTargetStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.tagPosition); + ComplexArgumentParser::Finalize(request.tagLatch); + ComplexArgumentParser::Finalize(request.speed); +} + CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::ServiceArea::Structs::LandmarkInfoStruct::Type & request, Json::Value & value) diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h index 344d6ab728bec0..1e879ab3a4b09a 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h @@ -479,6 +479,16 @@ static CHIP_ERROR Setup(const char * label, chip::app::Clusters::DoorLock::Struc static void Finalize(chip::app::Clusters::DoorLock::Structs::CredentialStruct::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ClosureControl::Structs::OverallStateStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ClosureControl::Structs::OverallStateStruct::Type & request); + +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ClosureControl::Structs::OverallTargetStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ClosureControl::Structs::OverallTargetStruct::Type & request); + static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ServiceArea::Structs::LandmarkInfoStruct::Type & request, Json::Value & value); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index f8329e70749918..64e1e66495430e 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -3725,6 +3725,80 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::ClosureControl::Structs::OverallStateStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("Positioning", indent + 1, value.positioning); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Positioning'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Latching", indent + 1, value.latching); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Latching'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Speed", indent + 1, value.speed); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Speed'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("ExtraInfo", indent + 1, value.extraInfo); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ExtraInfo'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::ClosureControl::Structs::OverallTargetStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("TagPosition", indent + 1, value.tagPosition); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'TagPosition'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("TagLatch", indent + 1, value.tagLatch); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'TagLatch'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Speed", indent + 1, value.speed); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Speed'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::ServiceArea::Structs::LandmarkInfoStruct::DecodableType & value) { @@ -15912,6 +15986,87 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP } break; } + case ClosureControl::Id: { + switch (path.mAttributeId) + { + case ClosureControl::Attributes::CountdownTime::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("CountdownTime", 1, value); + } + case ClosureControl::Attributes::MainState::Id: { + chip::app::Clusters::ClosureControl::MainStateEnum value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("MainState", 1, value); + } + case ClosureControl::Attributes::CurrentErrorList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("CurrentErrorList", 1, value); + } + case ClosureControl::Attributes::OverallState::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("OverallState", 1, value); + } + case ClosureControl::Attributes::OverallTarget::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("OverallTarget", 1, value); + } + case ClosureControl::Attributes::RestingProcedure::Id: { + chip::app::Clusters::ClosureControl::RestingProcedureEnum value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("RestingProcedure", 1, value); + } + case ClosureControl::Attributes::TriggerCondition::Id: { + chip::app::Clusters::ClosureControl::TriggerConditionEnum value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("TriggerCondition", 1, value); + } + case ClosureControl::Attributes::TriggerPosition::Id: { + chip::app::Clusters::ClosureControl::TriggerPositionEnum value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("TriggerPosition", 1, value); + } + case ClosureControl::Attributes::WaitingDelay::Id: { + uint32_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("WaitingDelay", 1, value); + } + case ClosureControl::Attributes::KickoffTimer::Id: { + uint32_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("KickoffTimer", 1, value); + } + case ClosureControl::Attributes::GeneratedCommandList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, ClosureControl::Id); + } + case ClosureControl::Attributes::AcceptedCommandList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, ClosureControl::Id); + } + case ClosureControl::Attributes::AttributeList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, ClosureControl::Id); + } + case ClosureControl::Attributes::FeatureMap::Id: { + uint32_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("FeatureMap", 1, value); + } + case ClosureControl::Attributes::ClusterRevision::Id: { + uint16_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ClusterRevision", 1, value); + } + } + break; + } case ServiceArea::Id: { switch (path.mAttributeId) { diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h index 5cd5e82a21fe50..cebbf479e877f5 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h @@ -299,6 +299,12 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::DoorLock::Structs::CredentialStruct::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::ClosureControl::Structs::OverallStateStruct::DecodableType & value); + +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::ClosureControl::Structs::OverallTargetStruct::DecodableType & value); + static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::ServiceArea::Structs::LandmarkInfoStruct::DecodableType & value); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp index d0593cdcc9ea15..69965f88b56d7a 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp @@ -179,6 +179,8 @@ char const * ClusterIdToText(chip::ClusterId id) return "DoorLock"; case chip::app::Clusters::WindowCovering::Id: return "WindowCovering"; + case chip::app::Clusters::ClosureControl::Id: + return "ClosureControl"; case chip::app::Clusters::ServiceArea::Id: return "ServiceArea"; case chip::app::Clusters::PumpConfigurationAndControl::Id: @@ -2721,6 +2723,43 @@ char const * AttributeIdToText(chip::ClusterId cluster, chip::AttributeId id) return "Unknown"; } } + case chip::app::Clusters::ClosureControl::Id: { + switch (id) + { + case chip::app::Clusters::ClosureControl::Attributes::CountdownTime::Id: + return "CountdownTime"; + case chip::app::Clusters::ClosureControl::Attributes::MainState::Id: + return "MainState"; + case chip::app::Clusters::ClosureControl::Attributes::CurrentErrorList::Id: + return "CurrentErrorList"; + case chip::app::Clusters::ClosureControl::Attributes::OverallState::Id: + return "OverallState"; + case chip::app::Clusters::ClosureControl::Attributes::OverallTarget::Id: + return "OverallTarget"; + case chip::app::Clusters::ClosureControl::Attributes::RestingProcedure::Id: + return "RestingProcedure"; + case chip::app::Clusters::ClosureControl::Attributes::TriggerCondition::Id: + return "TriggerCondition"; + case chip::app::Clusters::ClosureControl::Attributes::TriggerPosition::Id: + return "TriggerPosition"; + case chip::app::Clusters::ClosureControl::Attributes::WaitingDelay::Id: + return "WaitingDelay"; + case chip::app::Clusters::ClosureControl::Attributes::KickoffTimer::Id: + return "KickoffTimer"; + case chip::app::Clusters::ClosureControl::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::ClosureControl::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::ClosureControl::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::ClosureControl::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::ClosureControl::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } case chip::app::Clusters::ServiceArea::Id: { switch (id) { @@ -5428,6 +5467,23 @@ char const * AcceptedCommandIdToText(chip::ClusterId cluster, chip::CommandId id return "Unknown"; } } + case chip::app::Clusters::ClosureControl::Id: { + switch (id) + { + case chip::app::Clusters::ClosureControl::Commands::Stop::Id: + return "Stop"; + case chip::app::Clusters::ClosureControl::Commands::MoveTo::Id: + return "MoveTo"; + case chip::app::Clusters::ClosureControl::Commands::Calibrate::Id: + return "Calibrate"; + case chip::app::Clusters::ClosureControl::Commands::ConfigureFallback::Id: + return "ConfigureFallback"; + case chip::app::Clusters::ClosureControl::Commands::CancelFallback::Id: + return "CancelFallback"; + default: + return "Unknown"; + } + } case chip::app::Clusters::ServiceArea::Id: { switch (id) { diff --git a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h index a4d1481b6482b7..734f12895e71f4 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -114,6 +114,7 @@ | DeviceEnergyManagementMode | 0x009F | | DoorLock | 0x0101 | | WindowCovering | 0x0102 | +| ClosureControl | 0x0104 | | ServiceArea | 0x0150 | | PumpConfigurationAndControl | 0x0200 | | Thermostat | 0x0201 | @@ -90579,6 +90580,1616 @@ class SubscribeAttributeWindowCoveringClusterRevision : public SubscribeAttribut } }; +#if MTR_ENABLE_PROVISIONAL +/*----------------------------------------------------------------------------*\ +| Cluster ClosureControl | 0x0104 | +|------------------------------------------------------------------------------| +| Commands: | | +| * Stop | 0x00 | +| * MoveTo | 0x01 | +| * Calibrate | 0x02 | +| * ConfigureFallback | 0x03 | +| * CancelFallback | 0x04 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * CountdownTime | 0x0000 | +| * MainState | 0x0001 | +| * CurrentErrorList | 0x0002 | +| * OverallState | 0x0003 | +| * OverallTarget | 0x0004 | +| * RestingProcedure | 0x0005 | +| * TriggerCondition | 0x0006 | +| * TriggerPosition | 0x0007 | +| * WaitingDelay | 0x0008 | +| * KickoffTimer | 0x0009 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ + +#if MTR_ENABLE_PROVISIONAL +/* + * Command Stop + */ +class ClosureControlStop : public ClusterCommand { +public: + ClosureControlStop() + : ClusterCommand("stop") + { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ClosureControl::Commands::Stop::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_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRClosureControlClusterStopParams alloc] init]; + params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster stopWithParams:params completion: + ^(NSError * _Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } + +private: +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL +/* + * Command MoveTo + */ +class ClosureControlMoveTo : public ClusterCommand { +public: + ClosureControlMoveTo() + : ClusterCommand("move-to") + { +#if MTR_ENABLE_PROVISIONAL + AddArgument("Tag", 0, UINT8_MAX, &mRequest.tag); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("Latch", 0, UINT8_MAX, &mRequest.latch); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("Speed", 0, UINT8_MAX, &mRequest.speed); +#endif // MTR_ENABLE_PROVISIONAL + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ClosureControl::Commands::MoveTo::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_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRClosureControlClusterMoveToParams alloc] init]; + params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; +#if MTR_ENABLE_PROVISIONAL + if (mRequest.tag.HasValue()) { + params.tag = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.tag.Value())]; + } else { + params.tag = nil; + } +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + if (mRequest.latch.HasValue()) { + params.latch = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.latch.Value())]; + } else { + params.latch = nil; + } +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + if (mRequest.speed.HasValue()) { + params.speed = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.speed.Value())]; + } else { + params.speed = nil; + } +#endif // MTR_ENABLE_PROVISIONAL + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster moveToWithParams: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::ClosureControl::Commands::MoveTo::Type mRequest; +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL +/* + * Command Calibrate + */ +class ClosureControlCalibrate : public ClusterCommand { +public: + ClosureControlCalibrate() + : ClusterCommand("calibrate") + { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ClosureControl::Commands::Calibrate::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_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRClosureControlClusterCalibrateParams alloc] init]; + params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster calibrateWithParams:params completion: + ^(NSError * _Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } + +private: +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL +/* + * Command ConfigureFallback + */ +class ClosureControlConfigureFallback : public ClusterCommand { +public: + ClosureControlConfigureFallback() + : ClusterCommand("configure-fallback") + { +#if MTR_ENABLE_PROVISIONAL + AddArgument("RestingProcedure", 0, UINT8_MAX, &mRequest.restingProcedure); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("TriggerCondition", 0, UINT8_MAX, &mRequest.triggerCondition); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("TriggerPosition", 0, UINT8_MAX, &mRequest.triggerPosition); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("WaitingDelay", 0, UINT32_MAX, &mRequest.waitingDelay); +#endif // MTR_ENABLE_PROVISIONAL + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ClosureControl::Commands::ConfigureFallback::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_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRClosureControlClusterConfigureFallbackParams alloc] init]; + params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; +#if MTR_ENABLE_PROVISIONAL + if (mRequest.restingProcedure.HasValue()) { + params.restingProcedure = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.restingProcedure.Value())]; + } else { + params.restingProcedure = nil; + } +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + if (mRequest.triggerCondition.HasValue()) { + params.triggerCondition = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.triggerCondition.Value())]; + } else { + params.triggerCondition = nil; + } +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + if (mRequest.triggerPosition.HasValue()) { + params.triggerPosition = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.triggerPosition.Value())]; + } else { + params.triggerPosition = nil; + } +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + if (mRequest.waitingDelay.HasValue()) { + params.waitingDelay = [NSNumber numberWithUnsignedInt:mRequest.waitingDelay.Value()]; + } else { + params.waitingDelay = nil; + } +#endif // MTR_ENABLE_PROVISIONAL + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster configureFallbackWithParams: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::ClosureControl::Commands::ConfigureFallback::Type mRequest; +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL +/* + * Command CancelFallback + */ +class ClosureControlCancelFallback : public ClusterCommand { +public: + ClosureControlCancelFallback() + : ClusterCommand("cancel-fallback") + { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ClosureControl::Commands::CancelFallback::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_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRClosureControlClusterCancelFallbackParams alloc] init]; + params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster cancelFallbackWithParams:params completion: + ^(NSError * _Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } + +private: +}; + +#endif // MTR_ENABLE_PROVISIONAL + +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute CountdownTime + */ +class ReadClosureControlCountdownTime : public ReadAttribute { +public: + ReadClosureControlCountdownTime() + : ReadAttribute("countdown-time") + { + } + + ~ReadClosureControlCountdownTime() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ClosureControl::Attributes::CountdownTime::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_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeCountdownTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClosureControl.CountdownTime response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ClosureControl CountdownTime read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeClosureControlCountdownTime : public SubscribeAttribute { +public: + SubscribeAttributeClosureControlCountdownTime() + : SubscribeAttribute("countdown-time") + { + } + + ~SubscribeAttributeClosureControlCountdownTime() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ClosureControl::Attributes::CountdownTime::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_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl 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 subscribeAttributeCountdownTimeWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClosureControl.CountdownTime 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 MainState + */ +class ReadClosureControlMainState : public ReadAttribute { +public: + ReadClosureControlMainState() + : ReadAttribute("main-state") + { + } + + ~ReadClosureControlMainState() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ClosureControl::Attributes::MainState::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_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeMainStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClosureControl.MainState response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ClosureControl MainState read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeClosureControlMainState : public SubscribeAttribute { +public: + SubscribeAttributeClosureControlMainState() + : SubscribeAttribute("main-state") + { + } + + ~SubscribeAttributeClosureControlMainState() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ClosureControl::Attributes::MainState::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_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl 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 subscribeAttributeMainStateWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClosureControl.MainState 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 CurrentErrorList + */ +class ReadClosureControlCurrentErrorList : public ReadAttribute { +public: + ReadClosureControlCurrentErrorList() + : ReadAttribute("current-error-list") + { + } + + ~ReadClosureControlCurrentErrorList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ClosureControl::Attributes::CurrentErrorList::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_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeCurrentErrorListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClosureControl.CurrentErrorList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ClosureControl CurrentErrorList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeClosureControlCurrentErrorList : public SubscribeAttribute { +public: + SubscribeAttributeClosureControlCurrentErrorList() + : SubscribeAttribute("current-error-list") + { + } + + ~SubscribeAttributeClosureControlCurrentErrorList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ClosureControl::Attributes::CurrentErrorList::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_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl 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 subscribeAttributeCurrentErrorListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClosureControl.CurrentErrorList 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 OverallState + */ +class ReadClosureControlOverallState : public ReadAttribute { +public: + ReadClosureControlOverallState() + : ReadAttribute("overall-state") + { + } + + ~ReadClosureControlOverallState() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ClosureControl::Attributes::OverallState::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_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeOverallStateWithCompletion:^(MTRClosureControlClusterOverallStateStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClosureControl.OverallState response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ClosureControl OverallState read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeClosureControlOverallState : public SubscribeAttribute { +public: + SubscribeAttributeClosureControlOverallState() + : SubscribeAttribute("overall-state") + { + } + + ~SubscribeAttributeClosureControlOverallState() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ClosureControl::Attributes::OverallState::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_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl 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 subscribeAttributeOverallStateWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(MTRClosureControlClusterOverallStateStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClosureControl.OverallState 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 OverallTarget + */ +class ReadClosureControlOverallTarget : public ReadAttribute { +public: + ReadClosureControlOverallTarget() + : ReadAttribute("overall-target") + { + } + + ~ReadClosureControlOverallTarget() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ClosureControl::Attributes::OverallTarget::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_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeOverallTargetWithCompletion:^(MTRClosureControlClusterOverallTargetStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClosureControl.OverallTarget response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ClosureControl OverallTarget read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeClosureControlOverallTarget : public SubscribeAttribute { +public: + SubscribeAttributeClosureControlOverallTarget() + : SubscribeAttribute("overall-target") + { + } + + ~SubscribeAttributeClosureControlOverallTarget() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ClosureControl::Attributes::OverallTarget::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_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl 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 subscribeAttributeOverallTargetWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(MTRClosureControlClusterOverallTargetStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClosureControl.OverallTarget 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 RestingProcedure + */ +class ReadClosureControlRestingProcedure : public ReadAttribute { +public: + ReadClosureControlRestingProcedure() + : ReadAttribute("resting-procedure") + { + } + + ~ReadClosureControlRestingProcedure() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ClosureControl::Attributes::RestingProcedure::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_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeRestingProcedureWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClosureControl.RestingProcedure response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ClosureControl RestingProcedure read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeClosureControlRestingProcedure : public SubscribeAttribute { +public: + SubscribeAttributeClosureControlRestingProcedure() + : SubscribeAttribute("resting-procedure") + { + } + + ~SubscribeAttributeClosureControlRestingProcedure() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ClosureControl::Attributes::RestingProcedure::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_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl 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 subscribeAttributeRestingProcedureWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClosureControl.RestingProcedure 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 TriggerCondition + */ +class ReadClosureControlTriggerCondition : public ReadAttribute { +public: + ReadClosureControlTriggerCondition() + : ReadAttribute("trigger-condition") + { + } + + ~ReadClosureControlTriggerCondition() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ClosureControl::Attributes::TriggerCondition::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_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeTriggerConditionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClosureControl.TriggerCondition response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ClosureControl TriggerCondition read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeClosureControlTriggerCondition : public SubscribeAttribute { +public: + SubscribeAttributeClosureControlTriggerCondition() + : SubscribeAttribute("trigger-condition") + { + } + + ~SubscribeAttributeClosureControlTriggerCondition() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ClosureControl::Attributes::TriggerCondition::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_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl 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 subscribeAttributeTriggerConditionWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClosureControl.TriggerCondition 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 TriggerPosition + */ +class ReadClosureControlTriggerPosition : public ReadAttribute { +public: + ReadClosureControlTriggerPosition() + : ReadAttribute("trigger-position") + { + } + + ~ReadClosureControlTriggerPosition() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ClosureControl::Attributes::TriggerPosition::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_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeTriggerPositionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClosureControl.TriggerPosition response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ClosureControl TriggerPosition read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeClosureControlTriggerPosition : public SubscribeAttribute { +public: + SubscribeAttributeClosureControlTriggerPosition() + : SubscribeAttribute("trigger-position") + { + } + + ~SubscribeAttributeClosureControlTriggerPosition() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ClosureControl::Attributes::TriggerPosition::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_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl 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 subscribeAttributeTriggerPositionWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClosureControl.TriggerPosition 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 WaitingDelay + */ +class ReadClosureControlWaitingDelay : public ReadAttribute { +public: + ReadClosureControlWaitingDelay() + : ReadAttribute("waiting-delay") + { + } + + ~ReadClosureControlWaitingDelay() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ClosureControl::Attributes::WaitingDelay::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_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeWaitingDelayWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClosureControl.WaitingDelay response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ClosureControl WaitingDelay read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeClosureControlWaitingDelay : public SubscribeAttribute { +public: + SubscribeAttributeClosureControlWaitingDelay() + : SubscribeAttribute("waiting-delay") + { + } + + ~SubscribeAttributeClosureControlWaitingDelay() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ClosureControl::Attributes::WaitingDelay::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_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl 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 subscribeAttributeWaitingDelayWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClosureControl.WaitingDelay 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 KickoffTimer + */ +class ReadClosureControlKickoffTimer : public ReadAttribute { +public: + ReadClosureControlKickoffTimer() + : ReadAttribute("kickoff-timer") + { + } + + ~ReadClosureControlKickoffTimer() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ClosureControl::Attributes::KickoffTimer::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_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeKickoffTimerWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClosureControl.KickoffTimer response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ClosureControl KickoffTimer read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeClosureControlKickoffTimer : public SubscribeAttribute { +public: + SubscribeAttributeClosureControlKickoffTimer() + : SubscribeAttribute("kickoff-timer") + { + } + + ~SubscribeAttributeClosureControlKickoffTimer() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ClosureControl::Attributes::KickoffTimer::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_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl 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 subscribeAttributeKickoffTimerWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClosureControl.KickoffTimer response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute GeneratedCommandList + */ +class ReadClosureControlGeneratedCommandList : public ReadAttribute { +public: + ReadClosureControlGeneratedCommandList() + : ReadAttribute("generated-command-list") + { + } + + ~ReadClosureControlGeneratedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ClosureControl::Attributes::GeneratedCommandList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClosureControl.GeneratedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ClosureControl GeneratedCommandList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeClosureControlGeneratedCommandList : public SubscribeAttribute { +public: + SubscribeAttributeClosureControlGeneratedCommandList() + : SubscribeAttribute("generated-command-list") + { + } + + ~SubscribeAttributeClosureControlGeneratedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ClosureControl::Attributes::GeneratedCommandList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClosureControl.GeneratedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute AcceptedCommandList + */ +class ReadClosureControlAcceptedCommandList : public ReadAttribute { +public: + ReadClosureControlAcceptedCommandList() + : ReadAttribute("accepted-command-list") + { + } + + ~ReadClosureControlAcceptedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ClosureControl::Attributes::AcceptedCommandList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClosureControl.AcceptedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ClosureControl AcceptedCommandList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeClosureControlAcceptedCommandList : public SubscribeAttribute { +public: + SubscribeAttributeClosureControlAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") + { + } + + ~SubscribeAttributeClosureControlAcceptedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ClosureControl::Attributes::AcceptedCommandList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClosureControl.AcceptedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute AttributeList + */ +class ReadClosureControlAttributeList : public ReadAttribute { +public: + ReadClosureControlAttributeList() + : ReadAttribute("attribute-list") + { + } + + ~ReadClosureControlAttributeList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ClosureControl::Attributes::AttributeList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClosureControl.AttributeList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ClosureControl AttributeList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeClosureControlAttributeList : public SubscribeAttribute { +public: + SubscribeAttributeClosureControlAttributeList() + : SubscribeAttribute("attribute-list") + { + } + + ~SubscribeAttributeClosureControlAttributeList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ClosureControl::Attributes::AttributeList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClosureControl.AttributeList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute FeatureMap + */ +class ReadClosureControlFeatureMap : public ReadAttribute { +public: + ReadClosureControlFeatureMap() + : ReadAttribute("feature-map") + { + } + + ~ReadClosureControlFeatureMap() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ClosureControl::Attributes::FeatureMap::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClosureControl.FeatureMap response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ClosureControl FeatureMap read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeClosureControlFeatureMap : public SubscribeAttribute { +public: + SubscribeAttributeClosureControlFeatureMap() + : SubscribeAttribute("feature-map") + { + } + + ~SubscribeAttributeClosureControlFeatureMap() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ClosureControl::Attributes::FeatureMap::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClosureControl.FeatureMap response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute ClusterRevision + */ +class ReadClosureControlClusterRevision : public ReadAttribute { +public: + ReadClosureControlClusterRevision() + : ReadAttribute("cluster-revision") + { + } + + ~ReadClosureControlClusterRevision() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ClosureControl::Attributes::ClusterRevision::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClosureControl.ClusterRevision response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ClosureControl ClusterRevision read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeClosureControlClusterRevision : public SubscribeAttribute { +public: + SubscribeAttributeClosureControlClusterRevision() + : SubscribeAttribute("cluster-revision") + { + } + + ~SubscribeAttributeClosureControlClusterRevision() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ClosureControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ClosureControl::Attributes::ClusterRevision::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterClosureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ClosureControl.ClusterRevision response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#endif // MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster ServiceArea | 0x0150 | |------------------------------------------------------------------------------| @@ -179746,6 +181357,98 @@ void registerClusterWindowCovering(Commands & commands) commands.RegisterCluster(clusterName, clusterCommands); } +void registerClusterClosureControl(Commands & commands) +{ +#if MTR_ENABLE_PROVISIONAL + using namespace chip::app::Clusters::ClosureControl; + + const char * clusterName = "ClosureControl"; + + commands_list clusterCommands = { + make_unique(Id), // +#if MTR_ENABLE_PROVISIONAL + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL + make_unique(Id), // + make_unique(Id), // + make_unique(Id), // +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL + }; + + commands.RegisterCluster(clusterName, clusterCommands); +#endif // MTR_ENABLE_PROVISIONAL +} void registerClusterServiceArea(Commands & commands) { using namespace chip::app::Clusters::ServiceArea; @@ -183010,6 +184713,7 @@ void registerClusters(Commands & commands) registerClusterDeviceEnergyManagementMode(commands); registerClusterDoorLock(commands); registerClusterWindowCovering(commands); + registerClusterClosureControl(commands); registerClusterServiceArea(commands); registerClusterPumpConfigurationAndControl(commands); registerClusterThermostat(commands); From 3f1327786c19d441bfc1e61b0bf21c8ce2b6eb0a Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Fri, 14 Feb 2025 05:55:27 +0000 Subject: [PATCH 3/7] Restyled by prettier-json --- src/app/zap-templates/zcl/zcl-with-test-extensions.json | 6 +----- src/app/zap-templates/zcl/zcl.json | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/app/zap-templates/zcl/zcl-with-test-extensions.json b/src/app/zap-templates/zcl/zcl-with-test-extensions.json index 4589ff436eab4c..7bd7e09819a5e3 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -201,11 +201,7 @@ ], "Bridged Device Basic Information": ["ProductAppearance"], "Chime": ["ActiveChimeID", "Enabled"], - "Closure Control": [ - "OverallState", - "OverallTarget", - "FeatureMap" - ], + "Closure Control": ["OverallState", "OverallTarget", "FeatureMap"], "Descriptor": ["ClusterRevision", "FeatureMap"], "Device Energy Management": [ "ESAType", diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index c14cb2aeaa039b..45b16f2bcd5103 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -195,11 +195,7 @@ ], "Bridged Device Basic Information": ["ProductAppearance"], "Chime": ["ActiveChimeID", "Enabled"], - "Closure Control": [ - "OverallState", - "OverallTarget", - "FeatureMap" - ], + "Closure Control": ["OverallState", "OverallTarget", "FeatureMap"], "Descriptor": ["ClusterRevision", "FeatureMap"], "Device Energy Management": [ "ESAType", From 2007f99f0b58796183125fb67bed8a8621b74c7c Mon Sep 17 00:00:00 2001 From: senthil kumar E K Date: Mon, 17 Feb 2025 15:38:27 +0530 Subject: [PATCH 4/7] removing FeatureMap --- src/app/zap-templates/zcl/zcl-with-test-extensions.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/zap-templates/zcl/zcl-with-test-extensions.json b/src/app/zap-templates/zcl/zcl-with-test-extensions.json index 7bd7e09819a5e3..b5addfc2fcb105 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -201,7 +201,7 @@ ], "Bridged Device Basic Information": ["ProductAppearance"], "Chime": ["ActiveChimeID", "Enabled"], - "Closure Control": ["OverallState", "OverallTarget", "FeatureMap"], + "Closure Control": ["OverallState", "OverallTarget"], "Descriptor": ["ClusterRevision", "FeatureMap"], "Device Energy Management": [ "ESAType", From 96ed7c84a0198b7e5c02965a62e56a6fe92c5fbf Mon Sep 17 00:00:00 2001 From: senthil kumar E K Date: Mon, 17 Feb 2025 15:39:55 +0530 Subject: [PATCH 5/7] removing FeatureMap in zcl --- src/app/zap-templates/zcl/zcl.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index 45b16f2bcd5103..49b9fd84f5a483 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -195,7 +195,7 @@ ], "Bridged Device Basic Information": ["ProductAppearance"], "Chime": ["ActiveChimeID", "Enabled"], - "Closure Control": ["OverallState", "OverallTarget", "FeatureMap"], + "Closure Control": ["OverallState", "OverallTarget"], "Descriptor": ["ClusterRevision", "FeatureMap"], "Device Energy Management": [ "ESAType", From eaf78e02f6c6e7fb2b2abe0607957619a328f57c Mon Sep 17 00:00:00 2001 From: senthil kumar E K Date: Mon, 17 Feb 2025 16:31:58 +0530 Subject: [PATCH 6/7] generate zap with removed FeatureMap --- .../zap-generated/attributes/Accessors.cpp | 47 +++++++++++++++++++ .../zap-generated/attributes/Accessors.h | 6 +++ 2 files changed, 53 insertions(+) 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 304462dc126bff..611c529d924549 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 @@ -19931,6 +19931,53 @@ Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value) } // namespace KickoffTimer +namespace FeatureMap { + +Protocols::InteractionModel::Status Get(EndpointId endpoint, uint32_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::ClosureControl::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + *value = Traits::StorageToWorking(temp); + return status; +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::ClosureControl::Id, Id), + EmberAfWriteDataInput(writable, ZCL_BITMAP32_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::ClosureControl::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); +} + +} // namespace FeatureMap + namespace ClusterRevision { Protocols::InteractionModel::Status Get(EndpointId endpoint, uint16_t * value) diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h index 8a403aad4078af..058caa58bda64b 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 @@ -3139,6 +3139,12 @@ Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value); Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty); } // namespace KickoffTimer +namespace FeatureMap { +Protocols::InteractionModel::Status Get(EndpointId endpoint, uint32_t * value); // bitmap32 +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value); +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty); +} // namespace FeatureMap + namespace ClusterRevision { Protocols::InteractionModel::Status Get(EndpointId endpoint, uint16_t * value); // int16u Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value); From 87009f5c25f878c6f683fb9309a87185d3bebce0 Mon Sep 17 00:00:00 2001 From: senthil kumar E K Date: Tue, 18 Feb 2025 01:00:46 +0530 Subject: [PATCH 7/7] Added manual description for closure control --- .../zcl/data-model/chip/closure-control-cluster.xml | 2 +- src/controller/data_model/controller-clusters.matter | 2 +- src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h | 2 +- src/darwin/Framework/CHIP/zap-generated/MTRClusters.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/zap-templates/zcl/data-model/chip/closure-control-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/closure-control-cluster.xml index 3fcd9c8b57c872..d3ef1570615dd8 100644 --- a/src/app/zap-templates/zcl/data-model/chip/closure-control-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/closure-control-cluster.xml @@ -120,7 +120,7 @@ Git: 0.7-summer-2025-5-g06c4d5596-dirty Closure Control 0x0104 CLOSURE_CONTROL_CLUSTER - + This cluster provides an interface for controlling a Closure device. true true diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 776f74d9416295..2cf8f2799bb6e7 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -6478,7 +6478,7 @@ cluster WindowCovering = 258 { command GoToTiltPercentage(GoToTiltPercentageRequest): DefaultSuccess = 8; } -/** */ +/** This cluster provides an interface for controlling a Closure device. */ cluster ClosureControl = 260 { revision 1; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index f088c400bcbc6b..c870fe59474060 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -8771,7 +8771,7 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) /** * Cluster Closure Control * - * + * This cluster provides an interface for controlling a Closure device. */ MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterClosureControl : MTRGenericBaseCluster diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index 1d313db71bdaad..3772d3319d91ff 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -4116,7 +4116,7 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) /** * Cluster Closure Control - * + * This cluster provides an interface for controlling a Closure device. */ MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterClosureControl : MTRGenericCluster