From 0f92c5f0e67eb701455e34d4f0e8a752b369e90e Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Wed, 28 Apr 2021 03:53:48 +0200 Subject: [PATCH] Add initial definition for the Switch Cluster and activate it for some configurations (#6313) * Add definition for the Switch Cluster * Activate the Switch Cluster in some configurations * Update gen/ folder * Revert chip_client_clusters by chip_server_clusters for the python specific templates at the moment * Update the python generated file --- .../all-clusters-common/all-clusters-app.zap | 196 +- .../all-clusters-common/gen/attribute-id.h | 9 + .../gen/call-command-handler.cpp | 5 + .../all-clusters-common/gen/callback-stub.cpp | 8 + .../all-clusters-common/gen/callback.h | 78 + .../all-clusters-common/gen/cluster-id.h | 3 + .../all-clusters-common/gen/endpoint_config.h | 53 +- .../all-clusters-common/gen/gen_config.h | 8 +- .../all-clusters-common/gen/print-cluster.h | 7 + .../bridge-common/gen/attribute-id.h | 9 + .../bridge-app/bridge-common/gen/cluster-id.h | 3 + .../bridge-common/gen/print-cluster.h | 7 + examples/chip-tool/chip-tool.zap | 261 +- .../chip-tool/commands/clusters/Commands.h | 206 ++ .../chip-tool/commands/reporting/Commands.h | 5 + examples/chip-tool/gen/CHIPClusters.cpp | 47 + examples/chip-tool/gen/CHIPClusters.h | 17 + examples/chip-tool/gen/CHIPClustersObjc.h | 17 + examples/chip-tool/gen/CHIPClustersObjc.mm | 124 + examples/chip-tool/gen/attribute-id.h | 9 + .../chip-tool/gen/call-command-handler.cpp | 5 + examples/chip-tool/gen/callback-stub.cpp | 8 + examples/chip-tool/gen/callback.h | 78 + examples/chip-tool/gen/cluster-id.h | 3 + examples/chip-tool/gen/endpoint_config.h | 34 +- examples/chip-tool/gen/gen_config.h | 5 + examples/chip-tool/gen/print-cluster.h | 7 + .../lighting-common/gen/attribute-id.h | 9 + .../lighting-common/gen/cluster-id.h | 3 + .../lighting-common/gen/print-cluster.h | 7 + .../lock-app/lock-common/gen/attribute-id.h | 9 + .../lock-app/lock-common/gen/cluster-id.h | 3 + .../lock-app/lock-common/gen/print-cluster.h | 7 + .../esp32/main/gen/attribute-id.h | 9 + .../esp32/main/gen/cluster-id.h | 3 + .../esp32/main/gen/print-cluster.h | 7 + examples/tv-app/tv-common/gen/attribute-id.h | 9 + examples/tv-app/tv-common/gen/cluster-id.h | 3 + examples/tv-app/tv-common/gen/print-cluster.h | 7 + examples/window-app/common/gen/attribute-id.h | 9 + examples/window-app/common/gen/cluster-id.h | 3 + .../window-app/common/gen/print-cluster.h | 7 + src/app/chip-zcl-zpro-codec-api.h | 114 +- src/app/encoder.cpp | 164 +- .../chip/python-CHIPClusters-cpp.zapt | 4 +- src/app/zap-templates/zcl/switch-cluster.xml | 34 + src/app/zap-templates/zcl/zcl.json | 1 + src/app/zap_cluster_list.py | 2 + src/controller/controller-clusters.zap | 169 +- .../python/chip/clusters/CHIPClusters.cpp | 2402 +++++++++++++++++ .../python/chip/clusters/CHIPClusters.py | 69 +- .../python/gen/CHIPClientCallbacks.cpp | 179 ++ .../python/gen/CHIPClientCallbacks.h | 10 + src/controller/python/gen/CHIPClusters.cpp | 1014 ++++++- src/controller/python/gen/CHIPClusters.h | 248 +- src/controller/python/gen/CHIPClustersObjc.h | 167 ++ src/controller/python/gen/CHIPClustersObjc.mm | 2303 +++++++++++++++- .../python/gen/IMClusterCommandHandler.cpp | 173 ++ src/controller/python/gen/attribute-id.h | 9 + .../python/gen/call-command-handler.cpp | 83 + src/controller/python/gen/callback-stub.cpp | 56 + src/controller/python/gen/callback.h | 567 ++++ src/controller/python/gen/cluster-id.h | 3 + src/controller/python/gen/endpoint_config.h | 96 +- src/controller/python/gen/gen_config.h | 35 + src/controller/python/gen/print-cluster.h | 7 + src/controller/python/local-clusters.zap | 1281 ++++++++- src/darwin/Framework/CHIP/chip-tool.zap | 504 +++- .../CHIP/gen/CHIPClientCallbacks.cpp | 15 + .../Framework/CHIP/gen/CHIPClientCallbacks.h | 2 + .../Framework/CHIP/gen/CHIPClusters.cpp | 432 +++ src/darwin/Framework/CHIP/gen/CHIPClusters.h | 135 +- .../Framework/CHIP/gen/CHIPClustersObjc.h | 77 + .../Framework/CHIP/gen/CHIPClustersObjc.mm | 1049 ++++++- .../CHIP/gen/IMClusterCommandHandler.cpp | 85 + src/darwin/Framework/CHIP/gen/attribute-id.h | 9 + .../CHIP/gen/call-command-handler.cpp | 35 + .../Framework/CHIP/gen/callback-stub.cpp | 24 + src/darwin/Framework/CHIP/gen/callback.h | 245 ++ src/darwin/Framework/CHIP/gen/cluster-id.h | 3 + .../Framework/CHIP/gen/endpoint_config.h | 55 +- src/darwin/Framework/CHIP/gen/gen_config.h | 15 + src/darwin/Framework/CHIP/gen/print-cluster.h | 7 + 83 files changed, 12401 insertions(+), 788 deletions(-) create mode 100644 src/app/zap-templates/zcl/switch-cluster.xml diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index 567be8a39725ab..889fbf7fe47506 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -1420,6 +1420,103 @@ } ] }, + { + "name": "Switch", + "code": 59, + "mfgCode": null, + "define": "SWITCH_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Switch", + "code": 59, + "mfgCode": null, + "define": "SWITCH_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "number of positions", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "current position", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "multi press max", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, { "name": "Operational Credentials", "code": 62, @@ -5216,6 +5313,103 @@ } ] }, + { + "name": "Switch", + "code": 59, + "mfgCode": null, + "define": "SWITCH_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Switch", + "code": 59, + "mfgCode": null, + "define": "SWITCH_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "number of positions", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "current position", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "multi press max", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, { "name": "Door Lock", "code": 257, @@ -7681,7 +7875,7 @@ "mfgCode": null, "define": "BINDING_CLUSTER", "side": "server", - "enabled": 0, + "enabled": 1, "commands": [], "attributes": [ { diff --git a/examples/all-clusters-app/all-clusters-common/gen/attribute-id.h b/examples/all-clusters-app/all-clusters-common/gen/attribute-id.h index 43d108726fe431..229d4014f4b1ba 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/attribute-id.h +++ b/examples/all-clusters-app/all-clusters-common/gen/attribute-id.h @@ -421,6 +421,15 @@ // Server attributes +// Attribute ids for cluster: Switch + +// Client attributes + +// Server attributes +#define ZCL_NUMBER_OF_POSITIONS_ATTRIBUTE_ID (0x0000) +#define ZCL_CURRENT_POSITION_ATTRIBUTE_ID (0x0001) +#define ZCL_MULTI_PRESS_MAX_ATTRIBUTE_ID (0x0002) + // Attribute ids for cluster: Operational Credentials // Client attributes diff --git a/examples/all-clusters-app/all-clusters-common/gen/call-command-handler.cpp b/examples/all-clusters-app/all-clusters-common/gen/call-command-handler.cpp index e5efb2e5bb095e..fb674c35bb7978 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/call-command-handler.cpp +++ b/examples/all-clusters-app/all-clusters-common/gen/call-command-handler.cpp @@ -48,6 +48,7 @@ EmberAfStatus emberAfOtaSoftwareUpdateServerClusterServerCommandParse(EmberAfClu EmberAfStatus emberAfOnOffClusterServerCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfOperationalCredentialsClusterServerCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfScenesClusterServerCommandParse(EmberAfClusterCommand * cmd); +EmberAfStatus emberAfSwitchClusterServerCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfTemperatureMeasurementClusterServerCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfThermostatClusterServerCommandParse(EmberAfClusterCommand * cmd); @@ -154,6 +155,10 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd) case ZCL_SCENES_CLUSTER_ID: result = emberAfScenesClusterServerCommandParse(cmd); break; + case ZCL_SWITCH_CLUSTER_ID: + // No commands are enabled for cluster Switch + result = status(false, true, cmd->mfgSpecific); + break; case ZCL_TEMP_MEASUREMENT_CLUSTER_ID: // No commands are enabled for cluster Temperature Measurement result = status(false, true, cmd->mfgSpecific); diff --git a/examples/all-clusters-app/all-clusters-common/gen/callback-stub.cpp b/examples/all-clusters-app/all-clusters-common/gen/callback-stub.cpp index 251784bd4bd60c..a57a4831208da6 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/callback-stub.cpp +++ b/examples/all-clusters-app/all-clusters-common/gen/callback-stub.cpp @@ -89,6 +89,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case ZCL_SCENES_CLUSTER_ID: emberAfScenesClusterInitCallback(endpoint); break; + case ZCL_SWITCH_CLUSTER_ID: + emberAfSwitchClusterInitCallback(endpoint); + break; case ZCL_TEMP_MEASUREMENT_CLUSTER_ID: emberAfTemperatureMeasurementClusterInitCallback(endpoint); break; @@ -201,6 +204,11 @@ void __attribute__((weak)) emberAfScenesClusterInitCallback(EndpointId endpoint) // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfSwitchClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfTemperatureMeasurementClusterInitCallback(EndpointId endpoint) { // To prevent warning diff --git a/examples/all-clusters-app/all-clusters-common/gen/callback.h b/examples/all-clusters-app/all-clusters-common/gen/callback.h index c530ab29c6fa6f..27f791f756a5da 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/callback.h +++ b/examples/all-clusters-app/all-clusters-common/gen/callback.h @@ -200,6 +200,14 @@ void emberAfOperationalCredentialsClusterInitCallback(chip::EndpointId endpoint) */ void emberAfScenesClusterInitCallback(chip::EndpointId endpoint); +/** @brief Switch Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfSwitchClusterInitCallback(chip::EndpointId endpoint); + /** @brief Temperature Measurement Cluster Init * * Cluster Init @@ -1622,6 +1630,76 @@ EmberAfStatus emberAfScenesClusterServerPreAttributeChangedCallback(chip::Endpoi */ void emberAfScenesClusterServerTickCallback(chip::EndpointId endpoint); +// +// Switch Cluster server +// + +/** @brief Switch Cluster Server Init + * + * Server Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfSwitchClusterServerInitCallback(chip::EndpointId endpoint); + +/** @brief Switch Cluster Server Attribute Changed + * + * Server Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + */ +void emberAfSwitchClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); + +/** @brief Switch Cluster Server Manufacturer Specific Attribute Changed + * + * Server Manufacturer Specific Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + * @param manufacturerCode Manufacturer Code of the attribute that changed + */ +void emberAfSwitchClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + uint16_t manufacturerCode); + +/** @brief Switch Cluster Server Message Sent + * + * Server Message Sent + * + * @param type The type of message sent + * @param indexOrDestination The destination or address to which the message was sent + * @param apsFrame The APS frame for the message + * @param msgLen The length of the message + * @param message The message that was sent + * @param status The status of the sent message + */ +void emberAfSwitchClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, + EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, + EmberStatus status); + +/** @brief Switch Cluster Server Pre Attribute Changed + * + * server Pre Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +EmberAfStatus emberAfSwitchClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, + EmberAfAttributeType attributeType, uint8_t size, + uint8_t * value); + +/** @brief Switch Cluster Server Tick + * + * server Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfSwitchClusterServerTickCallback(chip::EndpointId endpoint); + // // Temperature Measurement Cluster server // diff --git a/examples/all-clusters-app/all-clusters-common/gen/cluster-id.h b/examples/all-clusters-app/all-clusters-common/gen/cluster-id.h index 3aea880546f261..b8d9a9f7ed09bf 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/cluster-id.h +++ b/examples/all-clusters-app/all-clusters-common/gen/cluster-id.h @@ -98,6 +98,9 @@ // Definitions for cluster: Network Commissioning #define ZCL_NETWORK_COMMISSIONING_CLUSTER_ID (0x0031) +// Definitions for cluster: Switch +#define ZCL_SWITCH_CLUSTER_ID (0x003B) + // Definitions for cluster: Operational Credentials #define ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID (0x003E) diff --git a/examples/all-clusters-app/all-clusters-common/gen/endpoint_config.h b/examples/all-clusters-app/all-clusters-common/gen/endpoint_config.h index d65dc6b5d6b025..0d81f0dee7178c 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/endpoint_config.h +++ b/examples/all-clusters-app/all-clusters-common/gen/endpoint_config.h @@ -585,7 +585,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 135 +#define GENERATED_ATTRIBUTE_COUNT 139 #define GENERATED_ATTRIBUTES \ { \ \ @@ -669,6 +669,11 @@ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ /* Endpoint: 1, Cluster: OTA Software Update Client (server) */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ + \ + /* Endpoint: 1, Cluster: Switch (server) */ \ + { 0x0000, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(2) }, /* number of positions */ \ + { 0x0001, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* current position */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ /* Endpoint: 1, Cluster: Door Lock (server) */ \ @@ -777,6 +782,9 @@ { 0x0007, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* application satus */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ + /* Endpoint: 1, Cluster: Binding (server) */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ + \ /* Endpoint: 2, Cluster: On/off (server) */ \ { 0x0000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* on/off */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* cluster revision */ \ @@ -819,7 +827,7 @@ }; #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask -#define GENERATED_CLUSTER_COUNT 24 +#define GENERATED_CLUSTER_COUNT 26 #define GENERATED_CLUSTERS \ { \ { \ @@ -885,42 +893,46 @@ { \ 0x002A, ZAP_ATTRIBUTE_INDEX(47), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: OTA Software Update Client (server) */ \ + { 0x003B, ZAP_ATTRIBUTE_INDEX(48), 3, 4, ZAP_CLUSTER_MASK(SERVER), NULL }, /* Endpoint: 1, Cluster: Switch (server) */ \ { 0x0101, \ - ZAP_ATTRIBUTE_INDEX(48), \ + ZAP_ATTRIBUTE_INDEX(51), \ 4, \ 5, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ chipFuncArrayDoorLockServer }, /* Endpoint: 1, Cluster: Door Lock (server) */ \ { \ - 0x0103, ZAP_ATTRIBUTE_INDEX(52), 5, 7, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0103, ZAP_ATTRIBUTE_INDEX(55), 5, 7, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Barrier Control (server) */ \ { \ - 0x0201, ZAP_ATTRIBUTE_INDEX(57), 6, 10, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0201, ZAP_ATTRIBUTE_INDEX(60), 6, 10, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Thermostat (server) */ \ { 0x0300, \ - ZAP_ATTRIBUTE_INDEX(63), \ + ZAP_ATTRIBUTE_INDEX(66), \ 51, \ 336, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayColorControlServer }, /* Endpoint: 1, Cluster: Color Control (server) */ \ { \ - 0x0402, ZAP_ATTRIBUTE_INDEX(114), 4, 8, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0402, ZAP_ATTRIBUTE_INDEX(117), 4, 8, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Temperature Measurement (server) */ \ { 0x0500, \ - ZAP_ATTRIBUTE_INDEX(118), \ + ZAP_ATTRIBUTE_INDEX(121), \ 6, \ 16, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION) | \ ZAP_CLUSTER_MASK(MESSAGE_SENT_FUNCTION), \ chipFuncArrayIasZoneServer }, /* Endpoint: 1, Cluster: IAS Zone (server) */ \ { \ - 0x0508, ZAP_ATTRIBUTE_INDEX(124), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0508, ZAP_ATTRIBUTE_INDEX(127), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Low Power (server) */ \ { \ - 0x050D, ZAP_ATTRIBUTE_INDEX(125), 8, 105, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050D, ZAP_ATTRIBUTE_INDEX(128), 8, 105, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Application Basic (server) */ \ + { \ + 0xF000, ZAP_ATTRIBUTE_INDEX(136), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + }, /* Endpoint: 1, Cluster: Binding (server) */ \ { 0x0006, \ - ZAP_ATTRIBUTE_INDEX(133), \ + ZAP_ATTRIBUTE_INDEX(137), \ 2, \ 3, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -932,7 +944,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 7, 2060 }, { ZAP_CLUSTER_INDEX(7), 16, 1532 }, { ZAP_CLUSTER_INDEX(23), 1, 3 }, \ + { ZAP_CLUSTER_INDEX(0), 7, 2060 }, { ZAP_CLUSTER_INDEX(7), 18, 1538 }, { ZAP_CLUSTER_INDEX(25), 1, 3 }, \ } // Largest attribute size is needed for various buffers @@ -942,7 +954,7 @@ #define ATTRIBUTE_SINGLETONS_SIZE (254) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (3595) +#define ATTRIBUTE_MAX_SIZE (3601) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (3) @@ -986,7 +998,7 @@ // Array of EmberAfCommandMetadata structs. #define ZAP_COMMAND_MASK(mask) COMMAND_MASK_##mask -#define EMBER_AF_GENERATED_COMMAND_COUNT (131) +#define EMBER_AF_GENERATED_COMMAND_COUNT (133) #define GENERATED_COMMANDS \ { \ \ @@ -1155,6 +1167,10 @@ /* Endpoint: 1, Cluster: Low Power (server) */ \ { 0x0508, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Sleep */ \ \ + /* Endpoint: 1, Cluster: Binding (server) */ \ + { 0xF000, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Bind */ \ + { 0xF000, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Unbind */ \ + \ /* Endpoint: 2, Cluster: On/off (server) */ \ { 0x0006, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Off */ \ { 0x0006, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* On */ \ @@ -1191,10 +1207,10 @@ #define ZAP_REPORT_DIRECTION(x) ZRD(x) // User options for plugin Reporting -#define EMBER_AF_PLUGIN_REPORTING_TABLE_SIZE (11) +#define EMBER_AF_PLUGIN_REPORTING_TABLE_SIZE (12) #define EMBER_AF_PLUGIN_REPORTING_ENABLE_GROUP_BOUND_REPORTS -#define EMBER_AF_GENERATED_REPORTING_CONFIG_DEFAULTS_TABLE_SIZE (11) +#define EMBER_AF_GENERATED_REPORTING_CONFIG_DEFAULTS_TABLE_SIZE (12) #define EMBER_AF_GENERATED_REPORTING_CONFIG_DEFAULTS \ { \ \ @@ -1208,6 +1224,11 @@ ZAP_REPORT_DIRECTION(REPORTED), 0x0001, 0x0008, 0x0000, ZAP_CLUSTER_MASK(SERVER), 0x0000, { { 0, 65344, 0 } } \ }, /* current level */ \ \ + /* Endpoint: 1, Cluster: Switch (server) */ \ + { \ + ZAP_REPORT_DIRECTION(REPORTED), 0x0001, 0x003B, 0x0001, ZAP_CLUSTER_MASK(SERVER), 0x0000, { { 0, 65344, 0 } } \ + }, /* current position */ \ + \ /* Endpoint: 1, Cluster: Door Lock (server) */ \ { \ ZAP_REPORT_DIRECTION(REPORTED), 0x0001, 0x0101, 0x0000, ZAP_CLUSTER_MASK(SERVER), 0x0000, { { 0, 65344, 0 } } \ diff --git a/examples/all-clusters-app/all-clusters-common/gen/gen_config.h b/examples/all-clusters-app/all-clusters-common/gen/gen_config.h index 714ee1bee3a859..de22944acbe909 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/gen_config.h +++ b/examples/all-clusters-app/all-clusters-common/gen/gen_config.h @@ -32,7 +32,7 @@ #define EMBER_AF_APPLICATION_BASIC_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_BARRIER_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_BASIC_CLUSTER_SERVER_ENDPOINT_COUNT (1) -#define EMBER_AF_BINDING_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_BINDING_CLUSTER_SERVER_ENDPOINT_COUNT (2) #define EMBER_AF_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_DESCRIPTOR_CLUSTER_SERVER_ENDPOINT_COUNT (2) #define EMBER_AF_DOOR_LOCK_CLUSTER_SERVER_ENDPOINT_COUNT (1) @@ -49,6 +49,7 @@ #define EMBER_AF_ON_OFF_CLUSTER_SERVER_ENDPOINT_COUNT (2) #define EMBER_AF_OPERATIONAL_CREDENTIALS_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_SCENES_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_SWITCH_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_TEMP_MEASUREMENT_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT (1) @@ -166,6 +167,11 @@ // User options for server plugin Scenes #define EMBER_AF_PLUGIN_SCENES_TABLE_SIZE 3 +// Use this macro to check if the server side of the Switch cluster is included +#define ZCL_USING_SWITCH_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_SWITCH_SERVER +#define EMBER_AF_PLUGIN_SWITCH + // Use this macro to check if the server side of the Temperature Measurement cluster is included #define ZCL_USING_TEMP_MEASUREMENT_CLUSTER_SERVER #define EMBER_AF_PLUGIN_TEMPERATURE_MEASUREMENT_SERVER diff --git a/examples/all-clusters-app/all-clusters-common/gen/print-cluster.h b/examples/all-clusters-app/all-clusters-common/gen/print-cluster.h index 68d3e99e109b2b..9c879d94a9390d 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/print-cluster.h +++ b/examples/all-clusters-app/all-clusters-common/gen/print-cluster.h @@ -180,6 +180,12 @@ #define CHIP_PRINTCLUSTER_NETWORK_COMMISSIONING_CLUSTER #endif +#if defined(ZCL_USING_SWITCH_CLUSTER_SERVER) || defined(ZCL_USING_SWITCH_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_SWITCH_CLUSTER { ZCL_SWITCH_CLUSTER_ID, 59, "Switch" }, +#else +#define CHIP_PRINTCLUSTER_SWITCH_CLUSTER +#endif + #if defined(ZCL_USING_OPERATIONAL_CREDENTIALS_CLUSTER_SERVER) || defined(ZCL_USING_OPERATIONAL_CREDENTIALS_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_OPERATIONAL_CREDENTIALS_CLUSTER { ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID, 62, "Operational Credentials" }, #else @@ -894,6 +900,7 @@ CHIP_PRINTCLUSTER_OTA_CLIENT_CLUSTER \ CHIP_PRINTCLUSTER_GENERAL_COMMISSIONING_CLUSTER \ CHIP_PRINTCLUSTER_NETWORK_COMMISSIONING_CLUSTER \ + CHIP_PRINTCLUSTER_SWITCH_CLUSTER \ CHIP_PRINTCLUSTER_OPERATIONAL_CREDENTIALS_CLUSTER \ CHIP_PRINTCLUSTER_SHADE_CONFIG_CLUSTER \ CHIP_PRINTCLUSTER_DOOR_LOCK_CLUSTER \ diff --git a/examples/bridge-app/bridge-common/gen/attribute-id.h b/examples/bridge-app/bridge-common/gen/attribute-id.h index 43d108726fe431..229d4014f4b1ba 100644 --- a/examples/bridge-app/bridge-common/gen/attribute-id.h +++ b/examples/bridge-app/bridge-common/gen/attribute-id.h @@ -421,6 +421,15 @@ // Server attributes +// Attribute ids for cluster: Switch + +// Client attributes + +// Server attributes +#define ZCL_NUMBER_OF_POSITIONS_ATTRIBUTE_ID (0x0000) +#define ZCL_CURRENT_POSITION_ATTRIBUTE_ID (0x0001) +#define ZCL_MULTI_PRESS_MAX_ATTRIBUTE_ID (0x0002) + // Attribute ids for cluster: Operational Credentials // Client attributes diff --git a/examples/bridge-app/bridge-common/gen/cluster-id.h b/examples/bridge-app/bridge-common/gen/cluster-id.h index 3aea880546f261..b8d9a9f7ed09bf 100644 --- a/examples/bridge-app/bridge-common/gen/cluster-id.h +++ b/examples/bridge-app/bridge-common/gen/cluster-id.h @@ -98,6 +98,9 @@ // Definitions for cluster: Network Commissioning #define ZCL_NETWORK_COMMISSIONING_CLUSTER_ID (0x0031) +// Definitions for cluster: Switch +#define ZCL_SWITCH_CLUSTER_ID (0x003B) + // Definitions for cluster: Operational Credentials #define ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID (0x003E) diff --git a/examples/bridge-app/bridge-common/gen/print-cluster.h b/examples/bridge-app/bridge-common/gen/print-cluster.h index 68d3e99e109b2b..9c879d94a9390d 100644 --- a/examples/bridge-app/bridge-common/gen/print-cluster.h +++ b/examples/bridge-app/bridge-common/gen/print-cluster.h @@ -180,6 +180,12 @@ #define CHIP_PRINTCLUSTER_NETWORK_COMMISSIONING_CLUSTER #endif +#if defined(ZCL_USING_SWITCH_CLUSTER_SERVER) || defined(ZCL_USING_SWITCH_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_SWITCH_CLUSTER { ZCL_SWITCH_CLUSTER_ID, 59, "Switch" }, +#else +#define CHIP_PRINTCLUSTER_SWITCH_CLUSTER +#endif + #if defined(ZCL_USING_OPERATIONAL_CREDENTIALS_CLUSTER_SERVER) || defined(ZCL_USING_OPERATIONAL_CREDENTIALS_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_OPERATIONAL_CREDENTIALS_CLUSTER { ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID, 62, "Operational Credentials" }, #else @@ -894,6 +900,7 @@ CHIP_PRINTCLUSTER_OTA_CLIENT_CLUSTER \ CHIP_PRINTCLUSTER_GENERAL_COMMISSIONING_CLUSTER \ CHIP_PRINTCLUSTER_NETWORK_COMMISSIONING_CLUSTER \ + CHIP_PRINTCLUSTER_SWITCH_CLUSTER \ CHIP_PRINTCLUSTER_OPERATIONAL_CREDENTIALS_CLUSTER \ CHIP_PRINTCLUSTER_SHADE_CONFIG_CLUSTER \ CHIP_PRINTCLUSTER_DOOR_LOCK_CLUSTER \ diff --git a/examples/chip-tool/chip-tool.zap b/examples/chip-tool/chip-tool.zap index bfa6db2cdb0683..decc2bc70f5cc8 100644 --- a/examples/chip-tool/chip-tool.zap +++ b/examples/chip-tool/chip-tool.zap @@ -1510,6 +1510,103 @@ } ] }, + { + "name": "Switch", + "code": 59, + "mfgCode": null, + "define": "SWITCH_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Switch", + "code": 59, + "mfgCode": null, + "define": "SWITCH_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "number of positions", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "current position", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "multi press max", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, { "name": "Operational Credentials", "code": 62, @@ -2598,73 +2695,6 @@ } ] }, - { - "name": "Thermostat", - "code": 513, - "mfgCode": null, - "define": "THERMOSTAT_CLUSTER", - "side": "client", - "enabled": 1, - "commands": [ - { - "name": "SetpointRaiseLower", - "code": 0, - "mfgCode": null, - "source": "client", - "incoming": 0, - "outgoing": 1 - }, - { - "name": "SetWeeklySchedule", - "code": 1, - "mfgCode": null, - "source": "client", - "incoming": 0, - "outgoing": 1 - }, - { - "name": "GetWeeklySchedule", - "code": 2, - "mfgCode": null, - "source": "client", - "incoming": 0, - "outgoing": 1 - }, - { - "name": "ClearWeeklySchedule", - "code": 3, - "mfgCode": null, - "source": "client", - "incoming": 0, - "outgoing": 1 - }, - { - "name": "GetRelayStatusLog", - "code": 4, - "mfgCode": null, - "source": "client", - "incoming": 0, - "outgoing": 1 - } - ], - "attributes": [ - { - "name": "cluster revision", - "code": 65533, - "mfgCode": null, - "side": "client", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "3", - "reportable": 0, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - } - ] - }, { "name": "Pump Configuration and Control", "code": 512, @@ -2700,21 +2730,6 @@ "enabled": 0, "commands": [], "attributes": [ - { - "name": "cluster revision", - "code": 65533, - "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0001", - "reportable": 0, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, { "name": "max pressure", "code": 0, @@ -2834,6 +2849,88 @@ "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Thermostat", + "code": 513, + "mfgCode": null, + "define": "THERMOSTAT_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [ + { + "name": "SetpointRaiseLower", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "SetWeeklySchedule", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "GetWeeklySchedule", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "ClearWeeklySchedule", + "code": 3, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "GetRelayStatusLog", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 } ] }, diff --git a/examples/chip-tool/commands/clusters/Commands.h b/examples/chip-tool/commands/clusters/Commands.h index a3fb53168c242c..da27e2a21c7920 100644 --- a/examples/chip-tool/commands/clusters/Commands.h +++ b/examples/chip-tool/commands/clusters/Commands.h @@ -608,6 +608,7 @@ static void OnOperationalCredentialsFabricsListListAttributeResponse(void * cont | OperationalCredentials | 0x003E | | PumpConfigurationAndControl | 0x0200 | | Scenes | 0x0005 | +| Switch | 0x003B | | TemperatureMeasurement | 0x0402 | | Thermostat | 0x0201 | \*----------------------------------------------------------------------------*/ @@ -630,6 +631,7 @@ constexpr chip::ClusterId kOnOffClusterId = 0x0006; constexpr chip::ClusterId kOperationalCredentialsClusterId = 0x003E; constexpr chip::ClusterId kPumpConfigurationAndControlClusterId = 0x0200; constexpr chip::ClusterId kScenesClusterId = 0x0005; +constexpr chip::ClusterId kSwitchClusterId = 0x003B; constexpr chip::ClusterId kTemperatureMeasurementClusterId = 0x0402; constexpr chip::ClusterId kThermostatClusterId = 0x0201; @@ -9936,6 +9938,197 @@ class ReadScenesClusterRevision : public ModelCommand new chip::Callback::Callback(OnDefaultFailureResponse, this); }; +/*----------------------------------------------------------------------------*\ +| Cluster Switch | 0x003B | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * NumberOfPositions | 0x0000 | +| * CurrentPosition | 0x0001 | +| * ClusterRevision | 0xFFFD | +\*----------------------------------------------------------------------------*/ + +/* + * Discover Attributes + */ +class DiscoverSwitchAttributes : public ModelCommand +{ +public: + DiscoverSwitchAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); } + + ~DiscoverSwitchAttributes() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x0C) on endpoint %" PRIu16, endpointId); + + chip::Controller::SwitchCluster cluster; + cluster.Associate(device, endpointId); + return cluster.DiscoverAttributes(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +/* + * Attribute NumberOfPositions + */ +class ReadSwitchNumberOfPositions : public ModelCommand +{ +public: + ReadSwitchNumberOfPositions() : ModelCommand("read") + { + AddArgument("attr-name", "number-of-positions"); + ModelCommand::AddArguments(); + } + + ~ReadSwitchNumberOfPositions() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x003B) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::SwitchCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributeNumberOfPositions(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt8uAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +/* + * Attribute CurrentPosition + */ +class ReadSwitchCurrentPosition : public ModelCommand +{ +public: + ReadSwitchCurrentPosition() : ModelCommand("read") + { + AddArgument("attr-name", "current-position"); + ModelCommand::AddArguments(); + } + + ~ReadSwitchCurrentPosition() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x003B) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::SwitchCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributeCurrentPosition(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt8uAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class ReportSwitchCurrentPosition : public ModelCommand +{ +public: + ReportSwitchCurrentPosition() : ModelCommand("report") + { + AddArgument("attr-name", "current-position"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("change", 0, UINT8_MAX, &mChange); + ModelCommand::AddArguments(); + } + + ~ReportSwitchCurrentPosition() + { + delete onSuccessCallback; + delete onFailureCallback; + delete onReportCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x003B) command (0x06) on endpoint %" PRIu16, endpointId); + + chip::Controller::SwitchCluster cluster; + cluster.Associate(device, endpointId); + + CHIP_ERROR err = cluster.ReportAttributeCurrentPosition(onReportCallback->Cancel()); + if (err != CHIP_NO_ERROR) + { + return err; + } + + return cluster.ConfigureAttributeCurrentPosition(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, + mMaxInterval, mChange); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + chip::Callback::Callback * onReportCallback = + new chip::Callback::Callback(OnInt8uAttributeResponse, this); + uint16_t mMinInterval; + uint16_t mMaxInterval; + uint8_t mChange; +}; + +/* + * Attribute ClusterRevision + */ +class ReadSwitchClusterRevision : public ModelCommand +{ +public: + ReadSwitchClusterRevision() : ModelCommand("read") + { + AddArgument("attr-name", "cluster-revision"); + ModelCommand::AddArguments(); + } + + ~ReadSwitchClusterRevision() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x003B) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::SwitchCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributeClusterRevision(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt16uAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + /*----------------------------------------------------------------------------*\ | Cluster TemperatureMeasurement | 0x0402 | |------------------------------------------------------------------------------| @@ -11155,6 +11348,18 @@ void registerClusterScenes(Commands & commands) commands.Register(clusterName, clusterCommands); } +void registerClusterSwitch(Commands & commands) +{ + const char * clusterName = "Switch"; + + commands_list clusterCommands = { + make_unique(), make_unique(), + make_unique(), make_unique(), + make_unique(), + }; + + commands.Register(clusterName, clusterCommands); +} void registerClusterTemperatureMeasurement(Commands & commands) { const char * clusterName = "TemperatureMeasurement"; @@ -11214,6 +11419,7 @@ void registerClusters(Commands & commands) registerClusterOperationalCredentials(commands); registerClusterPumpConfigurationAndControl(commands); registerClusterScenes(commands); + registerClusterSwitch(commands); registerClusterTemperatureMeasurement(commands); registerClusterThermostat(commands); } diff --git a/examples/chip-tool/commands/reporting/Commands.h b/examples/chip-tool/commands/reporting/Commands.h index 96a8247d8bb3ce..24d2cefba32623 100644 --- a/examples/chip-tool/commands/reporting/Commands.h +++ b/examples/chip-tool/commands/reporting/Commands.h @@ -39,6 +39,7 @@ class Listen : public ReportingCommand delete onReportLevelControlCurrentLevelCallback; delete onReportOnOffOnOffCallback; delete onReportPumpConfigurationAndControlCapacityCallback; + delete onReportSwitchCurrentPositionCallback; delete onReportTemperatureMeasurementMeasuredValueCallback; delete onReportThermostatLocalTemperatureCallback; } @@ -63,6 +64,8 @@ class Listen : public ReportingCommand callbacksMgr.AddReportCallback(chip::kTestDeviceNodeId, endpointId, 0x0006, 0x0000, onReportOnOffOnOffCallback->Cancel()); callbacksMgr.AddReportCallback(chip::kTestDeviceNodeId, endpointId, 0x0200, 0x0013, onReportPumpConfigurationAndControlCapacityCallback->Cancel()); + callbacksMgr.AddReportCallback(chip::kTestDeviceNodeId, endpointId, 0x003B, 0x0001, + onReportSwitchCurrentPositionCallback->Cancel()); callbacksMgr.AddReportCallback(chip::kTestDeviceNodeId, endpointId, 0x0402, 0x0000, onReportTemperatureMeasurementMeasuredValueCallback->Cancel()); callbacksMgr.AddReportCallback(chip::kTestDeviceNodeId, endpointId, 0x0201, 0x0000, @@ -120,6 +123,8 @@ class Listen : public ReportingCommand new chip::Callback::Callback(OnBooleanAttributeResponse, this); chip::Callback::Callback * onReportPumpConfigurationAndControlCapacityCallback = new chip::Callback::Callback(OnInt16sAttributeResponse, this); + chip::Callback::Callback * onReportSwitchCurrentPositionCallback = + new chip::Callback::Callback(OnInt8uAttributeResponse, this); chip::Callback::Callback * onReportTemperatureMeasurementMeasuredValueCallback = new chip::Callback::Callback(OnInt16sAttributeResponse, this); chip::Callback::Callback * onReportThermostatLocalTemperatureCallback = diff --git a/examples/chip-tool/gen/CHIPClusters.cpp b/examples/chip-tool/gen/CHIPClusters.cpp index 86c0da84bbd41c..a5db71393871a4 100644 --- a/examples/chip-tool/gen/CHIPClusters.cpp +++ b/examples/chip-tool/gen/CHIPClusters.cpp @@ -4205,6 +4205,53 @@ CHIP_ERROR ScenesCluster::ReadAttributeClusterRevision(Callback::Cancelable * on return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); } +// Switch Cluster Commands +// Switch Cluster Attributes +CHIP_ERROR SwitchCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeSwitchClusterDiscoverAttributes(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} +CHIP_ERROR SwitchCluster::ReadAttributeNumberOfPositions(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeSwitchClusterReadNumberOfPositionsAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR SwitchCluster::ReadAttributeCurrentPosition(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeSwitchClusterReadCurrentPositionAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR SwitchCluster::ConfigureAttributeCurrentPosition(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t minInterval, + uint16_t maxInterval, uint8_t change) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodeSwitchClusterConfigureCurrentPositionAttribute(seqNum, mEndpoint, minInterval, maxInterval, change); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR SwitchCluster::ReportAttributeCurrentPosition(Callback::Cancelable * onReportCallback) +{ + return RequestAttributeReporting(0x0001, onReportCallback); +} + +CHIP_ERROR SwitchCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeSwitchClusterReadClusterRevisionAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + // TemperatureMeasurement Cluster Commands // TemperatureMeasurement Cluster Attributes CHIP_ERROR TemperatureMeasurementCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback, diff --git a/examples/chip-tool/gen/CHIPClusters.h b/examples/chip-tool/gen/CHIPClusters.h index bcdc4e9c1426b1..751c92ab71403b 100644 --- a/examples/chip-tool/gen/CHIPClusters.h +++ b/examples/chip-tool/gen/CHIPClusters.h @@ -45,6 +45,7 @@ constexpr ClusterId kOnOffClusterId = 0x0006; constexpr ClusterId kOperationalCredentialsClusterId = 0x003E; constexpr ClusterId kPumpConfigurationAndControlClusterId = 0x0200; constexpr ClusterId kScenesClusterId = 0x0005; +constexpr ClusterId kSwitchClusterId = 0x003B; constexpr ClusterId kTemperatureMeasurementClusterId = 0x0402; constexpr ClusterId kThermostatClusterId = 0x0201; @@ -722,6 +723,22 @@ class DLL_EXPORT ScenesCluster : public ClusterBase static constexpr CommandId kViewSceneCommandId = 0x01; }; +class DLL_EXPORT SwitchCluster : public ClusterBase +{ +public: + SwitchCluster() : ClusterBase(kSwitchClusterId) {} + ~SwitchCluster() {} + + // Cluster Attributes + CHIP_ERROR DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeNumberOfPositions(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeCurrentPosition(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ConfigureAttributeCurrentPosition(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t minInterval, uint16_t maxInterval, uint8_t change); + CHIP_ERROR ReportAttributeCurrentPosition(Callback::Cancelable * onReportCallback); +}; + class DLL_EXPORT TemperatureMeasurementCluster : public ClusterBase { public: diff --git a/examples/chip-tool/gen/CHIPClustersObjc.h b/examples/chip-tool/gen/CHIPClustersObjc.h index e5e6696ee1e8cc..c4ca0d9d92515b 100644 --- a/examples/chip-tool/gen/CHIPClustersObjc.h +++ b/examples/chip-tool/gen/CHIPClustersObjc.h @@ -650,6 +650,23 @@ NS_ASSUME_NONNULL_BEGIN @end +/** + * Cluster Switch + * + */ +@interface CHIPSwitch : CHIPCluster + +- (void)readAttributeNumberOfPositions:(ResponseHandler)completionHandler; +- (void)readAttributeCurrentPosition:(ResponseHandler)completionHandler; +- (void)configureAttributeCurrentPosition:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + change:(uint8_t)change + completionHandler:(ResponseHandler)completionHandler; +- (void)reportAttributeCurrentPosition:(ResponseHandler)reportHandler; +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler; + +@end + /** * Cluster Temperature Measurement * diff --git a/examples/chip-tool/gen/CHIPClustersObjc.mm b/examples/chip-tool/gen/CHIPClustersObjc.mm index 51a04fe3ca0b67..8d02f574aea3b6 100644 --- a/examples/chip-tool/gen/CHIPClustersObjc.mm +++ b/examples/chip-tool/gen/CHIPClustersObjc.mm @@ -8261,6 +8261,130 @@ - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler @end +@interface CHIPSwitch () +@property (readonly) Controller::SwitchCluster cppCluster; +@end + +@implementation CHIPSwitch + +- (Controller::ClusterBase *)getCluster +{ + return &_cppCluster; +} + +- (void)readAttributeNumberOfPositions:(ResponseHandler)completionHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeNumberOfPositions(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeCurrentPosition:(ResponseHandler)completionHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentPosition(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)configureAttributeCurrentPosition:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + change:(uint8_t)change + completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ConfigureAttributeCurrentPosition( + onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)reportAttributeCurrentPosition:(ResponseHandler)reportHandler +{ + CHIPInt8uAttributeCallbackBridge * onReport = new CHIPInt8uAttributeCallbackBridge(reportHandler, [self callbackQueue], true); + if (!onReport) { + reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReportAttributeCurrentPosition(onReport->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onReport; + reportHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +@end + @interface CHIPTemperatureMeasurement () @property (readonly) Controller::TemperatureMeasurementCluster cppCluster; @end diff --git a/examples/chip-tool/gen/attribute-id.h b/examples/chip-tool/gen/attribute-id.h index 43d108726fe431..229d4014f4b1ba 100644 --- a/examples/chip-tool/gen/attribute-id.h +++ b/examples/chip-tool/gen/attribute-id.h @@ -421,6 +421,15 @@ // Server attributes +// Attribute ids for cluster: Switch + +// Client attributes + +// Server attributes +#define ZCL_NUMBER_OF_POSITIONS_ATTRIBUTE_ID (0x0000) +#define ZCL_CURRENT_POSITION_ATTRIBUTE_ID (0x0001) +#define ZCL_MULTI_PRESS_MAX_ATTRIBUTE_ID (0x0002) + // Attribute ids for cluster: Operational Credentials // Client attributes diff --git a/examples/chip-tool/gen/call-command-handler.cpp b/examples/chip-tool/gen/call-command-handler.cpp index 3446f7088d5400..8444c3e05ff17f 100644 --- a/examples/chip-tool/gen/call-command-handler.cpp +++ b/examples/chip-tool/gen/call-command-handler.cpp @@ -46,6 +46,7 @@ EmberAfStatus emberAfOnOffClusterClientCommandParse(EmberAfClusterCommand * cmd) EmberAfStatus emberAfOperationalCredentialsClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfPumpConfigurationAndControlClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfScenesClusterClientCommandParse(EmberAfClusterCommand * cmd); +EmberAfStatus emberAfSwitchClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfTemperatureMeasurementClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfThermostatClusterClientCommandParse(EmberAfClusterCommand * cmd); @@ -143,6 +144,10 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd) case ZCL_SCENES_CLUSTER_ID: result = emberAfScenesClusterClientCommandParse(cmd); break; + case ZCL_SWITCH_CLUSTER_ID: + // No commands are enabled for cluster Switch + result = status(false, true, cmd->mfgSpecific); + break; case ZCL_TEMP_MEASUREMENT_CLUSTER_ID: // No commands are enabled for cluster Temperature Measurement result = status(false, true, cmd->mfgSpecific); diff --git a/examples/chip-tool/gen/callback-stub.cpp b/examples/chip-tool/gen/callback-stub.cpp index 1384fee99bd7a2..33666ecc7a520a 100644 --- a/examples/chip-tool/gen/callback-stub.cpp +++ b/examples/chip-tool/gen/callback-stub.cpp @@ -83,6 +83,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case ZCL_SCENES_CLUSTER_ID: emberAfScenesClusterInitCallback(endpoint); break; + case ZCL_SWITCH_CLUSTER_ID: + emberAfSwitchClusterInitCallback(endpoint); + break; case ZCL_TEMP_MEASUREMENT_CLUSTER_ID: emberAfTemperatureMeasurementClusterInitCallback(endpoint); break; @@ -185,6 +188,11 @@ void __attribute__((weak)) emberAfScenesClusterInitCallback(EndpointId endpoint) // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfSwitchClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfTemperatureMeasurementClusterInitCallback(EndpointId endpoint) { // To prevent warning diff --git a/examples/chip-tool/gen/callback.h b/examples/chip-tool/gen/callback.h index 52da9c9c09f403..0b3b59cb0f9dd7 100644 --- a/examples/chip-tool/gen/callback.h +++ b/examples/chip-tool/gen/callback.h @@ -184,6 +184,14 @@ void emberAfPumpConfigurationAndControlClusterInitCallback(chip::EndpointId endp */ void emberAfScenesClusterInitCallback(chip::EndpointId endpoint); +/** @brief Switch Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfSwitchClusterInitCallback(chip::EndpointId endpoint); + /** @brief Temperature Measurement Cluster Init * * Cluster Init @@ -1466,6 +1474,76 @@ EmberAfStatus emberAfScenesClusterClientPreAttributeChangedCallback(chip::Endpoi */ void emberAfScenesClusterClientTickCallback(chip::EndpointId endpoint); +// +// Switch Cluster client +// + +/** @brief Switch Cluster Client Init + * + * Client Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfSwitchClusterClientInitCallback(chip::EndpointId endpoint); + +/** @brief Switch Cluster Client Attribute Changed + * + * Client Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + */ +void emberAfSwitchClusterClientAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); + +/** @brief Switch Cluster Client Manufacturer Specific Attribute Changed + * + * Client Manufacturer Specific Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + * @param manufacturerCode Manufacturer Code of the attribute that changed + */ +void emberAfSwitchClusterClientManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + uint16_t manufacturerCode); + +/** @brief Switch Cluster Client Message Sent + * + * Client Message Sent + * + * @param type The type of message sent + * @param indexOrDestination The destination or address to which the message was sent + * @param apsFrame The APS frame for the message + * @param msgLen The length of the message + * @param message The message that was sent + * @param status The status of the sent message + */ +void emberAfSwitchClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, + EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, + EmberStatus status); + +/** @brief Switch Cluster Client Pre Attribute Changed + * + * client Pre Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +EmberAfStatus emberAfSwitchClusterClientPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, + EmberAfAttributeType attributeType, uint8_t size, + uint8_t * value); + +/** @brief Switch Cluster Client Tick + * + * client Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfSwitchClusterClientTickCallback(chip::EndpointId endpoint); + // // Temperature Measurement Cluster client // diff --git a/examples/chip-tool/gen/cluster-id.h b/examples/chip-tool/gen/cluster-id.h index 3aea880546f261..b8d9a9f7ed09bf 100644 --- a/examples/chip-tool/gen/cluster-id.h +++ b/examples/chip-tool/gen/cluster-id.h @@ -98,6 +98,9 @@ // Definitions for cluster: Network Commissioning #define ZCL_NETWORK_COMMISSIONING_CLUSTER_ID (0x0031) +// Definitions for cluster: Switch +#define ZCL_SWITCH_CLUSTER_ID (0x003B) + // Definitions for cluster: Operational Credentials #define ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID (0x003E) diff --git a/examples/chip-tool/gen/endpoint_config.h b/examples/chip-tool/gen/endpoint_config.h index f860cb75f0797e..5d7aa618a861c8 100644 --- a/examples/chip-tool/gen/endpoint_config.h +++ b/examples/chip-tool/gen/endpoint_config.h @@ -63,7 +63,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 20 +#define GENERATED_ATTRIBUTE_COUNT 21 #define GENERATED_ATTRIBUTES \ { \ \ @@ -93,6 +93,9 @@ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ /* Endpoint: 1, Cluster: Network Commissioning (client) */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ + \ + /* Endpoint: 1, Cluster: Switch (client) */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ /* Endpoint: 1, Cluster: Operational Credentials (client) */ \ @@ -136,7 +139,7 @@ #define GENERATED_FUNCTION_ARRAYS #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask -#define GENERATED_CLUSTER_COUNT 20 +#define GENERATED_CLUSTER_COUNT 21 #define GENERATED_CLUSTERS \ { \ { 0x0003, ZAP_ATTRIBUTE_INDEX(0), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Identify (client) */ \ @@ -156,38 +159,39 @@ { \ 0x0031, ZAP_ATTRIBUTE_INDEX(8), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Network Commissioning (client) */ \ + { 0x003B, ZAP_ATTRIBUTE_INDEX(9), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Switch (client) */ \ { \ - 0x003E, ZAP_ATTRIBUTE_INDEX(9), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x003E, ZAP_ATTRIBUTE_INDEX(10), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Operational Credentials (client) */ \ { \ - 0x0101, ZAP_ATTRIBUTE_INDEX(10), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0101, ZAP_ATTRIBUTE_INDEX(11), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Door Lock (client) */ \ { \ - 0x0103, ZAP_ATTRIBUTE_INDEX(11), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0103, ZAP_ATTRIBUTE_INDEX(12), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Barrier Control (client) */ \ { \ - 0x0200, ZAP_ATTRIBUTE_INDEX(12), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0200, ZAP_ATTRIBUTE_INDEX(13), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Pump Configuration and Control (client) */ \ { \ - 0x0201, ZAP_ATTRIBUTE_INDEX(13), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0201, ZAP_ATTRIBUTE_INDEX(14), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Thermostat (client) */ \ { \ - 0x0300, ZAP_ATTRIBUTE_INDEX(14), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0300, ZAP_ATTRIBUTE_INDEX(15), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Color Control (client) */ \ { \ - 0x0402, ZAP_ATTRIBUTE_INDEX(15), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0402, ZAP_ATTRIBUTE_INDEX(16), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Temperature Measurement (client) */ \ { \ - 0x0508, ZAP_ATTRIBUTE_INDEX(16), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0508, ZAP_ATTRIBUTE_INDEX(17), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Low Power (client) */ \ { \ - 0x050D, ZAP_ATTRIBUTE_INDEX(17), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x050D, ZAP_ATTRIBUTE_INDEX(18), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Application Basic (client) */ \ { \ - 0xF000, ZAP_ATTRIBUTE_INDEX(18), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0xF000, ZAP_ATTRIBUTE_INDEX(19), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Binding (client) */ \ { \ - 0xF004, ZAP_ATTRIBUTE_INDEX(19), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0xF004, ZAP_ATTRIBUTE_INDEX(20), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Group Key Management (client) */ \ } @@ -196,7 +200,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 20, 40 }, \ + { ZAP_CLUSTER_INDEX(0), 21, 42 }, \ } // Largest attribute size is needed for various buffers @@ -206,7 +210,7 @@ #define ATTRIBUTE_SINGLETONS_SIZE (2) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (40) +#define ATTRIBUTE_MAX_SIZE (42) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (1) diff --git a/examples/chip-tool/gen/gen_config.h b/examples/chip-tool/gen/gen_config.h index 753ab2b20aedfb..e0854ebb074057 100644 --- a/examples/chip-tool/gen/gen_config.h +++ b/examples/chip-tool/gen/gen_config.h @@ -47,6 +47,7 @@ #define EMBER_AF_OPERATIONAL_CREDENTIALS_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_PUMP_CONFIG_CONTROL_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_SCENES_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_SWITCH_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_TEMP_MEASUREMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_THERMOSTAT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) @@ -124,6 +125,10 @@ #define ZCL_USING_SCENES_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_SCENES_CLIENT +// Use this macro to check if the client side of the Switch cluster is included +#define ZCL_USING_SWITCH_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_SWITCH_CLIENT + // Use this macro to check if the client side of the Temperature Measurement cluster is included #define ZCL_USING_TEMP_MEASUREMENT_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_TEMPERATURE_MEASUREMENT_CLIENT diff --git a/examples/chip-tool/gen/print-cluster.h b/examples/chip-tool/gen/print-cluster.h index 68d3e99e109b2b..9c879d94a9390d 100644 --- a/examples/chip-tool/gen/print-cluster.h +++ b/examples/chip-tool/gen/print-cluster.h @@ -180,6 +180,12 @@ #define CHIP_PRINTCLUSTER_NETWORK_COMMISSIONING_CLUSTER #endif +#if defined(ZCL_USING_SWITCH_CLUSTER_SERVER) || defined(ZCL_USING_SWITCH_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_SWITCH_CLUSTER { ZCL_SWITCH_CLUSTER_ID, 59, "Switch" }, +#else +#define CHIP_PRINTCLUSTER_SWITCH_CLUSTER +#endif + #if defined(ZCL_USING_OPERATIONAL_CREDENTIALS_CLUSTER_SERVER) || defined(ZCL_USING_OPERATIONAL_CREDENTIALS_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_OPERATIONAL_CREDENTIALS_CLUSTER { ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID, 62, "Operational Credentials" }, #else @@ -894,6 +900,7 @@ CHIP_PRINTCLUSTER_OTA_CLIENT_CLUSTER \ CHIP_PRINTCLUSTER_GENERAL_COMMISSIONING_CLUSTER \ CHIP_PRINTCLUSTER_NETWORK_COMMISSIONING_CLUSTER \ + CHIP_PRINTCLUSTER_SWITCH_CLUSTER \ CHIP_PRINTCLUSTER_OPERATIONAL_CREDENTIALS_CLUSTER \ CHIP_PRINTCLUSTER_SHADE_CONFIG_CLUSTER \ CHIP_PRINTCLUSTER_DOOR_LOCK_CLUSTER \ diff --git a/examples/lighting-app/lighting-common/gen/attribute-id.h b/examples/lighting-app/lighting-common/gen/attribute-id.h index 43d108726fe431..229d4014f4b1ba 100644 --- a/examples/lighting-app/lighting-common/gen/attribute-id.h +++ b/examples/lighting-app/lighting-common/gen/attribute-id.h @@ -421,6 +421,15 @@ // Server attributes +// Attribute ids for cluster: Switch + +// Client attributes + +// Server attributes +#define ZCL_NUMBER_OF_POSITIONS_ATTRIBUTE_ID (0x0000) +#define ZCL_CURRENT_POSITION_ATTRIBUTE_ID (0x0001) +#define ZCL_MULTI_PRESS_MAX_ATTRIBUTE_ID (0x0002) + // Attribute ids for cluster: Operational Credentials // Client attributes diff --git a/examples/lighting-app/lighting-common/gen/cluster-id.h b/examples/lighting-app/lighting-common/gen/cluster-id.h index 3aea880546f261..b8d9a9f7ed09bf 100644 --- a/examples/lighting-app/lighting-common/gen/cluster-id.h +++ b/examples/lighting-app/lighting-common/gen/cluster-id.h @@ -98,6 +98,9 @@ // Definitions for cluster: Network Commissioning #define ZCL_NETWORK_COMMISSIONING_CLUSTER_ID (0x0031) +// Definitions for cluster: Switch +#define ZCL_SWITCH_CLUSTER_ID (0x003B) + // Definitions for cluster: Operational Credentials #define ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID (0x003E) diff --git a/examples/lighting-app/lighting-common/gen/print-cluster.h b/examples/lighting-app/lighting-common/gen/print-cluster.h index 68d3e99e109b2b..9c879d94a9390d 100644 --- a/examples/lighting-app/lighting-common/gen/print-cluster.h +++ b/examples/lighting-app/lighting-common/gen/print-cluster.h @@ -180,6 +180,12 @@ #define CHIP_PRINTCLUSTER_NETWORK_COMMISSIONING_CLUSTER #endif +#if defined(ZCL_USING_SWITCH_CLUSTER_SERVER) || defined(ZCL_USING_SWITCH_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_SWITCH_CLUSTER { ZCL_SWITCH_CLUSTER_ID, 59, "Switch" }, +#else +#define CHIP_PRINTCLUSTER_SWITCH_CLUSTER +#endif + #if defined(ZCL_USING_OPERATIONAL_CREDENTIALS_CLUSTER_SERVER) || defined(ZCL_USING_OPERATIONAL_CREDENTIALS_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_OPERATIONAL_CREDENTIALS_CLUSTER { ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID, 62, "Operational Credentials" }, #else @@ -894,6 +900,7 @@ CHIP_PRINTCLUSTER_OTA_CLIENT_CLUSTER \ CHIP_PRINTCLUSTER_GENERAL_COMMISSIONING_CLUSTER \ CHIP_PRINTCLUSTER_NETWORK_COMMISSIONING_CLUSTER \ + CHIP_PRINTCLUSTER_SWITCH_CLUSTER \ CHIP_PRINTCLUSTER_OPERATIONAL_CREDENTIALS_CLUSTER \ CHIP_PRINTCLUSTER_SHADE_CONFIG_CLUSTER \ CHIP_PRINTCLUSTER_DOOR_LOCK_CLUSTER \ diff --git a/examples/lock-app/lock-common/gen/attribute-id.h b/examples/lock-app/lock-common/gen/attribute-id.h index 43d108726fe431..229d4014f4b1ba 100644 --- a/examples/lock-app/lock-common/gen/attribute-id.h +++ b/examples/lock-app/lock-common/gen/attribute-id.h @@ -421,6 +421,15 @@ // Server attributes +// Attribute ids for cluster: Switch + +// Client attributes + +// Server attributes +#define ZCL_NUMBER_OF_POSITIONS_ATTRIBUTE_ID (0x0000) +#define ZCL_CURRENT_POSITION_ATTRIBUTE_ID (0x0001) +#define ZCL_MULTI_PRESS_MAX_ATTRIBUTE_ID (0x0002) + // Attribute ids for cluster: Operational Credentials // Client attributes diff --git a/examples/lock-app/lock-common/gen/cluster-id.h b/examples/lock-app/lock-common/gen/cluster-id.h index 3aea880546f261..b8d9a9f7ed09bf 100644 --- a/examples/lock-app/lock-common/gen/cluster-id.h +++ b/examples/lock-app/lock-common/gen/cluster-id.h @@ -98,6 +98,9 @@ // Definitions for cluster: Network Commissioning #define ZCL_NETWORK_COMMISSIONING_CLUSTER_ID (0x0031) +// Definitions for cluster: Switch +#define ZCL_SWITCH_CLUSTER_ID (0x003B) + // Definitions for cluster: Operational Credentials #define ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID (0x003E) diff --git a/examples/lock-app/lock-common/gen/print-cluster.h b/examples/lock-app/lock-common/gen/print-cluster.h index 68d3e99e109b2b..9c879d94a9390d 100644 --- a/examples/lock-app/lock-common/gen/print-cluster.h +++ b/examples/lock-app/lock-common/gen/print-cluster.h @@ -180,6 +180,12 @@ #define CHIP_PRINTCLUSTER_NETWORK_COMMISSIONING_CLUSTER #endif +#if defined(ZCL_USING_SWITCH_CLUSTER_SERVER) || defined(ZCL_USING_SWITCH_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_SWITCH_CLUSTER { ZCL_SWITCH_CLUSTER_ID, 59, "Switch" }, +#else +#define CHIP_PRINTCLUSTER_SWITCH_CLUSTER +#endif + #if defined(ZCL_USING_OPERATIONAL_CREDENTIALS_CLUSTER_SERVER) || defined(ZCL_USING_OPERATIONAL_CREDENTIALS_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_OPERATIONAL_CREDENTIALS_CLUSTER { ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID, 62, "Operational Credentials" }, #else @@ -894,6 +900,7 @@ CHIP_PRINTCLUSTER_OTA_CLIENT_CLUSTER \ CHIP_PRINTCLUSTER_GENERAL_COMMISSIONING_CLUSTER \ CHIP_PRINTCLUSTER_NETWORK_COMMISSIONING_CLUSTER \ + CHIP_PRINTCLUSTER_SWITCH_CLUSTER \ CHIP_PRINTCLUSTER_OPERATIONAL_CREDENTIALS_CLUSTER \ CHIP_PRINTCLUSTER_SHADE_CONFIG_CLUSTER \ CHIP_PRINTCLUSTER_DOOR_LOCK_CLUSTER \ diff --git a/examples/temperature-measurement-app/esp32/main/gen/attribute-id.h b/examples/temperature-measurement-app/esp32/main/gen/attribute-id.h index 43d108726fe431..229d4014f4b1ba 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/attribute-id.h +++ b/examples/temperature-measurement-app/esp32/main/gen/attribute-id.h @@ -421,6 +421,15 @@ // Server attributes +// Attribute ids for cluster: Switch + +// Client attributes + +// Server attributes +#define ZCL_NUMBER_OF_POSITIONS_ATTRIBUTE_ID (0x0000) +#define ZCL_CURRENT_POSITION_ATTRIBUTE_ID (0x0001) +#define ZCL_MULTI_PRESS_MAX_ATTRIBUTE_ID (0x0002) + // Attribute ids for cluster: Operational Credentials // Client attributes diff --git a/examples/temperature-measurement-app/esp32/main/gen/cluster-id.h b/examples/temperature-measurement-app/esp32/main/gen/cluster-id.h index 3aea880546f261..b8d9a9f7ed09bf 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/cluster-id.h +++ b/examples/temperature-measurement-app/esp32/main/gen/cluster-id.h @@ -98,6 +98,9 @@ // Definitions for cluster: Network Commissioning #define ZCL_NETWORK_COMMISSIONING_CLUSTER_ID (0x0031) +// Definitions for cluster: Switch +#define ZCL_SWITCH_CLUSTER_ID (0x003B) + // Definitions for cluster: Operational Credentials #define ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID (0x003E) diff --git a/examples/temperature-measurement-app/esp32/main/gen/print-cluster.h b/examples/temperature-measurement-app/esp32/main/gen/print-cluster.h index 68d3e99e109b2b..9c879d94a9390d 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/print-cluster.h +++ b/examples/temperature-measurement-app/esp32/main/gen/print-cluster.h @@ -180,6 +180,12 @@ #define CHIP_PRINTCLUSTER_NETWORK_COMMISSIONING_CLUSTER #endif +#if defined(ZCL_USING_SWITCH_CLUSTER_SERVER) || defined(ZCL_USING_SWITCH_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_SWITCH_CLUSTER { ZCL_SWITCH_CLUSTER_ID, 59, "Switch" }, +#else +#define CHIP_PRINTCLUSTER_SWITCH_CLUSTER +#endif + #if defined(ZCL_USING_OPERATIONAL_CREDENTIALS_CLUSTER_SERVER) || defined(ZCL_USING_OPERATIONAL_CREDENTIALS_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_OPERATIONAL_CREDENTIALS_CLUSTER { ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID, 62, "Operational Credentials" }, #else @@ -894,6 +900,7 @@ CHIP_PRINTCLUSTER_OTA_CLIENT_CLUSTER \ CHIP_PRINTCLUSTER_GENERAL_COMMISSIONING_CLUSTER \ CHIP_PRINTCLUSTER_NETWORK_COMMISSIONING_CLUSTER \ + CHIP_PRINTCLUSTER_SWITCH_CLUSTER \ CHIP_PRINTCLUSTER_OPERATIONAL_CREDENTIALS_CLUSTER \ CHIP_PRINTCLUSTER_SHADE_CONFIG_CLUSTER \ CHIP_PRINTCLUSTER_DOOR_LOCK_CLUSTER \ diff --git a/examples/tv-app/tv-common/gen/attribute-id.h b/examples/tv-app/tv-common/gen/attribute-id.h index 43d108726fe431..229d4014f4b1ba 100644 --- a/examples/tv-app/tv-common/gen/attribute-id.h +++ b/examples/tv-app/tv-common/gen/attribute-id.h @@ -421,6 +421,15 @@ // Server attributes +// Attribute ids for cluster: Switch + +// Client attributes + +// Server attributes +#define ZCL_NUMBER_OF_POSITIONS_ATTRIBUTE_ID (0x0000) +#define ZCL_CURRENT_POSITION_ATTRIBUTE_ID (0x0001) +#define ZCL_MULTI_PRESS_MAX_ATTRIBUTE_ID (0x0002) + // Attribute ids for cluster: Operational Credentials // Client attributes diff --git a/examples/tv-app/tv-common/gen/cluster-id.h b/examples/tv-app/tv-common/gen/cluster-id.h index 3aea880546f261..b8d9a9f7ed09bf 100644 --- a/examples/tv-app/tv-common/gen/cluster-id.h +++ b/examples/tv-app/tv-common/gen/cluster-id.h @@ -98,6 +98,9 @@ // Definitions for cluster: Network Commissioning #define ZCL_NETWORK_COMMISSIONING_CLUSTER_ID (0x0031) +// Definitions for cluster: Switch +#define ZCL_SWITCH_CLUSTER_ID (0x003B) + // Definitions for cluster: Operational Credentials #define ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID (0x003E) diff --git a/examples/tv-app/tv-common/gen/print-cluster.h b/examples/tv-app/tv-common/gen/print-cluster.h index 68d3e99e109b2b..9c879d94a9390d 100644 --- a/examples/tv-app/tv-common/gen/print-cluster.h +++ b/examples/tv-app/tv-common/gen/print-cluster.h @@ -180,6 +180,12 @@ #define CHIP_PRINTCLUSTER_NETWORK_COMMISSIONING_CLUSTER #endif +#if defined(ZCL_USING_SWITCH_CLUSTER_SERVER) || defined(ZCL_USING_SWITCH_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_SWITCH_CLUSTER { ZCL_SWITCH_CLUSTER_ID, 59, "Switch" }, +#else +#define CHIP_PRINTCLUSTER_SWITCH_CLUSTER +#endif + #if defined(ZCL_USING_OPERATIONAL_CREDENTIALS_CLUSTER_SERVER) || defined(ZCL_USING_OPERATIONAL_CREDENTIALS_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_OPERATIONAL_CREDENTIALS_CLUSTER { ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID, 62, "Operational Credentials" }, #else @@ -894,6 +900,7 @@ CHIP_PRINTCLUSTER_OTA_CLIENT_CLUSTER \ CHIP_PRINTCLUSTER_GENERAL_COMMISSIONING_CLUSTER \ CHIP_PRINTCLUSTER_NETWORK_COMMISSIONING_CLUSTER \ + CHIP_PRINTCLUSTER_SWITCH_CLUSTER \ CHIP_PRINTCLUSTER_OPERATIONAL_CREDENTIALS_CLUSTER \ CHIP_PRINTCLUSTER_SHADE_CONFIG_CLUSTER \ CHIP_PRINTCLUSTER_DOOR_LOCK_CLUSTER \ diff --git a/examples/window-app/common/gen/attribute-id.h b/examples/window-app/common/gen/attribute-id.h index 43d108726fe431..229d4014f4b1ba 100644 --- a/examples/window-app/common/gen/attribute-id.h +++ b/examples/window-app/common/gen/attribute-id.h @@ -421,6 +421,15 @@ // Server attributes +// Attribute ids for cluster: Switch + +// Client attributes + +// Server attributes +#define ZCL_NUMBER_OF_POSITIONS_ATTRIBUTE_ID (0x0000) +#define ZCL_CURRENT_POSITION_ATTRIBUTE_ID (0x0001) +#define ZCL_MULTI_PRESS_MAX_ATTRIBUTE_ID (0x0002) + // Attribute ids for cluster: Operational Credentials // Client attributes diff --git a/examples/window-app/common/gen/cluster-id.h b/examples/window-app/common/gen/cluster-id.h index 3aea880546f261..b8d9a9f7ed09bf 100644 --- a/examples/window-app/common/gen/cluster-id.h +++ b/examples/window-app/common/gen/cluster-id.h @@ -98,6 +98,9 @@ // Definitions for cluster: Network Commissioning #define ZCL_NETWORK_COMMISSIONING_CLUSTER_ID (0x0031) +// Definitions for cluster: Switch +#define ZCL_SWITCH_CLUSTER_ID (0x003B) + // Definitions for cluster: Operational Credentials #define ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID (0x003E) diff --git a/examples/window-app/common/gen/print-cluster.h b/examples/window-app/common/gen/print-cluster.h index 68d3e99e109b2b..9c879d94a9390d 100644 --- a/examples/window-app/common/gen/print-cluster.h +++ b/examples/window-app/common/gen/print-cluster.h @@ -180,6 +180,12 @@ #define CHIP_PRINTCLUSTER_NETWORK_COMMISSIONING_CLUSTER #endif +#if defined(ZCL_USING_SWITCH_CLUSTER_SERVER) || defined(ZCL_USING_SWITCH_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_SWITCH_CLUSTER { ZCL_SWITCH_CLUSTER_ID, 59, "Switch" }, +#else +#define CHIP_PRINTCLUSTER_SWITCH_CLUSTER +#endif + #if defined(ZCL_USING_OPERATIONAL_CREDENTIALS_CLUSTER_SERVER) || defined(ZCL_USING_OPERATIONAL_CREDENTIALS_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_OPERATIONAL_CREDENTIALS_CLUSTER { ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID, 62, "Operational Credentials" }, #else @@ -894,6 +900,7 @@ CHIP_PRINTCLUSTER_OTA_CLIENT_CLUSTER \ CHIP_PRINTCLUSTER_GENERAL_COMMISSIONING_CLUSTER \ CHIP_PRINTCLUSTER_NETWORK_COMMISSIONING_CLUSTER \ + CHIP_PRINTCLUSTER_SWITCH_CLUSTER \ CHIP_PRINTCLUSTER_OPERATIONAL_CREDENTIALS_CLUSTER \ CHIP_PRINTCLUSTER_SHADE_CONFIG_CLUSTER \ CHIP_PRINTCLUSTER_DOOR_LOCK_CLUSTER \ diff --git a/src/app/chip-zcl-zpro-codec-api.h b/src/app/chip-zcl-zpro-codec-api.h index 266b5d9c509b06..f975b5e9e01422 100644 --- a/src/app/chip-zcl-zpro-codec-api.h +++ b/src/app/chip-zcl-zpro-codec-api.h @@ -38,7 +38,6 @@ | GeneralCommissioning | 0x0030 | | GroupKeyManagement | 0xF004 | | Groups | 0x0004 | -| IasZone | 0x0500 | | Identify | 0x0003 | | LevelControl | 0x0008 | | LowPower | 0x0508 | @@ -47,6 +46,7 @@ | OperationalCredentials | 0x003E | | PumpConfigurationAndControl | 0x0200 | | Scenes | 0x0005 | +| Switch | 0x003B | | TemperatureMeasurement | 0x0402 | | Thermostat | 0x0201 | | WindowCovering | 0x0102 | @@ -1608,71 +1608,6 @@ chip::System::PacketBufferHandle encodeGroupsClusterReadNameSupportAttribute(uin chip::System::PacketBufferHandle encodeGroupsClusterReadClusterRevisionAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); -/*----------------------------------------------------------------------------*\ -| Cluster IasZone | 0x0500 | -|------------------------------------------------------------------------------| -| Commands: | | -|------------------------------------------------------------------------------| -| Attributes: | | -| * ZoneState | 0x0000 | -| * ZoneType | 0x0001 | -| * ZoneStatus | 0x0002 | -| * IasCieAddress | 0x0010 | -| * ZoneId | 0x0011 | -| * ClusterRevision | 0xFFFD | -\*----------------------------------------------------------------------------*/ - -/** - * @brief - * Encode a IAS Zone server discover command into buffer including the APS frame - */ -chip::System::PacketBufferHandle encodeIasZoneClusterDiscoverAttributes(uint8_t seqNum, chip::EndpointId destinationEndpoint); - -/** - * @brief - * Encode a IAS Zone server read command for the zone state attribute into buffer including the APS frame - */ -chip::System::PacketBufferHandle encodeIasZoneClusterReadZoneStateAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); - -/** - * @brief - * Encode a IAS Zone server read command for the zone type attribute into buffer including the APS frame - */ -chip::System::PacketBufferHandle encodeIasZoneClusterReadZoneTypeAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); - -/** - * @brief - * Encode a IAS Zone server read command for the zone status attribute into buffer including the APS frame - */ -chip::System::PacketBufferHandle encodeIasZoneClusterReadZoneStatusAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); - -/** - * @brief - * Encode a IAS Zone server read command for the IAS CIE address attribute into buffer including the APS frame - */ -chip::System::PacketBufferHandle encodeIasZoneClusterReadIasCieAddressAttribute(uint8_t seqNum, - chip::EndpointId destinationEndpoint); - -/** - * @brief - * Encode a IAS Zone server write command for the IAS CIE address attribute into buffer including the APS frame - */ -chip::System::PacketBufferHandle -encodeIasZoneClusterWriteIasCieAddressAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint, uint64_t iasCieAddress); - -/** - * @brief - * Encode a IAS Zone server read command for the Zone ID attribute into buffer including the APS frame - */ -chip::System::PacketBufferHandle encodeIasZoneClusterReadZoneIdAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); - -/** - * @brief - * Encode a IAS Zone server read command for the cluster revision attribute into buffer including the APS frame - */ -chip::System::PacketBufferHandle encodeIasZoneClusterReadClusterRevisionAttribute(uint8_t seqNum, - chip::EndpointId destinationEndpoint); - /*----------------------------------------------------------------------------*\ | Cluster Identify | 0x0003 | |------------------------------------------------------------------------------| @@ -2304,6 +2239,53 @@ chip::System::PacketBufferHandle encodeScenesClusterReadNameSupportAttribute(uin chip::System::PacketBufferHandle encodeScenesClusterReadClusterRevisionAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); +/*----------------------------------------------------------------------------*\ +| Cluster Switch | 0x003B | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * NumberOfPositions | 0x0000 | +| * CurrentPosition | 0x0001 | +| * ClusterRevision | 0xFFFD | +\*----------------------------------------------------------------------------*/ + +/** + * @brief + * Encode a Switch server discover command into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeSwitchClusterDiscoverAttributes(uint8_t seqNum, chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Switch server read command for the number of positions attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeSwitchClusterReadNumberOfPositionsAttribute(uint8_t seqNum, + chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Switch server read command for the current position attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeSwitchClusterReadCurrentPositionAttribute(uint8_t seqNum, + chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Switch server configure report command for the current position attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeSwitchClusterConfigureCurrentPositionAttribute(uint8_t seqNum, + chip::EndpointId destinationEndpoint, + uint16_t minInterval, uint16_t maxInterval, + uint8_t change); + +/** + * @brief + * Encode a Switch server read command for the cluster revision attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeSwitchClusterReadClusterRevisionAttribute(uint8_t seqNum, + chip::EndpointId destinationEndpoint); + /*----------------------------------------------------------------------------*\ | Cluster TemperatureMeasurement | 0x0402 | |------------------------------------------------------------------------------| diff --git a/src/app/encoder.cpp b/src/app/encoder.cpp index b9ef25aba658c8..15fbe1d7191e74 100644 --- a/src/app/encoder.cpp +++ b/src/app/encoder.cpp @@ -109,7 +109,6 @@ uint16_t encodeApsFrame(uint8_t * buffer, uint16_t buf_length, EmberApsFrame * a | GeneralCommissioning | 0x0030 | | GroupKeyManagement | 0xF004 | | Groups | 0x0004 | -| IasZone | 0x0500 | | Identify | 0x0003 | | LevelControl | 0x0008 | | LowPower | 0x0508 | @@ -118,6 +117,7 @@ uint16_t encodeApsFrame(uint8_t * buffer, uint16_t buf_length, EmberApsFrame * a | OperationalCredentials | 0x003E | | PumpConfigurationAndControl | 0x0200 | | Scenes | 0x0005 | +| Switch | 0x003B | | TemperatureMeasurement | 0x0402 | | Thermostat | 0x0201 | | WindowCovering | 0x0102 | @@ -220,8 +220,6 @@ uint16_t encodeApsFrame(uint8_t * buffer, uint16_t buf_length, EmberApsFrame * a #define ZCL_REMOVE_GROUP_COMMAND_ID (0x03) #define ZCL_VIEW_GROUP_COMMAND_ID (0x01) -#define IAS_ZONE_CLUSTER_ID 0x0500 - #define IDENTIFY_CLUSTER_ID 0x0003 #define ZCL_IDENTIFY_COMMAND_ID (0x00) #define ZCL_IDENTIFY_QUERY_COMMAND_ID (0x01) @@ -271,6 +269,8 @@ uint16_t encodeApsFrame(uint8_t * buffer, uint16_t buf_length, EmberApsFrame * a #define ZCL_STORE_SCENE_COMMAND_ID (0x04) #define ZCL_VIEW_SCENE_COMMAND_ID (0x01) +#define SWITCH_CLUSTER_ID 0x003B + #define TEMP_MEASUREMENT_CLUSTER_ID 0x0402 #define THERMOSTAT_CLUSTER_ID 0x0201 @@ -2802,100 +2802,6 @@ PacketBufferHandle encodeGroupsClusterReadClusterRevisionAttribute(uint8_t seqNu COMMAND_FOOTER(); } -/*----------------------------------------------------------------------------*\ -| Cluster IasZone | 0x0500 | -|------------------------------------------------------------------------------| -| Commands: | | -|------------------------------------------------------------------------------| -| Attributes: | | -| * ZoneState | 0x0000 | -| * ZoneType | 0x0001 | -| * ZoneStatus | 0x0002 | -| * IasCieAddress | 0x0010 | -| * ZoneId | 0x0011 | -| * ClusterRevision | 0xFFFD | -\*----------------------------------------------------------------------------*/ - -PacketBufferHandle encodeIasZoneClusterDiscoverAttributes(uint8_t seqNum, EndpointId destinationEndpoint) -{ - COMMAND_HEADER("DiscoverIasZoneAttributes", IAS_ZONE_CLUSTER_ID); - buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_DISCOVER_ATTRIBUTES_COMMAND_ID).Put16(0x0000).Put8(0xFF); - COMMAND_FOOTER(); -} - -/* - * Attribute ZoneState - */ -PacketBufferHandle encodeIasZoneClusterReadZoneStateAttribute(uint8_t seqNum, EndpointId destinationEndpoint) -{ - COMMAND_HEADER("ReadIasZoneZoneState", IAS_ZONE_CLUSTER_ID); - buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0000); - COMMAND_FOOTER(); -} - -/* - * Attribute ZoneType - */ -PacketBufferHandle encodeIasZoneClusterReadZoneTypeAttribute(uint8_t seqNum, EndpointId destinationEndpoint) -{ - COMMAND_HEADER("ReadIasZoneZoneType", IAS_ZONE_CLUSTER_ID); - buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0001); - COMMAND_FOOTER(); -} - -/* - * Attribute ZoneStatus - */ -PacketBufferHandle encodeIasZoneClusterReadZoneStatusAttribute(uint8_t seqNum, EndpointId destinationEndpoint) -{ - COMMAND_HEADER("ReadIasZoneZoneStatus", IAS_ZONE_CLUSTER_ID); - buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0002); - COMMAND_FOOTER(); -} - -/* - * Attribute IasCieAddress - */ -PacketBufferHandle encodeIasZoneClusterReadIasCieAddressAttribute(uint8_t seqNum, EndpointId destinationEndpoint) -{ - COMMAND_HEADER("ReadIasZoneIasCieAddress", IAS_ZONE_CLUSTER_ID); - buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0010); - COMMAND_FOOTER(); -} - -PacketBufferHandle encodeIasZoneClusterWriteIasCieAddressAttribute(uint8_t seqNum, EndpointId destinationEndpoint, - uint64_t iasCieAddress) -{ - COMMAND_HEADER("WriteIasZoneIasCieAddress", IAS_ZONE_CLUSTER_ID); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID) - .Put16(0x0010) - .Put8(240) - .Put64(static_cast(iasCieAddress)); - COMMAND_FOOTER(); -} - -/* - * Attribute ZoneId - */ -PacketBufferHandle encodeIasZoneClusterReadZoneIdAttribute(uint8_t seqNum, EndpointId destinationEndpoint) -{ - COMMAND_HEADER("ReadIasZoneZoneId", IAS_ZONE_CLUSTER_ID); - buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0011); - COMMAND_FOOTER(); -} - -/* - * Attribute ClusterRevision - */ -PacketBufferHandle encodeIasZoneClusterReadClusterRevisionAttribute(uint8_t seqNum, EndpointId destinationEndpoint) -{ - COMMAND_HEADER("ReadIasZoneClusterRevision", IAS_ZONE_CLUSTER_ID); - buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0xFFFD); - COMMAND_FOOTER(); -} - /*----------------------------------------------------------------------------*\ | Cluster Identify | 0x0003 | |------------------------------------------------------------------------------| @@ -3967,6 +3873,70 @@ PacketBufferHandle encodeScenesClusterReadClusterRevisionAttribute(uint8_t seqNu COMMAND_FOOTER(); } +/*----------------------------------------------------------------------------*\ +| Cluster Switch | 0x003B | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * NumberOfPositions | 0x0000 | +| * CurrentPosition | 0x0001 | +| * ClusterRevision | 0xFFFD | +\*----------------------------------------------------------------------------*/ + +PacketBufferHandle encodeSwitchClusterDiscoverAttributes(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("DiscoverSwitchAttributes", SWITCH_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_DISCOVER_ATTRIBUTES_COMMAND_ID).Put16(0x0000).Put8(0xFF); + COMMAND_FOOTER(); +} + +/* + * Attribute NumberOfPositions + */ +PacketBufferHandle encodeSwitchClusterReadNumberOfPositionsAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadSwitchNumberOfPositions", SWITCH_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0000); + COMMAND_FOOTER(); +} + +/* + * Attribute CurrentPosition + */ +PacketBufferHandle encodeSwitchClusterReadCurrentPositionAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadSwitchCurrentPosition", SWITCH_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0001); + COMMAND_FOOTER(); +} + +PacketBufferHandle encodeSwitchClusterConfigureCurrentPositionAttribute(uint8_t seqNum, EndpointId destinationEndpoint, + uint16_t minInterval, uint16_t maxInterval, uint8_t change) +{ + COMMAND_HEADER("ReportSwitchCurrentPosition", SWITCH_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand) + .Put8(seqNum) + .Put8(ZCL_CONFIGURE_REPORTING_COMMAND_ID) + .Put8(EMBER_ZCL_REPORTING_DIRECTION_REPORTED) + .Put16(0x0001) + .Put8(32) + .Put16(minInterval) + .Put16(maxInterval); + buf.Put8(static_cast(change)); + COMMAND_FOOTER(); +} + +/* + * Attribute ClusterRevision + */ +PacketBufferHandle encodeSwitchClusterReadClusterRevisionAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadSwitchClusterRevision", SWITCH_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0xFFFD); + COMMAND_FOOTER(); +} + /*----------------------------------------------------------------------------*\ | Cluster TemperatureMeasurement | 0x0402 | |------------------------------------------------------------------------------| diff --git a/src/app/zap-templates/templates/chip/python-CHIPClusters-cpp.zapt b/src/app/zap-templates/templates/chip/python-CHIPClusters-cpp.zapt index 8c28c20ec356e8..fd45c261a030cc 100644 --- a/src/app/zap-templates/templates/chip/python-CHIPClusters-cpp.zapt +++ b/src/app/zap-templates/templates/chip/python-CHIPClusters-cpp.zapt @@ -71,7 +71,7 @@ void chip_ime_SetFailureResponseDelegate(FailureResponseDelegate delegate) gFailureResponseDelegate = delegate; } -{{#chip_client_clusters}} +{{#chip_server_clusters}} // Cluster {{asCamelCased name false}} {{#chip_server_cluster_commands}} @@ -108,6 +108,6 @@ CHIP_ERROR chip_ime_ConfigureAttribute_{{asCamelCased parent.name false}}_{{asCa {{/chip_server_cluster_attributes}} // End of Cluster {{asCamelCased name false}} -{{/chip_client_clusters}} +{{/chip_server_clusters}} } diff --git a/src/app/zap-templates/zcl/switch-cluster.xml b/src/app/zap-templates/zcl/switch-cluster.xml new file mode 100644 index 00000000000000..a4da24b97dbfbf --- /dev/null +++ b/src/app/zap-templates/zcl/switch-cluster.xml @@ -0,0 +1,34 @@ + + + + + + CHIP + Switch + 0x003b + SWITCH_CLUSTER + true + true + This cluster exposes interactions with a switch device, for the purpose of using those interactions by other devices. +Two types of switch devices are supported: latching switch (e.g. rocker switch) and momentary switch (e.g. push button), distinguished with their feature flags. +Interactions with the switch device are exposed as attributes (for the latching switch) and as events (for both types of switches). An interested party MAY subscribe to these attributes/events and thus be informed of the interactions, and can perform actions based on this, for example by sending commands to perform an action such as controlling a light or a window shade. + + number of positions + current position + multi press max + + diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index 37accfbc39fcd9..8cca8614ef1eaa 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -7,6 +7,7 @@ "audio-output-cluster.xml", "application-basic-cluster.xml", "binding-cluster.xml", + "switch-cluster.xml", "clusters-extensions.xml", "content-launch-cluster.xml", "media-playback-cluster.xml", diff --git a/src/app/zap_cluster_list.py b/src/app/zap_cluster_list.py index 6c2f17d8482032..845c5fd63c5253 100755 --- a/src/app/zap_cluster_list.py +++ b/src/app/zap_cluster_list.py @@ -38,6 +38,7 @@ 'POWER_CONFIG_CLUSTER': [], 'PUMP_CONFIG_CONTROL_CLUSTER': [], 'SCENES_CLUSTER': ['scenes'], + 'SWITCH_CLUSTER': [], 'TEMP_MEASUREMENT_CLUSTER': ['temperature-measurement-server'], 'THERMOSTAT_CLUSTER': [], 'WINDOW_COVERING_CLUSTER': [], @@ -75,6 +76,7 @@ 'POWER_CONFIG_CLUSTER': [], 'PUMP_CONFIG_CONTROL_CLUSTER': [], 'SCENES_CLUSTER': [], + 'SWITCH_CLUSTER': [], 'TEMP_MEASUREMENT_CLUSTER': [], 'THERMOSTAT_CLUSTER': ['thermostat-client'], 'WINDOW_COVERING_CLUSTER': [], diff --git a/src/controller/controller-clusters.zap b/src/controller/controller-clusters.zap index 7fd1aa039fbe84..b3b47ea22b81f0 100644 --- a/src/controller/controller-clusters.zap +++ b/src/controller/controller-clusters.zap @@ -1,5 +1,5 @@ { - "featureLevel": 26, + "featureLevel": 29, "creator": "zap", "keyValuePairs": [ { @@ -1510,6 +1510,103 @@ } ] }, + { + "name": "Switch", + "code": 59, + "mfgCode": null, + "define": "SWITCH_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Switch", + "code": 59, + "mfgCode": null, + "define": "SWITCH_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "number of positions", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "current position", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "multi press max", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, { "name": "Operational Credentials", "code": 62, @@ -2693,21 +2790,6 @@ "enabled": 0, "commands": [], "attributes": [ - { - "name": "cluster revision", - "code": 65533, - "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0001", - "reportable": 0, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, { "name": "max pressure", "code": 0, @@ -2827,6 +2909,21 @@ "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 } ] }, @@ -4113,7 +4210,7 @@ "mfgCode": null, "define": "IAS_ZONE_CLUSTER", "side": "server", - "enabled": 1, + "enabled": 0, "commands": [ { "name": "ZoneStatusChangeNotification", @@ -6139,21 +6236,6 @@ "enabled": 1, "commands": [], "attributes": [ - { - "name": "cluster revision", - "code": 65533, - "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0001", - "reportable": 0, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, { "name": "max pressure", "code": 0, @@ -6273,6 +6355,21 @@ "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 } ] }, @@ -7465,14 +7562,18 @@ "endpointTypeIndex": 0, "profileId": "0x0103", "endpointId": 1, - "networkId": 0 + "networkId": 0, + "endpointVersion": null, + "deviceIdentifier": null }, { "endpointTypeName": "Anonymous Endpoint Type", "endpointTypeIndex": 1, "profileId": "0x0103", "endpointId": 2, - "networkId": 0 + "networkId": 0, + "endpointVersion": null, + "deviceIdentifier": null } ], "log": [] diff --git a/src/controller/python/chip/clusters/CHIPClusters.cpp b/src/controller/python/chip/clusters/CHIPClusters.cpp index d5ed0bb38b902e..c57186b66d696e 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.cpp +++ b/src/controller/python/chip/clusters/CHIPClusters.cpp @@ -87,4 +87,2406 @@ void chip_ime_SetFailureResponseDelegate(FailureResponseDelegate delegate) { gFailureResponseDelegate = delegate; } + +// Cluster ApplicationBasic + +CHIP_ERROR chip_ime_ReadAttribute_ApplicationBasic_VendorName(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ApplicationBasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeVendorName(gStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ApplicationBasic_VendorId(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ApplicationBasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeVendorId(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ApplicationBasic_ApplicationName(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ApplicationBasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeApplicationName(gStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ApplicationBasic_ProductId(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ApplicationBasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeProductId(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ApplicationBasic_ApplicationId(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ApplicationBasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeApplicationId(gStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ApplicationBasic_CatalogVendorId(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ApplicationBasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCatalogVendorId(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ApplicationBasic_ApplicationSatus(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ApplicationBasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeApplicationSatus(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ApplicationBasic_ClusterRevision(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ApplicationBasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +// End of Cluster ApplicationBasic +// Cluster BarrierControl + +CHIP_ERROR chip_ime_AppendCommand_BarrierControl_BarrierControlGoToPercent(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + uint8_t percentOpen) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BarrierControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.BarrierControlGoToPercent(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), percentOpen); +} +CHIP_ERROR chip_ime_AppendCommand_BarrierControl_BarrierControlStop(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BarrierControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.BarrierControlStop(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_BarrierControl_BarrierMovingState(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BarrierControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeBarrierMovingState(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_BarrierControl_BarrierSafetyStatus(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BarrierControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeBarrierSafetyStatus(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_BarrierControl_BarrierCapabilities(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BarrierControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeBarrierCapabilities(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_BarrierControl_BarrierPosition(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BarrierControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeBarrierPosition(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_BarrierControl_ClusterRevision(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BarrierControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +// End of Cluster BarrierControl +// Cluster Basic + +CHIP_ERROR chip_ime_AppendCommand_Basic_MfgSpecificPing(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.MfgSpecificPing(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Basic_InteractionModelVersion(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeInteractionModelVersion(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Basic_VendorName(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeVendorName(gStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Basic_VendorID(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeVendorID(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Basic_ProductName(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeProductName(gStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Basic_ProductID(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeProductID(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Basic_UserLabel(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeUserLabel(gStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Basic_Location(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeLocation(gStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Basic_HardwareVersion(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeHardwareVersion(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Basic_HardwareVersionString(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeHardwareVersionString(gStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Basic_SoftwareVersion(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeSoftwareVersion(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Basic_SoftwareVersionString(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeSoftwareVersionString(gStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Basic_ManufacturingDate(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeManufacturingDate(gStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Basic_PartNumber(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePartNumber(gStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Basic_ProductURL(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeProductURL(gStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Basic_ProductLabel(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeProductLabel(gStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Basic_SerialNumber(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeSerialNumber(gStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Basic_LocalConfigDisabled(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeLocalConfigDisabled(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Basic_ClusterRevision(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BasicCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +// End of Cluster Basic +// Cluster Binding + +CHIP_ERROR chip_ime_AppendCommand_Binding_Bind(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, + chip::NodeId nodeId, chip::GroupId groupId, chip::EndpointId endpointId, + chip::ClusterId clusterId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BindingCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.Bind(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), nodeId, groupId, endpointId, clusterId); +} +CHIP_ERROR chip_ime_AppendCommand_Binding_Unbind(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, + chip::NodeId nodeId, chip::GroupId groupId, chip::EndpointId endpointId, + chip::ClusterId clusterId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BindingCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.Unbind(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), nodeId, groupId, endpointId, + clusterId); +} + +CHIP_ERROR chip_ime_ReadAttribute_Binding_ClusterRevision(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::BindingCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +// End of Cluster Binding +// Cluster ColorControl + +CHIP_ERROR chip_ime_AppendCommand_ColorControl_MoveColor(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, int16_t rateX, int16_t rateY, uint8_t optionsMask, + uint8_t optionsOverride) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.MoveColor(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), rateX, rateY, optionsMask, + optionsOverride); +} +CHIP_ERROR chip_ime_AppendCommand_ColorControl_MoveColorTemperature(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t moveMode, + uint16_t rate, uint16_t colorTemperatureMinimum, + uint16_t colorTemperatureMaximum, uint8_t optionsMask, + uint8_t optionsOverride) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.MoveColorTemperature(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), moveMode, rate, + colorTemperatureMinimum, colorTemperatureMaximum, optionsMask, optionsOverride); +} +CHIP_ERROR chip_ime_AppendCommand_ColorControl_MoveHue(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t moveMode, uint8_t rate, uint8_t optionsMask, + uint8_t optionsOverride) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.MoveHue(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), moveMode, rate, optionsMask, + optionsOverride); +} +CHIP_ERROR chip_ime_AppendCommand_ColorControl_MoveSaturation(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t moveMode, uint8_t rate, uint8_t optionsMask, + uint8_t optionsOverride) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.MoveSaturation(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), moveMode, rate, optionsMask, + optionsOverride); +} +CHIP_ERROR chip_ime_AppendCommand_ColorControl_MoveToColor(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t colorX, uint16_t colorY, uint16_t transitionTime, + uint8_t optionsMask, uint8_t optionsOverride) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.MoveToColor(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), colorX, colorY, transitionTime, + optionsMask, optionsOverride); +} +CHIP_ERROR chip_ime_AppendCommand_ColorControl_MoveToColorTemperature(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + uint16_t colorTemperature, uint16_t transitionTime, + uint8_t optionsMask, uint8_t optionsOverride) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.MoveToColorTemperature(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), colorTemperature, + transitionTime, optionsMask, optionsOverride); +} +CHIP_ERROR chip_ime_AppendCommand_ColorControl_MoveToHue(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t hue, uint8_t direction, uint16_t transitionTime, + uint8_t optionsMask, uint8_t optionsOverride) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.MoveToHue(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), hue, direction, transitionTime, + optionsMask, optionsOverride); +} +CHIP_ERROR chip_ime_AppendCommand_ColorControl_MoveToHueAndSaturation(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t hue, + uint8_t saturation, uint16_t transitionTime, + uint8_t optionsMask, uint8_t optionsOverride) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.MoveToHueAndSaturation(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), hue, saturation, + transitionTime, optionsMask, optionsOverride); +} +CHIP_ERROR chip_ime_AppendCommand_ColorControl_MoveToSaturation(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t saturation, uint16_t transitionTime, + uint8_t optionsMask, uint8_t optionsOverride) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.MoveToSaturation(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), saturation, transitionTime, + optionsMask, optionsOverride); +} +CHIP_ERROR chip_ime_AppendCommand_ColorControl_StepColor(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, int16_t stepX, int16_t stepY, uint16_t transitionTime, + uint8_t optionsMask, uint8_t optionsOverride) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.StepColor(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), stepX, stepY, transitionTime, + optionsMask, optionsOverride); +} +CHIP_ERROR chip_ime_AppendCommand_ColorControl_StepColorTemperature(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t stepMode, + uint16_t stepSize, uint16_t transitionTime, + uint16_t colorTemperatureMinimum, + uint16_t colorTemperatureMaximum, uint8_t optionsMask, + uint8_t optionsOverride) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.StepColorTemperature(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), stepMode, stepSize, + transitionTime, colorTemperatureMinimum, colorTemperatureMaximum, optionsMask, + optionsOverride); +} +CHIP_ERROR chip_ime_AppendCommand_ColorControl_StepHue(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t stepMode, uint8_t stepSize, uint8_t transitionTime, + uint8_t optionsMask, uint8_t optionsOverride) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.StepHue(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), stepMode, stepSize, transitionTime, + optionsMask, optionsOverride); +} +CHIP_ERROR chip_ime_AppendCommand_ColorControl_StepSaturation(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t stepMode, uint8_t stepSize, + uint8_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.StepSaturation(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), stepMode, stepSize, + transitionTime, optionsMask, optionsOverride); +} +CHIP_ERROR chip_ime_AppendCommand_ColorControl_StopMoveStep(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t optionsMask, uint8_t optionsOverride) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.StopMoveStep(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), optionsMask, optionsOverride); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_CurrentHue(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCurrentHue(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ConfigureAttribute_ColorControl_CurrentHue(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + uint16_t minInterval, uint16_t maxInterval, uint8_t change) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ConfigureAttributeCurrentHue(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel(), minInterval, + maxInterval, change); +} +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_CurrentSaturation(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCurrentSaturation(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ConfigureAttribute_ColorControl_CurrentSaturation(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, uint16_t minInterval, + uint16_t maxInterval, uint8_t change) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ConfigureAttributeCurrentSaturation(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel(), + minInterval, maxInterval, change); +} +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_RemainingTime(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeRemainingTime(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_CurrentX(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCurrentX(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ConfigureAttribute_ColorControl_CurrentX(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + uint16_t minInterval, uint16_t maxInterval, uint16_t change) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ConfigureAttributeCurrentX(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel(), minInterval, + maxInterval, change); +} +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_CurrentY(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCurrentY(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ConfigureAttribute_ColorControl_CurrentY(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + uint16_t minInterval, uint16_t maxInterval, uint16_t change) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ConfigureAttributeCurrentY(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel(), minInterval, + maxInterval, change); +} +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_DriftCompensation(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeDriftCompensation(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_CompensationText(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCompensationText(gStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_ColorTemperature(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorTemperature(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ConfigureAttribute_ColorControl_ColorTemperature(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, uint16_t minInterval, + uint16_t maxInterval, uint16_t change) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ConfigureAttributeColorTemperature(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel(), + minInterval, maxInterval, change); +} +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_ColorMode(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorMode(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_ColorControlOptions(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorControlOptions(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_NumberOfPrimaries(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeNumberOfPrimaries(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_Primary1X(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary1X(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_Primary1Y(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary1Y(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_Primary1Intensity(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary1Intensity(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_Primary2X(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary2X(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_Primary2Y(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary2Y(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_Primary2Intensity(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary2Intensity(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_Primary3X(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary3X(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_Primary3Y(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary3Y(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_Primary3Intensity(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary3Intensity(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_Primary4X(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary4X(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_Primary4Y(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary4Y(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_Primary4Intensity(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary4Intensity(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_Primary5X(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary5X(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_Primary5Y(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary5Y(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_Primary5Intensity(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary5Intensity(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_Primary6X(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary6X(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_Primary6Y(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary6Y(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_Primary6Intensity(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary6Intensity(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_WhitePointX(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeWhitePointX(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_WhitePointY(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeWhitePointY(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_ColorPointRX(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorPointRX(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_ColorPointRY(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorPointRY(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_ColorPointRIntensity(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorPointRIntensity(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_ColorPointGX(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorPointGX(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_ColorPointGY(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorPointGY(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_ColorPointGIntensity(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorPointGIntensity(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_ColorPointBX(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorPointBX(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_ColorPointBY(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorPointBY(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_ColorPointBIntensity(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorPointBIntensity(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_EnhancedCurrentHue(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeEnhancedCurrentHue(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_EnhancedColorMode(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeEnhancedColorMode(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_ColorLoopActive(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorLoopActive(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_ColorLoopDirection(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorLoopDirection(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_ColorLoopTime(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorLoopTime(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_ColorCapabilities(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorCapabilities(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_ColorTempPhysicalMin(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorTempPhysicalMin(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_ColorTempPhysicalMax(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorTempPhysicalMax(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_CoupleColorTempToLevelMinMireds(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCoupleColorTempToLevelMinMireds(gInt16uAttributeCallback.Cancel(), + gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_StartUpColorTemperatureMireds(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeStartUpColorTemperatureMireds(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ColorControl_ClusterRevision(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ColorControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +// End of Cluster ColorControl +// Cluster Descriptor + +CHIP_ERROR chip_ime_ReadAttribute_Descriptor_ClusterRevision(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DescriptorCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +// End of Cluster Descriptor +// Cluster DoorLock + +CHIP_ERROR chip_ime_AppendCommand_DoorLock_ClearAllPins(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ClearAllPins(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} +CHIP_ERROR chip_ime_AppendCommand_DoorLock_ClearAllRfids(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ClearAllRfids(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} +CHIP_ERROR chip_ime_AppendCommand_DoorLock_ClearHolidaySchedule(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t scheduleId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ClearHolidaySchedule(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), scheduleId); +} +CHIP_ERROR chip_ime_AppendCommand_DoorLock_ClearPin(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t userId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ClearPin(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), userId); +} +CHIP_ERROR chip_ime_AppendCommand_DoorLock_ClearRfid(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t userId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ClearRfid(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), userId); +} +CHIP_ERROR chip_ime_AppendCommand_DoorLock_ClearWeekdaySchedule(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t scheduleId, uint16_t userId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ClearWeekdaySchedule(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), scheduleId, userId); +} +CHIP_ERROR chip_ime_AppendCommand_DoorLock_ClearYeardaySchedule(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t scheduleId, uint16_t userId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ClearYeardaySchedule(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), scheduleId, userId); +} +CHIP_ERROR chip_ime_AppendCommand_DoorLock_GetHolidaySchedule(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t scheduleId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.GetHolidaySchedule(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), scheduleId); +} +CHIP_ERROR chip_ime_AppendCommand_DoorLock_GetLogRecord(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t logIndex) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.GetLogRecord(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), logIndex); +} +CHIP_ERROR chip_ime_AppendCommand_DoorLock_GetPin(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, + uint16_t userId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.GetPin(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), userId); +} +CHIP_ERROR chip_ime_AppendCommand_DoorLock_GetRfid(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, + uint16_t userId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.GetRfid(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), userId); +} +CHIP_ERROR chip_ime_AppendCommand_DoorLock_GetUserType(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t userId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.GetUserType(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), userId); +} +CHIP_ERROR chip_ime_AppendCommand_DoorLock_GetWeekdaySchedule(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t scheduleId, uint16_t userId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.GetWeekdaySchedule(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), scheduleId, userId); +} +CHIP_ERROR chip_ime_AppendCommand_DoorLock_GetYeardaySchedule(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t scheduleId, uint16_t userId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.GetYeardaySchedule(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), scheduleId, userId); +} +CHIP_ERROR chip_ime_AppendCommand_DoorLock_LockDoor(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, const uint8_t * pin, uint32_t pin_Len) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.LockDoor(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), chip::ByteSpan(pin, pin_Len)); +} +CHIP_ERROR chip_ime_AppendCommand_DoorLock_SetHolidaySchedule(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t scheduleId, uint32_t localStartTime, + uint32_t localEndTime, uint8_t operatingModeDuringHoliday) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.SetHolidaySchedule(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), scheduleId, + localStartTime, localEndTime, operatingModeDuringHoliday); +} +CHIP_ERROR chip_ime_AppendCommand_DoorLock_SetPin(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, + uint16_t userId, uint8_t userStatus, uint8_t userType, const uint8_t * pin, + uint32_t pin_Len) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.SetPin(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), userId, userStatus, userType, + chip::ByteSpan(pin, pin_Len)); +} +CHIP_ERROR chip_ime_AppendCommand_DoorLock_SetRfid(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, + uint16_t userId, uint8_t userStatus, uint8_t userType, const uint8_t * id, + uint32_t id_Len) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.SetRfid(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), userId, userStatus, userType, + chip::ByteSpan(id, id_Len)); +} +CHIP_ERROR chip_ime_AppendCommand_DoorLock_SetUserType(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t userId, uint8_t userType) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.SetUserType(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), userId, userType); +} +CHIP_ERROR chip_ime_AppendCommand_DoorLock_SetWeekdaySchedule(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t scheduleId, uint16_t userId, uint8_t daysMask, + uint8_t startHour, uint8_t startMinute, uint8_t endHour, + uint8_t endMinute) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.SetWeekdaySchedule(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), scheduleId, userId, + daysMask, startHour, startMinute, endHour, endMinute); +} +CHIP_ERROR chip_ime_AppendCommand_DoorLock_SetYeardaySchedule(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t scheduleId, uint16_t userId, + uint32_t localStartTime, uint32_t localEndTime) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.SetYeardaySchedule(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), scheduleId, userId, + localStartTime, localEndTime); +} +CHIP_ERROR chip_ime_AppendCommand_DoorLock_UnlockDoor(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, const uint8_t * pin, uint32_t pin_Len) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.UnlockDoor(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), chip::ByteSpan(pin, pin_Len)); +} +CHIP_ERROR chip_ime_AppendCommand_DoorLock_UnlockWithTimeout(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t timeoutInSeconds, const uint8_t * pin, + uint32_t pin_Len) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.UnlockWithTimeout(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), timeoutInSeconds, + chip::ByteSpan(pin, pin_Len)); +} + +CHIP_ERROR chip_ime_ReadAttribute_DoorLock_LockState(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeLockState(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ConfigureAttribute_DoorLock_LockState(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + uint16_t minInterval, uint16_t maxInterval) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ConfigureAttributeLockState(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel(), minInterval, + maxInterval); +} +CHIP_ERROR chip_ime_ReadAttribute_DoorLock_LockType(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeLockType(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_DoorLock_ActuatorEnabled(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeActuatorEnabled(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_DoorLock_ClusterRevision(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +// End of Cluster DoorLock +// Cluster GeneralCommissioning + +CHIP_ERROR chip_ime_AppendCommand_GeneralCommissioning_ArmFailSafe(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + uint16_t expiryLengthSeconds, uint64_t breadcrumb, + uint32_t timeoutMs) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::GeneralCommissioningCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ArmFailSafe(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), expiryLengthSeconds, breadcrumb, + timeoutMs); +} +CHIP_ERROR chip_ime_AppendCommand_GeneralCommissioning_CommissioningComplete(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::GeneralCommissioningCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.CommissioningComplete(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} +CHIP_ERROR chip_ime_AppendCommand_GeneralCommissioning_SetRegulatoryConfig(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + uint8_t location, const uint8_t * countryCode, + uint32_t countryCode_Len, uint64_t breadcrumb, + uint32_t timeoutMs) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::GeneralCommissioningCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.SetRegulatoryConfig(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), location, + chip::ByteSpan(countryCode, countryCode_Len), breadcrumb, timeoutMs); +} + +CHIP_ERROR chip_ime_ReadAttribute_GeneralCommissioning_FabricId(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::GeneralCommissioningCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeFabricId(gStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_GeneralCommissioning_Breadcrumb(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::GeneralCommissioningCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeBreadcrumb(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_GeneralCommissioning_ClusterRevision(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::GeneralCommissioningCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +// End of Cluster GeneralCommissioning +// Cluster GroupKeyManagement + +CHIP_ERROR chip_ime_ReadAttribute_GroupKeyManagement_ClusterRevision(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::GroupKeyManagementCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +// End of Cluster GroupKeyManagement +// Cluster Groups + +CHIP_ERROR chip_ime_AppendCommand_Groups_AddGroup(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, + uint16_t groupId, const uint8_t * groupName, uint32_t groupName_Len) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::GroupsCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.AddGroup(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), groupId, + chip::ByteSpan(groupName, groupName_Len)); +} +CHIP_ERROR chip_ime_AppendCommand_Groups_AddGroupIfIdentifying(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t groupId, const uint8_t * groupName, + uint32_t groupName_Len) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::GroupsCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.AddGroupIfIdentifying(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), groupId, + chip::ByteSpan(groupName, groupName_Len)); +} +CHIP_ERROR chip_ime_AppendCommand_Groups_GetGroupMembership(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t groupCount, uint16_t groupList) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::GroupsCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.GetGroupMembership(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), groupCount, groupList); +} +CHIP_ERROR chip_ime_AppendCommand_Groups_RemoveAllGroups(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::GroupsCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.RemoveAllGroups(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} +CHIP_ERROR chip_ime_AppendCommand_Groups_RemoveGroup(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t groupId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::GroupsCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.RemoveGroup(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), groupId); +} +CHIP_ERROR chip_ime_AppendCommand_Groups_ViewGroup(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, + uint16_t groupId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::GroupsCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ViewGroup(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), groupId); +} + +CHIP_ERROR chip_ime_ReadAttribute_Groups_NameSupport(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::GroupsCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeNameSupport(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Groups_ClusterRevision(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::GroupsCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +// End of Cluster Groups +// Cluster Identify + +CHIP_ERROR chip_ime_AppendCommand_Identify_Identify(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t identifyTime) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::IdentifyCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.Identify(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), identifyTime); +} +CHIP_ERROR chip_ime_AppendCommand_Identify_IdentifyQuery(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::IdentifyCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.IdentifyQuery(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Identify_IdentifyTime(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::IdentifyCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeIdentifyTime(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Identify_ClusterRevision(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::IdentifyCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +// End of Cluster Identify +// Cluster LevelControl + +CHIP_ERROR chip_ime_AppendCommand_LevelControl_Move(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t moveMode, uint8_t rate, uint8_t optionMask, + uint8_t optionOverride) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::LevelControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.Move(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), moveMode, rate, optionMask, + optionOverride); +} +CHIP_ERROR chip_ime_AppendCommand_LevelControl_MoveToLevel(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t level, uint16_t transitionTime, + uint8_t optionMask, uint8_t optionOverride) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::LevelControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.MoveToLevel(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), level, transitionTime, + optionMask, optionOverride); +} +CHIP_ERROR chip_ime_AppendCommand_LevelControl_MoveToLevelWithOnOff(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t level, + uint16_t transitionTime) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::LevelControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.MoveToLevelWithOnOff(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), level, transitionTime); +} +CHIP_ERROR chip_ime_AppendCommand_LevelControl_MoveWithOnOff(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t moveMode, uint8_t rate) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::LevelControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.MoveWithOnOff(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), moveMode, rate); +} +CHIP_ERROR chip_ime_AppendCommand_LevelControl_Step(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t stepMode, uint8_t stepSize, uint16_t transitionTime, + uint8_t optionMask, uint8_t optionOverride) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::LevelControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.Step(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), stepMode, stepSize, transitionTime, + optionMask, optionOverride); +} +CHIP_ERROR chip_ime_AppendCommand_LevelControl_StepWithOnOff(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t stepMode, uint8_t stepSize, + uint16_t transitionTime) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::LevelControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.StepWithOnOff(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), stepMode, stepSize, + transitionTime); +} +CHIP_ERROR chip_ime_AppendCommand_LevelControl_Stop(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t optionMask, uint8_t optionOverride) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::LevelControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.Stop(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), optionMask, optionOverride); +} +CHIP_ERROR chip_ime_AppendCommand_LevelControl_StopWithOnOff(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::LevelControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.StopWithOnOff(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_LevelControl_CurrentLevel(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::LevelControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCurrentLevel(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ConfigureAttribute_LevelControl_CurrentLevel(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + uint16_t minInterval, uint16_t maxInterval, uint8_t change) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::LevelControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ConfigureAttributeCurrentLevel(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel(), minInterval, + maxInterval, change); +} +CHIP_ERROR chip_ime_ReadAttribute_LevelControl_ClusterRevision(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::LevelControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +// End of Cluster LevelControl +// Cluster LowPower + +CHIP_ERROR chip_ime_AppendCommand_LowPower_Sleep(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::LowPowerCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.Sleep(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_LowPower_ClusterRevision(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::LowPowerCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +// End of Cluster LowPower +// Cluster NetworkCommissioning + +CHIP_ERROR chip_ime_AppendCommand_NetworkCommissioning_AddThreadNetwork(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + const uint8_t * operationalDataset, + uint32_t operationalDataset_Len, uint64_t breadcrumb, + uint32_t timeoutMs) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::NetworkCommissioningCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.AddThreadNetwork(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), + chip::ByteSpan(operationalDataset, operationalDataset_Len), breadcrumb, timeoutMs); +} +CHIP_ERROR chip_ime_AppendCommand_NetworkCommissioning_AddWiFiNetwork(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + const uint8_t * ssid, uint32_t ssid_Len, + const uint8_t * credentials, uint32_t credentials_Len, + uint64_t breadcrumb, uint32_t timeoutMs) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::NetworkCommissioningCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.AddWiFiNetwork(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), + chip::ByteSpan(ssid, ssid_Len), chip::ByteSpan(credentials, credentials_Len), breadcrumb, + timeoutMs); +} +CHIP_ERROR chip_ime_AppendCommand_NetworkCommissioning_DisableNetwork(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + const uint8_t * networkID, uint32_t networkID_Len, + uint64_t breadcrumb, uint32_t timeoutMs) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::NetworkCommissioningCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.DisableNetwork(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), + chip::ByteSpan(networkID, networkID_Len), breadcrumb, timeoutMs); +} +CHIP_ERROR chip_ime_AppendCommand_NetworkCommissioning_EnableNetwork(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + const uint8_t * networkID, uint32_t networkID_Len, + uint64_t breadcrumb, uint32_t timeoutMs) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::NetworkCommissioningCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.EnableNetwork(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), + chip::ByteSpan(networkID, networkID_Len), breadcrumb, timeoutMs); +} +CHIP_ERROR chip_ime_AppendCommand_NetworkCommissioning_GetLastNetworkCommissioningResult(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId, uint32_t timeoutMs) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::NetworkCommissioningCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.GetLastNetworkCommissioningResult(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), timeoutMs); +} +CHIP_ERROR chip_ime_AppendCommand_NetworkCommissioning_RemoveNetwork(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + const uint8_t * networkID, uint32_t networkID_Len, + uint64_t breadcrumb, uint32_t timeoutMs) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::NetworkCommissioningCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.RemoveNetwork(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), + chip::ByteSpan(networkID, networkID_Len), breadcrumb, timeoutMs); +} +CHIP_ERROR chip_ime_AppendCommand_NetworkCommissioning_ScanNetworks(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + const uint8_t * ssid, uint32_t ssid_Len, uint64_t breadcrumb, + uint32_t timeoutMs) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::NetworkCommissioningCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ScanNetworks(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), chip::ByteSpan(ssid, ssid_Len), + breadcrumb, timeoutMs); +} +CHIP_ERROR chip_ime_AppendCommand_NetworkCommissioning_UpdateThreadNetwork(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + const uint8_t * operationalDataset, + uint32_t operationalDataset_Len, uint64_t breadcrumb, + uint32_t timeoutMs) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::NetworkCommissioningCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.UpdateThreadNetwork(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), + chip::ByteSpan(operationalDataset, operationalDataset_Len), breadcrumb, timeoutMs); +} +CHIP_ERROR chip_ime_AppendCommand_NetworkCommissioning_UpdateWiFiNetwork(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + const uint8_t * ssid, uint32_t ssid_Len, + const uint8_t * credentials, uint32_t credentials_Len, + uint64_t breadcrumb, uint32_t timeoutMs) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::NetworkCommissioningCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.UpdateWiFiNetwork(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), + chip::ByteSpan(ssid, ssid_Len), chip::ByteSpan(credentials, credentials_Len), breadcrumb, + timeoutMs); +} + +CHIP_ERROR chip_ime_ReadAttribute_NetworkCommissioning_ClusterRevision(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::NetworkCommissioningCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +// End of Cluster NetworkCommissioning +// Cluster OnOff + +CHIP_ERROR chip_ime_AppendCommand_OnOff_Off(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::OnOffCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.Off(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} +CHIP_ERROR chip_ime_AppendCommand_OnOff_On(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::OnOffCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.On(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} +CHIP_ERROR chip_ime_AppendCommand_OnOff_Toggle(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::OnOffCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.Toggle(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_OnOff_OnOff(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::OnOffCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeOnOff(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ConfigureAttribute_OnOff_OnOff(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + uint16_t minInterval, uint16_t maxInterval) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::OnOffCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ConfigureAttributeOnOff(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel(), minInterval, + maxInterval); +} +CHIP_ERROR chip_ime_ReadAttribute_OnOff_ClusterRevision(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::OnOffCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +// End of Cluster OnOff +// Cluster OperationalCredentials + +CHIP_ERROR chip_ime_AppendCommand_OperationalCredentials_GetFabricId(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::OperationalCredentialsCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.GetFabricId(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} +CHIP_ERROR chip_ime_AppendCommand_OperationalCredentials_RemoveFabric(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + chip::FabricId fabricId, chip::NodeId nodeId, + uint16_t vendorId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::OperationalCredentialsCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.RemoveFabric(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), fabricId, nodeId, vendorId); +} +CHIP_ERROR chip_ime_AppendCommand_OperationalCredentials_UpdateFabricLabel(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + const uint8_t * label, uint32_t label_Len) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::OperationalCredentialsCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.UpdateFabricLabel(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), + chip::ByteSpan(label, label_Len)); +} + +CHIP_ERROR chip_ime_ReadAttribute_OperationalCredentials_ClusterRevision(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::OperationalCredentialsCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +// End of Cluster OperationalCredentials +// Cluster PumpConfigurationAndControl + +CHIP_ERROR chip_ime_ReadAttribute_PumpConfigurationAndControl_MaxPressure(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::PumpConfigurationAndControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMaxPressure(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_PumpConfigurationAndControl_MaxSpeed(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::PumpConfigurationAndControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMaxSpeed(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_PumpConfigurationAndControl_MaxFlow(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::PumpConfigurationAndControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMaxFlow(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_PumpConfigurationAndControl_EffectiveOperationMode(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::PumpConfigurationAndControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeEffectiveOperationMode(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_PumpConfigurationAndControl_EffectiveControlMode(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::PumpConfigurationAndControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeEffectiveControlMode(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_PumpConfigurationAndControl_Capacity(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::PumpConfigurationAndControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCapacity(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ConfigureAttribute_PumpConfigurationAndControl_Capacity(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, uint16_t minInterval, + uint16_t maxInterval, int16_t change) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::PumpConfigurationAndControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ConfigureAttributeCapacity(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel(), minInterval, + maxInterval, change); +} +CHIP_ERROR chip_ime_ReadAttribute_PumpConfigurationAndControl_OperationMode(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::PumpConfigurationAndControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeOperationMode(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_PumpConfigurationAndControl_ClusterRevision(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::PumpConfigurationAndControlCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +// End of Cluster PumpConfigurationAndControl +// Cluster Scenes + +CHIP_ERROR chip_ime_AppendCommand_Scenes_AddScene(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, + uint16_t groupId, uint8_t sceneId, uint16_t transitionTime, + const uint8_t * sceneName, uint32_t sceneName_Len, chip::ClusterId clusterId, + uint8_t length, uint8_t value) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ScenesCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.AddScene(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), groupId, sceneId, transitionTime, + chip::ByteSpan(sceneName, sceneName_Len), clusterId, length, value); +} +CHIP_ERROR chip_ime_AppendCommand_Scenes_GetSceneMembership(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t groupId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ScenesCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.GetSceneMembership(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), groupId); +} +CHIP_ERROR chip_ime_AppendCommand_Scenes_RecallScene(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t groupId, uint8_t sceneId, uint16_t transitionTime) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ScenesCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.RecallScene(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), groupId, sceneId, + transitionTime); +} +CHIP_ERROR chip_ime_AppendCommand_Scenes_RemoveAllScenes(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t groupId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ScenesCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.RemoveAllScenes(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), groupId); +} +CHIP_ERROR chip_ime_AppendCommand_Scenes_RemoveScene(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t groupId, uint8_t sceneId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ScenesCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.RemoveScene(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), groupId, sceneId); +} +CHIP_ERROR chip_ime_AppendCommand_Scenes_StoreScene(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t groupId, uint8_t sceneId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ScenesCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.StoreScene(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), groupId, sceneId); +} +CHIP_ERROR chip_ime_AppendCommand_Scenes_ViewScene(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, + uint16_t groupId, uint8_t sceneId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ScenesCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ViewScene(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), groupId, sceneId); +} + +CHIP_ERROR chip_ime_ReadAttribute_Scenes_SceneCount(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ScenesCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeSceneCount(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Scenes_CurrentScene(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ScenesCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCurrentScene(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Scenes_CurrentGroup(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ScenesCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCurrentGroup(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Scenes_SceneValid(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ScenesCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeSceneValid(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Scenes_NameSupport(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ScenesCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeNameSupport(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Scenes_ClusterRevision(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ScenesCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +// End of Cluster Scenes +// Cluster Switch + +CHIP_ERROR chip_ime_ReadAttribute_Switch_NumberOfPositions(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::SwitchCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeNumberOfPositions(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Switch_CurrentPosition(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::SwitchCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCurrentPosition(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ConfigureAttribute_Switch_CurrentPosition(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + uint16_t minInterval, uint16_t maxInterval, uint8_t change) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::SwitchCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ConfigureAttributeCurrentPosition(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel(), + minInterval, maxInterval, change); +} +CHIP_ERROR chip_ime_ReadAttribute_Switch_ClusterRevision(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::SwitchCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +// End of Cluster Switch +// Cluster TemperatureMeasurement + +CHIP_ERROR chip_ime_ReadAttribute_TemperatureMeasurement_MeasuredValue(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::TemperatureMeasurementCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMeasuredValue(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ConfigureAttribute_TemperatureMeasurement_MeasuredValue(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, uint16_t minInterval, + uint16_t maxInterval, int16_t change) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::TemperatureMeasurementCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ConfigureAttributeMeasuredValue(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel(), minInterval, + maxInterval, change); +} +CHIP_ERROR chip_ime_ReadAttribute_TemperatureMeasurement_MinMeasuredValue(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::TemperatureMeasurementCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMinMeasuredValue(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_TemperatureMeasurement_MaxMeasuredValue(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::TemperatureMeasurementCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMaxMeasuredValue(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_TemperatureMeasurement_ClusterRevision(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::TemperatureMeasurementCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +// End of Cluster TemperatureMeasurement +// Cluster Thermostat + +CHIP_ERROR chip_ime_AppendCommand_Thermostat_ClearWeeklySchedule(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ThermostatCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ClearWeeklySchedule(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} +CHIP_ERROR chip_ime_AppendCommand_Thermostat_GetRelayStatusLog(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ThermostatCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.GetRelayStatusLog(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} +CHIP_ERROR chip_ime_AppendCommand_Thermostat_GetWeeklySchedule(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t daysToReturn, uint8_t modeToReturn) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ThermostatCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.GetWeeklySchedule(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), daysToReturn, + modeToReturn); +} +CHIP_ERROR chip_ime_AppendCommand_Thermostat_SetWeeklySchedule(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t numberOfTransitionsForSequence, + uint8_t dayOfWeekForSequence, uint8_t modeForSequence, + uint8_t payload) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ThermostatCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.SetWeeklySchedule(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), + numberOfTransitionsForSequence, dayOfWeekForSequence, modeForSequence, payload); +} +CHIP_ERROR chip_ime_AppendCommand_Thermostat_SetpointRaiseLower(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t mode, int8_t amount) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ThermostatCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.SetpointRaiseLower(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), mode, amount); +} + +CHIP_ERROR chip_ime_ReadAttribute_Thermostat_LocalTemperature(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ThermostatCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeLocalTemperature(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ConfigureAttribute_Thermostat_LocalTemperature(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, uint16_t minInterval, + uint16_t maxInterval, int16_t change) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ThermostatCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ConfigureAttributeLocalTemperature(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel(), + minInterval, maxInterval, change); +} +CHIP_ERROR chip_ime_ReadAttribute_Thermostat_OccupiedCoolingSetpoint(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ThermostatCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeOccupiedCoolingSetpoint(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Thermostat_OccupiedHeatingSetpoint(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ThermostatCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeOccupiedHeatingSetpoint(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Thermostat_ControlSequenceOfOperation(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ThermostatCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeControlSequenceOfOperation(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Thermostat_SystemMode(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ThermostatCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeSystemMode(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_Thermostat_ClusterRevision(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ThermostatCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +// End of Cluster Thermostat +// Cluster WindowCovering + +CHIP_ERROR chip_ime_AppendCommand_WindowCovering_WindowCoveringDownClose(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::WindowCoveringCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.WindowCoveringDownClose(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} +CHIP_ERROR chip_ime_AppendCommand_WindowCovering_WindowCoveringGoToLiftPercentage(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + uint8_t percentageLiftValue) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::WindowCoveringCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.WindowCoveringGoToLiftPercentage(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), + percentageLiftValue); +} +CHIP_ERROR chip_ime_AppendCommand_WindowCovering_WindowCoveringGoToLiftValue(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + uint16_t liftValue) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::WindowCoveringCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.WindowCoveringGoToLiftValue(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), liftValue); +} +CHIP_ERROR chip_ime_AppendCommand_WindowCovering_WindowCoveringGoToTiltPercentage(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + uint8_t percentageTiltValue) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::WindowCoveringCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.WindowCoveringGoToTiltPercentage(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), + percentageTiltValue); +} +CHIP_ERROR chip_ime_AppendCommand_WindowCovering_WindowCoveringGoToTiltValue(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + uint16_t tiltValue) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::WindowCoveringCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.WindowCoveringGoToTiltValue(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), tiltValue); +} +CHIP_ERROR chip_ime_AppendCommand_WindowCovering_WindowCoveringStop(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::WindowCoveringCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.WindowCoveringStop(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} +CHIP_ERROR chip_ime_AppendCommand_WindowCovering_WindowCoveringUpOpen(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::WindowCoveringCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.WindowCoveringUpOpen(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_WindowCovering_WindowCoveringType(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::WindowCoveringCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeWindowCoveringType(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ConfigureAttribute_WindowCovering_WindowCoveringType(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, uint16_t minInterval, + uint16_t maxInterval) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::WindowCoveringCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ConfigureAttributeWindowCoveringType(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel(), + minInterval, maxInterval); +} +CHIP_ERROR chip_ime_ReadAttribute_WindowCovering_CurrentPositionLift(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::WindowCoveringCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCurrentPositionLift(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ConfigureAttribute_WindowCovering_CurrentPositionLift(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, uint16_t minInterval, + uint16_t maxInterval, uint16_t change) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::WindowCoveringCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ConfigureAttributeCurrentPositionLift(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel(), + minInterval, maxInterval, change); +} +CHIP_ERROR chip_ime_ReadAttribute_WindowCovering_CurrentPositionTilt(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::WindowCoveringCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCurrentPositionTilt(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ConfigureAttribute_WindowCovering_CurrentPositionTilt(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, uint16_t minInterval, + uint16_t maxInterval, uint16_t change) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::WindowCoveringCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ConfigureAttributeCurrentPositionTilt(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel(), + minInterval, maxInterval, change); +} +CHIP_ERROR chip_ime_ReadAttribute_WindowCovering_ConfigStatus(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::WindowCoveringCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeConfigStatus(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ConfigureAttribute_WindowCovering_ConfigStatus(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, uint16_t minInterval, + uint16_t maxInterval) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::WindowCoveringCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ConfigureAttributeConfigStatus(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel(), minInterval, + maxInterval); +} +CHIP_ERROR chip_ime_ReadAttribute_WindowCovering_InstalledOpenLimitLift(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::WindowCoveringCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeInstalledOpenLimitLift(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_WindowCovering_InstalledClosedLimitLift(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::WindowCoveringCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeInstalledClosedLimitLift(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_WindowCovering_InstalledOpenLimitTilt(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::WindowCoveringCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeInstalledOpenLimitTilt(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_WindowCovering_InstalledClosedLimitTilt(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::WindowCoveringCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeInstalledClosedLimitTilt(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_WindowCovering_Mode(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::WindowCoveringCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMode(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_WindowCovering_ClusterRevision(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::WindowCoveringCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +// End of Cluster WindowCovering } diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 47a2fdb02058f5..6e20fe9df71d10 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -294,8 +294,6 @@ def ListClusterCommands(self): "groupId": "int", }, }, - "IasZone": { - }, "Identify": { "Identify": { "identifyTime": "int", @@ -450,6 +448,8 @@ def ListClusterCommands(self): "sceneId": "int", }, }, + "Switch": { + }, "TemperatureMeasurement": { }, "Thermostat": { @@ -610,14 +610,6 @@ def ListClusterAttributes(self): "NameSupport", "ClusterRevision", ], - "IasZone": [ - "ZoneState", - "ZoneType", - "ZoneStatus", - "IasCieAddress", - "ZoneId", - "ClusterRevision", - ], "Identify": [ "IdentifyTime", "ClusterRevision", @@ -657,6 +649,11 @@ def ListClusterAttributes(self): "NameSupport", "ClusterRevision", ], + "Switch": [ + "NumberOfPositions", + "CurrentPosition", + "ClusterRevision", + ], "TemperatureMeasurement": [ "MeasuredValue", "MinMeasuredValue", @@ -1305,18 +1302,6 @@ def ClusterGroups_ReadAttributeNameSupport(self, device: ctypes.c_void_p, ZCLend return self._chipLib.chip_ime_ReadAttribute_Groups_NameSupport(device, ZCLendpoint, ZCLgroupid) def ClusterGroups_ReadAttributeClusterRevision(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): return self._chipLib.chip_ime_ReadAttribute_Groups_ClusterRevision(device, ZCLendpoint, ZCLgroupid) - def ClusterIasZone_ReadAttributeZoneState(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): - return self._chipLib.chip_ime_ReadAttribute_IasZone_ZoneState(device, ZCLendpoint, ZCLgroupid) - def ClusterIasZone_ReadAttributeZoneType(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): - return self._chipLib.chip_ime_ReadAttribute_IasZone_ZoneType(device, ZCLendpoint, ZCLgroupid) - def ClusterIasZone_ReadAttributeZoneStatus(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): - return self._chipLib.chip_ime_ReadAttribute_IasZone_ZoneStatus(device, ZCLendpoint, ZCLgroupid) - def ClusterIasZone_ReadAttributeIasCieAddress(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): - return self._chipLib.chip_ime_ReadAttribute_IasZone_IasCieAddress(device, ZCLendpoint, ZCLgroupid) - def ClusterIasZone_ReadAttributeZoneId(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): - return self._chipLib.chip_ime_ReadAttribute_IasZone_ZoneId(device, ZCLendpoint, ZCLgroupid) - def ClusterIasZone_ReadAttributeClusterRevision(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): - return self._chipLib.chip_ime_ReadAttribute_IasZone_ClusterRevision(device, ZCLendpoint, ZCLgroupid) def ClusterIdentify_ReadAttributeIdentifyTime(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): return self._chipLib.chip_ime_ReadAttribute_Identify_IdentifyTime(device, ZCLendpoint, ZCLgroupid) def ClusterIdentify_ReadAttributeClusterRevision(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): @@ -1369,6 +1354,14 @@ def ClusterScenes_ReadAttributeNameSupport(self, device: ctypes.c_void_p, ZCLend return self._chipLib.chip_ime_ReadAttribute_Scenes_NameSupport(device, ZCLendpoint, ZCLgroupid) def ClusterScenes_ReadAttributeClusterRevision(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): return self._chipLib.chip_ime_ReadAttribute_Scenes_ClusterRevision(device, ZCLendpoint, ZCLgroupid) + def ClusterSwitch_ReadAttributeNumberOfPositions(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_Switch_NumberOfPositions(device, ZCLendpoint, ZCLgroupid) + def ClusterSwitch_ReadAttributeCurrentPosition(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_Switch_CurrentPosition(device, ZCLendpoint, ZCLgroupid) + def ClusterSwitch_ConfigureAttributeCurrentPosition(self, device: ctypes.c_void_p, ZCLendpoint: int, minInterval: int, maxInterval: int, change: int): + return self._chipLib.chip_ime_ConfigureAttribute_Switch_CurrentPosition(device, ZCLendpoint, minInterval, maxInterval, change) + def ClusterSwitch_ReadAttributeClusterRevision(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_Switch_ClusterRevision(device, ZCLendpoint, ZCLgroupid) def ClusterTemperatureMeasurement_ReadAttributeMeasuredValue(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): return self._chipLib.chip_ime_ReadAttribute_TemperatureMeasurement_MeasuredValue(device, ZCLendpoint, ZCLgroupid) def ClusterTemperatureMeasurement_ConfigureAttributeMeasuredValue(self, device: ctypes.c_void_p, ZCLendpoint: int, minInterval: int, maxInterval: int, change: int): @@ -1894,25 +1887,6 @@ def InitLib(self, chipLib): # Cluster Groups ReadAttribute ClusterRevision self._chipLib.chip_ime_ReadAttribute_Groups_ClusterRevision.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] self._chipLib.chip_ime_ReadAttribute_Groups_ClusterRevision.restype = ctypes.c_uint32 - # Cluster IasZone - # Cluster IasZone ReadAttribute ZoneState - self._chipLib.chip_ime_ReadAttribute_IasZone_ZoneState.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] - self._chipLib.chip_ime_ReadAttribute_IasZone_ZoneState.restype = ctypes.c_uint32 - # Cluster IasZone ReadAttribute ZoneType - self._chipLib.chip_ime_ReadAttribute_IasZone_ZoneType.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] - self._chipLib.chip_ime_ReadAttribute_IasZone_ZoneType.restype = ctypes.c_uint32 - # Cluster IasZone ReadAttribute ZoneStatus - self._chipLib.chip_ime_ReadAttribute_IasZone_ZoneStatus.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] - self._chipLib.chip_ime_ReadAttribute_IasZone_ZoneStatus.restype = ctypes.c_uint32 - # Cluster IasZone ReadAttribute IasCieAddress - self._chipLib.chip_ime_ReadAttribute_IasZone_IasCieAddress.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] - self._chipLib.chip_ime_ReadAttribute_IasZone_IasCieAddress.restype = ctypes.c_uint32 - # Cluster IasZone ReadAttribute ZoneId - self._chipLib.chip_ime_ReadAttribute_IasZone_ZoneId.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] - self._chipLib.chip_ime_ReadAttribute_IasZone_ZoneId.restype = ctypes.c_uint32 - # Cluster IasZone ReadAttribute ClusterRevision - self._chipLib.chip_ime_ReadAttribute_IasZone_ClusterRevision.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] - self._chipLib.chip_ime_ReadAttribute_IasZone_ClusterRevision.restype = ctypes.c_uint32 # Cluster Identify # Cluster Identify Command Identify self._chipLib.chip_ime_AppendCommand_Identify_Identify.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint16] @@ -2098,6 +2072,19 @@ def InitLib(self, chipLib): # Cluster Scenes ReadAttribute ClusterRevision self._chipLib.chip_ime_ReadAttribute_Scenes_ClusterRevision.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] self._chipLib.chip_ime_ReadAttribute_Scenes_ClusterRevision.restype = ctypes.c_uint32 + # Cluster Switch + # Cluster Switch ReadAttribute NumberOfPositions + self._chipLib.chip_ime_ReadAttribute_Switch_NumberOfPositions.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_Switch_NumberOfPositions.restype = ctypes.c_uint32 + # Cluster Switch ReadAttribute CurrentPosition + self._chipLib.chip_ime_ReadAttribute_Switch_CurrentPosition.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_Switch_CurrentPosition.restype = ctypes.c_uint32 + # Cluster Switch ConfigureAttribute CurrentPosition + self._chipLib.chip_ime_ConfigureAttribute_Switch_CurrentPosition.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint16, ctypes.c_uint8] + self._chipLib.chip_ime_ConfigureAttribute_Switch_CurrentPosition.restype = ctypes.c_uint32 + # Cluster Switch ReadAttribute ClusterRevision + self._chipLib.chip_ime_ReadAttribute_Switch_ClusterRevision.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_Switch_ClusterRevision.restype = ctypes.c_uint32 # Cluster TemperatureMeasurement # Cluster TemperatureMeasurement ReadAttribute MeasuredValue self._chipLib.chip_ime_ReadAttribute_TemperatureMeasurement_MeasuredValue.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] diff --git a/src/controller/python/gen/CHIPClientCallbacks.cpp b/src/controller/python/gen/CHIPClientCallbacks.cpp index 8946a0ba286c31..005ec626c44adf 100644 --- a/src/controller/python/gen/CHIPClientCallbacks.cpp +++ b/src/controller/python/gen/CHIPClientCallbacks.cpp @@ -355,6 +355,157 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag switch (clusterId) { + case 0x001D: + switch (attributeId) + { + case 0x0000: // DeviceType + { + _DeviceType data[count]; + for (size_t i = 0; i < count; i++) + { + data[i].type = emberAfGetInt32u(message, 0, messageLen); + message += 4; + CHECK_MESSAGE_LENGTH(4); + data[i].revision = emberAfGetInt16u(message, 0, messageLen); + message += 2; + CHECK_MESSAGE_LENGTH(2); + } + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, count, data); + break; + } + case 0x0001: // CLUSTER_ID + { + chip::ClusterId data[count]; + for (size_t i = 0; i < count; i++) + { + data[i] = emberAfGetInt16u(message, 0, messageLen); + message += 2; + CHECK_MESSAGE_LENGTH(2); + } + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, count, data); + break; + } + case 0x0002: // CLUSTER_ID + { + chip::ClusterId data[count]; + for (size_t i = 0; i < count; i++) + { + data[i] = emberAfGetInt16u(message, 0, messageLen); + message += 2; + CHECK_MESSAGE_LENGTH(2); + } + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, count, data); + break; + } + case 0x0003: // ENDPOINT_ID + { + chip::EndpointId data[count]; + for (size_t i = 0; i < count; i++) + { + data[i] = emberAfGetInt8u(message, 0, messageLen); + message += 1; + CHECK_MESSAGE_LENGTH(1); + } + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, count, data); + break; + } + } + break; + case 0xF004: + switch (attributeId) + { + case 0x0000: // GroupState + { + _GroupState data[count]; + for (size_t i = 0; i < count; i++) + { + data[i].VendorId = emberAfGetInt16u(message, 0, messageLen); + message += 2; + CHECK_MESSAGE_LENGTH(2); + data[i].VendorGroupId = emberAfGetInt16u(message, 0, messageLen); + message += 2; + CHECK_MESSAGE_LENGTH(2); + data[i].GroupKeySetIndex = emberAfGetInt16u(message, 0, messageLen); + message += 2; + CHECK_MESSAGE_LENGTH(2); + } + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, count, data); + break; + } + case 0x0001: // GroupKey + { + _GroupKey data[count]; + for (size_t i = 0; i < count; i++) + { + data[i].VendorId = emberAfGetInt16u(message, 0, messageLen); + message += 2; + CHECK_MESSAGE_LENGTH(2); + data[i].GroupKeyIndex = emberAfGetInt16u(message, 0, messageLen); + message += 2; + CHECK_MESSAGE_LENGTH(2); + data[i].GroupKeyRoot = emberAfGetString(message, 0, messageLen); + message += 16; + CHECK_MESSAGE_LENGTH(16); + data[i].GroupKeyEpochStartTime = emberAfGetInt64u(message, 0, messageLen); + message += 8; + CHECK_MESSAGE_LENGTH(8); + data[i].GroupKeySecurityPolicy = emberAfGetInt8u(message, 0, messageLen); + message += 1; + CHECK_MESSAGE_LENGTH(1); + } + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, count, data); + break; + } + } + break; + case 0x003E: + switch (attributeId) + { + case 0x0001: // FabricDescriptor + { + _FabricDescriptor data[count]; + for (size_t i = 0; i < count; i++) + { + data[i].FabricId = emberAfGetInt64u(message, 0, messageLen); + message += 8; + CHECK_MESSAGE_LENGTH(8); + data[i].VendorId = emberAfGetInt16u(message, 0, messageLen); + message += 2; + CHECK_MESSAGE_LENGTH(2); + data[i].Label = emberAfGetString(message, 0, messageLen); + message += 32; + CHECK_MESSAGE_LENGTH(32); + data[i].NodeId = emberAfGetInt64u(message, 0, messageLen); + message += 8; + CHECK_MESSAGE_LENGTH(8); + } + + Callback::Callback * cb = + Callback::Callback::FromCancelable( + onSuccessCallback); + cb->mCall(cb->mContext, count, data); + break; + } + } + break; } break; } @@ -1221,6 +1372,21 @@ bool emberAfGeneralCommissioningClusterArmFailSafeResponseCallback(chip::app::Co return true; } +bool emberAfGeneralCommissioningClusterCommissioningCompleteResponseCallback(chip::app::Command * commandObj, uint8_t errorCode, + uint8_t * debugText) +{ + ChipLogProgress(Zcl, "CommissioningCompleteResponse:"); + ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); + ChipLogProgress(Zcl, " debugText: %s", debugText); + + GET_RESPONSE_CALLBACKS("GeneralCommissioningClusterCommissioningCompleteResponseCallback"); + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, errorCode, debugText); + return true; +} + bool emberAfGeneralCommissioningClusterSetRegulatoryConfigResponseCallback(chip::app::Command * commandObj, uint8_t errorCode, uint8_t * debugText) { @@ -1457,6 +1623,19 @@ bool emberAfNetworkCommissioningClusterUpdateWiFiNetworkResponseCallback(chip::a return true; } +bool emberAfOperationalCredentialsClusterGetFabricIdResponseCallback(chip::app::Command * commandObj, chip::FabricId FabricId) +{ + ChipLogProgress(Zcl, "GetFabricIdResponse:"); + ChipLogProgress(Zcl, " FabricId: %" PRIu64 "", FabricId); + + GET_RESPONSE_CALLBACKS("OperationalCredentialsClusterGetFabricIdResponseCallback"); + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, FabricId); + return true; +} + bool emberAfScenesClusterAddSceneResponseCallback(chip::app::Command * commandObj, uint8_t status, uint16_t groupId, uint8_t sceneId) { diff --git a/src/controller/python/gen/CHIPClientCallbacks.h b/src/controller/python/gen/CHIPClientCallbacks.h index 70ef50abbcbc5d..8bb5691a5e5d10 100644 --- a/src/controller/python/gen/CHIPClientCallbacks.h +++ b/src/controller/python/gen/CHIPClientCallbacks.h @@ -72,6 +72,8 @@ typedef void (*DoorLockClusterSetYeardayScheduleResponseCallback)(void * context typedef void (*DoorLockClusterUnlockDoorResponseCallback)(void * context); typedef void (*DoorLockClusterUnlockWithTimeoutResponseCallback)(void * context); typedef void (*GeneralCommissioningClusterArmFailSafeResponseCallback)(void * context, uint8_t errorCode, uint8_t * debugText); +typedef void (*GeneralCommissioningClusterCommissioningCompleteResponseCallback)(void * context, uint8_t errorCode, + uint8_t * debugText); typedef void (*GeneralCommissioningClusterSetRegulatoryConfigResponseCallback)(void * context, uint8_t errorCode, uint8_t * debugText); typedef void (*GroupsClusterAddGroupResponseCallback)(void * context, uint16_t groupId); @@ -92,6 +94,7 @@ typedef void (*NetworkCommissioningClusterUpdateThreadNetworkResponseCallback)(v uint8_t * debugText); typedef void (*NetworkCommissioningClusterUpdateWiFiNetworkResponseCallback)(void * context, uint8_t errorCode, uint8_t * debugText); +typedef void (*OperationalCredentialsClusterGetFabricIdResponseCallback)(void * context, chip::FabricId FabricId); typedef void (*ScenesClusterAddSceneResponseCallback)(void * context, uint16_t groupId, uint8_t sceneId); typedef void (*ScenesClusterGetSceneMembershipResponseCallback)(void * context, uint8_t capacity, uint16_t groupId, uint8_t sceneCount, @@ -104,3 +107,10 @@ typedef void (*ScenesClusterViewSceneResponseCallback)(void * context, uint16_t /* TYPE WARNING: array array defaults to */ uint8_t * extensionFieldSets); // List specific responses +typedef void (*DescriptorDeviceListListAttributeCallback)(void * context, uint16_t count, _DeviceType * entries); +typedef void (*DescriptorServerListListAttributeCallback)(void * context, uint16_t count, chip::ClusterId * entries); +typedef void (*DescriptorClientListListAttributeCallback)(void * context, uint16_t count, chip::ClusterId * entries); +typedef void (*DescriptorPartsListListAttributeCallback)(void * context, uint16_t count, chip::EndpointId * entries); +typedef void (*GroupKeyManagementGroupsListAttributeCallback)(void * context, uint16_t count, _GroupState * entries); +typedef void (*GroupKeyManagementGroupKeysListAttributeCallback)(void * context, uint16_t count, _GroupKey * entries); +typedef void (*OperationalCredentialsFabricsListListAttributeCallback)(void * context, uint16_t count, _FabricDescriptor * entries); diff --git a/src/controller/python/gen/CHIPClusters.cpp b/src/controller/python/gen/CHIPClusters.cpp index f4f1b81c71d9e2..e6872686811932 100644 --- a/src/controller/python/gen/CHIPClusters.cpp +++ b/src/controller/python/gen/CHIPClusters.cpp @@ -1630,6 +1630,54 @@ CHIP_ERROR ColorControlCluster::ReadAttributeClusterRevision(Callback::Cancelabl return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); } +// Descriptor Cluster Commands +// Descriptor Cluster Attributes +CHIP_ERROR DescriptorCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeDescriptorClusterDiscoverAttributes(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} +CHIP_ERROR DescriptorCluster::ReadAttributeDeviceList(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeDescriptorClusterReadDeviceListAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR DescriptorCluster::ReadAttributeServerList(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeDescriptorClusterReadServerListAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR DescriptorCluster::ReadAttributeClientList(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeDescriptorClusterReadClientListAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR DescriptorCluster::ReadAttributePartsList(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeDescriptorClusterReadPartsListAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR DescriptorCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeDescriptorClusterReadClusterRevisionAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + // DoorLock Cluster Commands CHIP_ERROR DoorLockCluster::ClearAllPins(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { @@ -2440,6 +2488,32 @@ CHIP_ERROR GeneralCommissioningCluster::ArmFailSafe(Callback::Cancelable * onSuc #endif } +CHIP_ERROR GeneralCommissioningCluster::CommissioningComplete(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kCommissioningCompleteCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + // Command takes no arguments. + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeGeneralCommissioningClusterCommissioningCompleteCommand(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + CHIP_ERROR GeneralCommissioningCluster::SetRegulatoryConfig(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t location, chip::ByteSpan countryCode, uint64_t breadcrumb, uint32_t timeoutMs) @@ -2517,6 +2591,39 @@ CHIP_ERROR GeneralCommissioningCluster::ReadAttributeClusterRevision(Callback::C return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); } +// GroupKeyManagement Cluster Commands +// GroupKeyManagement Cluster Attributes +CHIP_ERROR GroupKeyManagementCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeGroupKeyManagementClusterDiscoverAttributes(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} +CHIP_ERROR GroupKeyManagementCluster::ReadAttributeGroups(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeGroupKeyManagementClusterReadGroupsAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR GroupKeyManagementCluster::ReadAttributeGroupKeys(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeGroupKeyManagementClusterReadGroupKeysAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR GroupKeyManagementCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeGroupKeyManagementClusterReadClusterRevisionAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + // Groups Cluster Commands CHIP_ERROR GroupsCluster::AddGroup(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t groupId, chip::ByteSpan groupName) @@ -3596,6 +3703,224 @@ CHIP_ERROR OnOffCluster::ReadAttributeClusterRevision(Callback::Cancelable * onS return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); } +// OperationalCredentials Cluster Commands +CHIP_ERROR OperationalCredentialsCluster::GetFabricId(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kGetFabricIdCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + // Command takes no arguments. + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeOperationalCredentialsClusterGetFabricIdCommand(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + +CHIP_ERROR OperationalCredentialsCluster::RemoveFabric(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, chip::FabricId fabricId, + chip::NodeId nodeId, uint16_t vendorId) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kRemoveFabricCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + TLV::TLVWriter * writer = ZCLcommand->GetCommandDataElementTLVWriter(); + uint8_t argSeqNumber = 0; + // fabricId: fabricId + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), fabricId)); + // nodeId: nodeId + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), nodeId)); + // vendorId: int16u + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), vendorId)); + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodeOperationalCredentialsClusterRemoveFabricCommand(seqNum, mEndpoint, fabricId, nodeId, vendorId); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + +CHIP_ERROR OperationalCredentialsCluster::UpdateFabricLabel(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, chip::ByteSpan label) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kUpdateFabricLabelCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + TLV::TLVWriter * writer = ZCLcommand->GetCommandDataElementTLVWriter(); + uint8_t argSeqNumber = 0; + // label: charString + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), label)); + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodeOperationalCredentialsClusterUpdateFabricLabelCommand(seqNum, mEndpoint, label); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + +// OperationalCredentials Cluster Attributes +CHIP_ERROR OperationalCredentialsCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeOperationalCredentialsClusterDiscoverAttributes(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} +CHIP_ERROR OperationalCredentialsCluster::ReadAttributeFabricsList(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeOperationalCredentialsClusterReadFabricsListAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR OperationalCredentialsCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeOperationalCredentialsClusterReadClusterRevisionAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +// PumpConfigurationAndControl Cluster Commands +// PumpConfigurationAndControl Cluster Attributes +CHIP_ERROR PumpConfigurationAndControlCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodePumpConfigurationAndControlClusterDiscoverAttributes(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} +CHIP_ERROR PumpConfigurationAndControlCluster::ReadAttributeMaxPressure(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodePumpConfigurationAndControlClusterReadMaxPressureAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR PumpConfigurationAndControlCluster::ReadAttributeMaxSpeed(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodePumpConfigurationAndControlClusterReadMaxSpeedAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR PumpConfigurationAndControlCluster::ReadAttributeMaxFlow(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodePumpConfigurationAndControlClusterReadMaxFlowAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR PumpConfigurationAndControlCluster::ReadAttributeEffectiveOperationMode(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodePumpConfigurationAndControlClusterReadEffectiveOperationModeAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR PumpConfigurationAndControlCluster::ReadAttributeEffectiveControlMode(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodePumpConfigurationAndControlClusterReadEffectiveControlModeAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR PumpConfigurationAndControlCluster::ReadAttributeCapacity(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodePumpConfigurationAndControlClusterReadCapacityAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR PumpConfigurationAndControlCluster::ConfigureAttributeCapacity(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, + uint16_t minInterval, uint16_t maxInterval, + int16_t change) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodePumpConfigurationAndControlClusterConfigureCapacityAttribute(seqNum, mEndpoint, minInterval, maxInterval, change); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR PumpConfigurationAndControlCluster::ReportAttributeCapacity(Callback::Cancelable * onReportCallback) +{ + return RequestAttributeReporting(0x0013, onReportCallback); +} + +CHIP_ERROR PumpConfigurationAndControlCluster::ReadAttributeOperationMode(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodePumpConfigurationAndControlClusterReadOperationModeAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR PumpConfigurationAndControlCluster::WriteAttributeOperationMode(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint8_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodePumpConfigurationAndControlClusterWriteOperationModeAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR PumpConfigurationAndControlCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodePumpConfigurationAndControlClusterReadClusterRevisionAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + // Scenes Cluster Commands CHIP_ERROR ScenesCluster::AddScene(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t groupId, uint8_t sceneId, uint16_t transitionTime, chip::ByteSpan sceneName, @@ -3880,30 +4205,77 @@ CHIP_ERROR ScenesCluster::ReadAttributeClusterRevision(Callback::Cancelable * on return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); } -// TemperatureMeasurement Cluster Commands -// TemperatureMeasurement Cluster Attributes -CHIP_ERROR TemperatureMeasurementCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback) +// Switch Cluster Commands +// Switch Cluster Attributes +CHIP_ERROR SwitchCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { uint8_t seqNum = mDevice->GetNextSequenceNumber(); - System::PacketBufferHandle encodedCommand = encodeTemperatureMeasurementClusterDiscoverAttributes(seqNum, mEndpoint); + System::PacketBufferHandle encodedCommand = encodeSwitchClusterDiscoverAttributes(seqNum, mEndpoint); return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); } -CHIP_ERROR TemperatureMeasurementCluster::ReadAttributeMeasuredValue(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback) +CHIP_ERROR SwitchCluster::ReadAttributeNumberOfPositions(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) { uint8_t seqNum = mDevice->GetNextSequenceNumber(); - System::PacketBufferHandle encodedCommand = encodeTemperatureMeasurementClusterReadMeasuredValueAttribute(seqNum, mEndpoint); + System::PacketBufferHandle encodedCommand = encodeSwitchClusterReadNumberOfPositionsAttribute(seqNum, mEndpoint); return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); } -CHIP_ERROR TemperatureMeasurementCluster::ConfigureAttributeMeasuredValue(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, - uint16_t minInterval, uint16_t maxInterval, - int16_t change) +CHIP_ERROR SwitchCluster::ReadAttributeCurrentPosition(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) { - uint8_t seqNum = mDevice->GetNextSequenceNumber(); - System::PacketBufferHandle encodedCommand = + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeSwitchClusterReadCurrentPositionAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR SwitchCluster::ConfigureAttributeCurrentPosition(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t minInterval, + uint16_t maxInterval, uint8_t change) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodeSwitchClusterConfigureCurrentPositionAttribute(seqNum, mEndpoint, minInterval, maxInterval, change); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR SwitchCluster::ReportAttributeCurrentPosition(Callback::Cancelable * onReportCallback) +{ + return RequestAttributeReporting(0x0001, onReportCallback); +} + +CHIP_ERROR SwitchCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeSwitchClusterReadClusterRevisionAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +// TemperatureMeasurement Cluster Commands +// TemperatureMeasurement Cluster Attributes +CHIP_ERROR TemperatureMeasurementCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTemperatureMeasurementClusterDiscoverAttributes(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} +CHIP_ERROR TemperatureMeasurementCluster::ReadAttributeMeasuredValue(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTemperatureMeasurementClusterReadMeasuredValueAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TemperatureMeasurementCluster::ConfigureAttributeMeasuredValue(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, + uint16_t minInterval, uint16_t maxInterval, + int16_t change) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTemperatureMeasurementClusterConfigureMeasuredValueAttribute(seqNum, mEndpoint, minInterval, maxInterval, change); return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); } @@ -3937,5 +4309,619 @@ CHIP_ERROR TemperatureMeasurementCluster::ReadAttributeClusterRevision(Callback: return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); } +// Thermostat Cluster Commands +CHIP_ERROR ThermostatCluster::ClearWeeklySchedule(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kClearWeeklyScheduleCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + // Command takes no arguments. + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeThermostatClusterClearWeeklyScheduleCommand(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + +CHIP_ERROR ThermostatCluster::GetRelayStatusLog(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kGetRelayStatusLogCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + // Command takes no arguments. + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeThermostatClusterGetRelayStatusLogCommand(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + +CHIP_ERROR ThermostatCluster::GetWeeklySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t daysToReturn, uint8_t modeToReturn) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kGetWeeklyScheduleCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + TLV::TLVWriter * writer = ZCLcommand->GetCommandDataElementTLVWriter(); + uint8_t argSeqNumber = 0; + // daysToReturn: dayOfWeek + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), daysToReturn)); + // modeToReturn: modeForSequence + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), modeToReturn)); + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodeThermostatClusterGetWeeklyScheduleCommand(seqNum, mEndpoint, daysToReturn, modeToReturn); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + +CHIP_ERROR ThermostatCluster::SetWeeklySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t numberOfTransitionsForSequence, uint8_t dayOfWeekForSequence, + uint8_t modeForSequence, uint8_t payload) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kSetWeeklyScheduleCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + TLV::TLVWriter * writer = ZCLcommand->GetCommandDataElementTLVWriter(); + uint8_t argSeqNumber = 0; + // numberOfTransitionsForSequence: enum8 + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), numberOfTransitionsForSequence)); + // dayOfWeekForSequence: dayOfWeek + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), dayOfWeekForSequence)); + // modeForSequence: modeForSequence + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), modeForSequence)); + // payload: int8u + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), payload)); + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeThermostatClusterSetWeeklyScheduleCommand( + seqNum, mEndpoint, numberOfTransitionsForSequence, dayOfWeekForSequence, modeForSequence, payload); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + +CHIP_ERROR ThermostatCluster::SetpointRaiseLower(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t mode, int8_t amount) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kSetpointRaiseLowerCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + TLV::TLVWriter * writer = ZCLcommand->GetCommandDataElementTLVWriter(); + uint8_t argSeqNumber = 0; + // mode: setpointAdjustMode + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), mode)); + // amount: int8s + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), amount)); + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeThermostatClusterSetpointRaiseLowerCommand(seqNum, mEndpoint, mode, amount); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + +// Thermostat Cluster Attributes +CHIP_ERROR ThermostatCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeThermostatClusterDiscoverAttributes(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} +CHIP_ERROR ThermostatCluster::ReadAttributeLocalTemperature(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeThermostatClusterReadLocalTemperatureAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR ThermostatCluster::ConfigureAttributeLocalTemperature(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t minInterval, + uint16_t maxInterval, int16_t change) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodeThermostatClusterConfigureLocalTemperatureAttribute(seqNum, mEndpoint, minInterval, maxInterval, change); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR ThermostatCluster::ReportAttributeLocalTemperature(Callback::Cancelable * onReportCallback) +{ + return RequestAttributeReporting(0x0000, onReportCallback); +} + +CHIP_ERROR ThermostatCluster::ReadAttributeOccupiedCoolingSetpoint(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeThermostatClusterReadOccupiedCoolingSetpointAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR ThermostatCluster::WriteAttributeOccupiedCoolingSetpoint(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, int16_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodeThermostatClusterWriteOccupiedCoolingSetpointAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR ThermostatCluster::ReadAttributeOccupiedHeatingSetpoint(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeThermostatClusterReadOccupiedHeatingSetpointAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR ThermostatCluster::WriteAttributeOccupiedHeatingSetpoint(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, int16_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodeThermostatClusterWriteOccupiedHeatingSetpointAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR ThermostatCluster::ReadAttributeControlSequenceOfOperation(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeThermostatClusterReadControlSequenceOfOperationAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR ThermostatCluster::WriteAttributeControlSequenceOfOperation(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint8_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodeThermostatClusterWriteControlSequenceOfOperationAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR ThermostatCluster::ReadAttributeSystemMode(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeThermostatClusterReadSystemModeAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR ThermostatCluster::WriteAttributeSystemMode(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint8_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeThermostatClusterWriteSystemModeAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR ThermostatCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeThermostatClusterReadClusterRevisionAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +// WindowCovering Cluster Commands +CHIP_ERROR WindowCoveringCluster::WindowCoveringDownClose(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kWindowCoveringDownCloseCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + // Command takes no arguments. + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeWindowCoveringClusterWindowCoveringDownCloseCommand(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + +CHIP_ERROR WindowCoveringCluster::WindowCoveringGoToLiftPercentage(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, + uint8_t percentageLiftValue) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kWindowCoveringGoToLiftPercentageCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + TLV::TLVWriter * writer = ZCLcommand->GetCommandDataElementTLVWriter(); + uint8_t argSeqNumber = 0; + // percentageLiftValue: int8u + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), percentageLiftValue)); + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodeWindowCoveringClusterWindowCoveringGoToLiftPercentageCommand(seqNum, mEndpoint, percentageLiftValue); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + +CHIP_ERROR WindowCoveringCluster::WindowCoveringGoToLiftValue(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t liftValue) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kWindowCoveringGoToLiftValueCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + TLV::TLVWriter * writer = ZCLcommand->GetCommandDataElementTLVWriter(); + uint8_t argSeqNumber = 0; + // liftValue: int16u + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), liftValue)); + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodeWindowCoveringClusterWindowCoveringGoToLiftValueCommand(seqNum, mEndpoint, liftValue); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + +CHIP_ERROR WindowCoveringCluster::WindowCoveringGoToTiltPercentage(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, + uint8_t percentageTiltValue) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kWindowCoveringGoToTiltPercentageCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + TLV::TLVWriter * writer = ZCLcommand->GetCommandDataElementTLVWriter(); + uint8_t argSeqNumber = 0; + // percentageTiltValue: int8u + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), percentageTiltValue)); + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodeWindowCoveringClusterWindowCoveringGoToTiltPercentageCommand(seqNum, mEndpoint, percentageTiltValue); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + +CHIP_ERROR WindowCoveringCluster::WindowCoveringGoToTiltValue(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t tiltValue) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kWindowCoveringGoToTiltValueCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + TLV::TLVWriter * writer = ZCLcommand->GetCommandDataElementTLVWriter(); + uint8_t argSeqNumber = 0; + // tiltValue: int16u + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), tiltValue)); + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodeWindowCoveringClusterWindowCoveringGoToTiltValueCommand(seqNum, mEndpoint, tiltValue); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + +CHIP_ERROR WindowCoveringCluster::WindowCoveringStop(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kWindowCoveringStopCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + // Command takes no arguments. + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeWindowCoveringClusterWindowCoveringStopCommand(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + +CHIP_ERROR WindowCoveringCluster::WindowCoveringUpOpen(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kWindowCoveringUpOpenCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + // Command takes no arguments. + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeWindowCoveringClusterWindowCoveringUpOpenCommand(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + +// WindowCovering Cluster Attributes +CHIP_ERROR WindowCoveringCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeWindowCoveringClusterDiscoverAttributes(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} +CHIP_ERROR WindowCoveringCluster::ReadAttributeWindowCoveringType(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeWindowCoveringClusterReadWindowCoveringTypeAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR WindowCoveringCluster::ConfigureAttributeWindowCoveringType(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, + uint16_t minInterval, uint16_t maxInterval) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodeWindowCoveringClusterConfigureWindowCoveringTypeAttribute(seqNum, mEndpoint, minInterval, maxInterval); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR WindowCoveringCluster::ReportAttributeWindowCoveringType(Callback::Cancelable * onReportCallback) +{ + return RequestAttributeReporting(0x0000, onReportCallback); +} + +CHIP_ERROR WindowCoveringCluster::ReadAttributeCurrentPositionLift(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeWindowCoveringClusterReadCurrentPositionLiftAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR WindowCoveringCluster::ConfigureAttributeCurrentPositionLift(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, + uint16_t minInterval, uint16_t maxInterval, uint16_t change) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodeWindowCoveringClusterConfigureCurrentPositionLiftAttribute(seqNum, mEndpoint, minInterval, maxInterval, change); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR WindowCoveringCluster::ReportAttributeCurrentPositionLift(Callback::Cancelable * onReportCallback) +{ + return RequestAttributeReporting(0x0003, onReportCallback); +} + +CHIP_ERROR WindowCoveringCluster::ReadAttributeCurrentPositionTilt(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeWindowCoveringClusterReadCurrentPositionTiltAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR WindowCoveringCluster::ConfigureAttributeCurrentPositionTilt(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, + uint16_t minInterval, uint16_t maxInterval, uint16_t change) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodeWindowCoveringClusterConfigureCurrentPositionTiltAttribute(seqNum, mEndpoint, minInterval, maxInterval, change); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR WindowCoveringCluster::ReportAttributeCurrentPositionTilt(Callback::Cancelable * onReportCallback) +{ + return RequestAttributeReporting(0x0004, onReportCallback); +} + +CHIP_ERROR WindowCoveringCluster::ReadAttributeConfigStatus(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeWindowCoveringClusterReadConfigStatusAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR WindowCoveringCluster::ConfigureAttributeConfigStatus(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t minInterval, + uint16_t maxInterval) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodeWindowCoveringClusterConfigureConfigStatusAttribute(seqNum, mEndpoint, minInterval, maxInterval); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR WindowCoveringCluster::ReportAttributeConfigStatus(Callback::Cancelable * onReportCallback) +{ + return RequestAttributeReporting(0x0007, onReportCallback); +} + +CHIP_ERROR WindowCoveringCluster::ReadAttributeInstalledOpenLimitLift(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeWindowCoveringClusterReadInstalledOpenLimitLiftAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR WindowCoveringCluster::ReadAttributeInstalledClosedLimitLift(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeWindowCoveringClusterReadInstalledClosedLimitLiftAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR WindowCoveringCluster::ReadAttributeInstalledOpenLimitTilt(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeWindowCoveringClusterReadInstalledOpenLimitTiltAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR WindowCoveringCluster::ReadAttributeInstalledClosedLimitTilt(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeWindowCoveringClusterReadInstalledClosedLimitTiltAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR WindowCoveringCluster::ReadAttributeMode(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeWindowCoveringClusterReadModeAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR WindowCoveringCluster::WriteAttributeMode(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint8_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeWindowCoveringClusterWriteModeAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR WindowCoveringCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeWindowCoveringClusterReadClusterRevisionAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + } // namespace Controller } // namespace chip diff --git a/src/controller/python/gen/CHIPClusters.h b/src/controller/python/gen/CHIPClusters.h index 256921a70e1343..c34b48e2610f09 100644 --- a/src/controller/python/gen/CHIPClusters.h +++ b/src/controller/python/gen/CHIPClusters.h @@ -27,21 +27,28 @@ namespace chip { namespace Controller { -constexpr ClusterId kApplicationBasicClusterId = 0x050D; -constexpr ClusterId kBarrierControlClusterId = 0x0103; -constexpr ClusterId kBasicClusterId = 0x0028; -constexpr ClusterId kBindingClusterId = 0xF000; -constexpr ClusterId kColorControlClusterId = 0x0300; -constexpr ClusterId kDoorLockClusterId = 0x0101; -constexpr ClusterId kGeneralCommissioningClusterId = 0x0030; -constexpr ClusterId kGroupsClusterId = 0x0004; -constexpr ClusterId kIdentifyClusterId = 0x0003; -constexpr ClusterId kLevelControlClusterId = 0x0008; -constexpr ClusterId kLowPowerClusterId = 0x0508; -constexpr ClusterId kNetworkCommissioningClusterId = 0x0031; -constexpr ClusterId kOnOffClusterId = 0x0006; -constexpr ClusterId kScenesClusterId = 0x0005; -constexpr ClusterId kTemperatureMeasurementClusterId = 0x0402; +constexpr ClusterId kApplicationBasicClusterId = 0x050D; +constexpr ClusterId kBarrierControlClusterId = 0x0103; +constexpr ClusterId kBasicClusterId = 0x0028; +constexpr ClusterId kBindingClusterId = 0xF000; +constexpr ClusterId kColorControlClusterId = 0x0300; +constexpr ClusterId kDescriptorClusterId = 0x001D; +constexpr ClusterId kDoorLockClusterId = 0x0101; +constexpr ClusterId kGeneralCommissioningClusterId = 0x0030; +constexpr ClusterId kGroupKeyManagementClusterId = 0xF004; +constexpr ClusterId kGroupsClusterId = 0x0004; +constexpr ClusterId kIdentifyClusterId = 0x0003; +constexpr ClusterId kLevelControlClusterId = 0x0008; +constexpr ClusterId kLowPowerClusterId = 0x0508; +constexpr ClusterId kNetworkCommissioningClusterId = 0x0031; +constexpr ClusterId kOnOffClusterId = 0x0006; +constexpr ClusterId kOperationalCredentialsClusterId = 0x003E; +constexpr ClusterId kPumpConfigurationAndControlClusterId = 0x0200; +constexpr ClusterId kScenesClusterId = 0x0005; +constexpr ClusterId kSwitchClusterId = 0x003B; +constexpr ClusterId kTemperatureMeasurementClusterId = 0x0402; +constexpr ClusterId kThermostatClusterId = 0x0201; +constexpr ClusterId kWindowCoveringClusterId = 0x0102; class DLL_EXPORT ApplicationBasicCluster : public ClusterBase { @@ -310,6 +317,21 @@ class DLL_EXPORT ColorControlCluster : public ClusterBase static constexpr CommandId kStopMoveStepCommandId = 0x47; }; +class DLL_EXPORT DescriptorCluster : public ClusterBase +{ +public: + DescriptorCluster() : ClusterBase(kDescriptorClusterId) {} + ~DescriptorCluster() {} + + // Cluster Attributes + CHIP_ERROR DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeDeviceList(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeServerList(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeClientList(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributePartsList(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); +}; + class DLL_EXPORT DoorLockCluster : public ClusterBase { public: @@ -401,6 +423,7 @@ class DLL_EXPORT GeneralCommissioningCluster : public ClusterBase // Cluster Commands CHIP_ERROR ArmFailSafe(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t expiryLengthSeconds, uint64_t breadcrumb, uint32_t timeoutMs); + CHIP_ERROR CommissioningComplete(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); CHIP_ERROR SetRegulatoryConfig(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t location, chip::ByteSpan countryCode, uint64_t breadcrumb, uint32_t timeoutMs); @@ -413,8 +436,22 @@ class DLL_EXPORT GeneralCommissioningCluster : public ClusterBase uint64_t value); private: - static constexpr CommandId kArmFailSafeCommandId = 0x00; - static constexpr CommandId kSetRegulatoryConfigCommandId = 0x02; + static constexpr CommandId kArmFailSafeCommandId = 0x00; + static constexpr CommandId kCommissioningCompleteCommandId = 0x04; + static constexpr CommandId kSetRegulatoryConfigCommandId = 0x02; +}; + +class DLL_EXPORT GroupKeyManagementCluster : public ClusterBase +{ +public: + GroupKeyManagementCluster() : ClusterBase(kGroupKeyManagementClusterId) {} + ~GroupKeyManagementCluster() {} + + // Cluster Attributes + CHIP_ERROR DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeGroups(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeGroupKeys(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); }; class DLL_EXPORT GroupsCluster : public ClusterBase @@ -596,6 +633,55 @@ class DLL_EXPORT OnOffCluster : public ClusterBase static constexpr CommandId kToggleCommandId = 0x02; }; +class DLL_EXPORT OperationalCredentialsCluster : public ClusterBase +{ +public: + OperationalCredentialsCluster() : ClusterBase(kOperationalCredentialsClusterId) {} + ~OperationalCredentialsCluster() {} + + // Cluster Commands + CHIP_ERROR GetFabricId(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR RemoveFabric(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + chip::FabricId fabricId, chip::NodeId nodeId, uint16_t vendorId); + CHIP_ERROR UpdateFabricLabel(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + chip::ByteSpan label); + + // Cluster Attributes + CHIP_ERROR DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeFabricsList(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + +private: + static constexpr CommandId kGetFabricIdCommandId = 0x00; + static constexpr CommandId kRemoveFabricCommandId = 0x0A; + static constexpr CommandId kUpdateFabricLabelCommandId = 0x09; +}; + +class DLL_EXPORT PumpConfigurationAndControlCluster : public ClusterBase +{ +public: + PumpConfigurationAndControlCluster() : ClusterBase(kPumpConfigurationAndControlClusterId) {} + ~PumpConfigurationAndControlCluster() {} + + // Cluster Attributes + CHIP_ERROR DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeMaxPressure(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeMaxSpeed(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeMaxFlow(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeEffectiveOperationMode(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeEffectiveControlMode(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeCapacity(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeOperationMode(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR WriteAttributeOperationMode(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t value); + CHIP_ERROR ConfigureAttributeCapacity(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t minInterval, uint16_t maxInterval, int16_t change); + CHIP_ERROR ReportAttributeCapacity(Callback::Cancelable * onReportCallback); +}; + class DLL_EXPORT ScenesCluster : public ClusterBase { public: @@ -638,6 +724,22 @@ class DLL_EXPORT ScenesCluster : public ClusterBase static constexpr CommandId kViewSceneCommandId = 0x01; }; +class DLL_EXPORT SwitchCluster : public ClusterBase +{ +public: + SwitchCluster() : ClusterBase(kSwitchClusterId) {} + ~SwitchCluster() {} + + // Cluster Attributes + CHIP_ERROR DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeNumberOfPositions(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeCurrentPosition(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ConfigureAttributeCurrentPosition(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t minInterval, uint16_t maxInterval, uint8_t change); + CHIP_ERROR ReportAttributeCurrentPosition(Callback::Cancelable * onReportCallback); +}; + class DLL_EXPORT TemperatureMeasurementCluster : public ClusterBase { public: @@ -655,5 +757,117 @@ class DLL_EXPORT TemperatureMeasurementCluster : public ClusterBase CHIP_ERROR ReportAttributeMeasuredValue(Callback::Cancelable * onReportCallback); }; +class DLL_EXPORT ThermostatCluster : public ClusterBase +{ +public: + ThermostatCluster() : ClusterBase(kThermostatClusterId) {} + ~ThermostatCluster() {} + + // Cluster Commands + CHIP_ERROR ClearWeeklySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR GetRelayStatusLog(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR GetWeeklySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t daysToReturn, uint8_t modeToReturn); + CHIP_ERROR SetWeeklySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t numberOfTransitionsForSequence, uint8_t dayOfWeekForSequence, uint8_t modeForSequence, + uint8_t payload); + CHIP_ERROR SetpointRaiseLower(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t mode, + int8_t amount); + + // Cluster Attributes + CHIP_ERROR DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeLocalTemperature(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeOccupiedCoolingSetpoint(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeOccupiedHeatingSetpoint(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeControlSequenceOfOperation(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeSystemMode(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR WriteAttributeOccupiedCoolingSetpoint(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, int16_t value); + CHIP_ERROR WriteAttributeOccupiedHeatingSetpoint(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, int16_t value); + CHIP_ERROR WriteAttributeControlSequenceOfOperation(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint8_t value); + CHIP_ERROR WriteAttributeSystemMode(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t value); + CHIP_ERROR ConfigureAttributeLocalTemperature(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t minInterval, + uint16_t maxInterval, int16_t change); + CHIP_ERROR ReportAttributeLocalTemperature(Callback::Cancelable * onReportCallback); + +private: + static constexpr CommandId kClearWeeklyScheduleCommandId = 0x03; + static constexpr CommandId kGetRelayStatusLogCommandId = 0x04; + static constexpr CommandId kGetWeeklyScheduleCommandId = 0x02; + static constexpr CommandId kSetWeeklyScheduleCommandId = 0x01; + static constexpr CommandId kSetpointRaiseLowerCommandId = 0x00; +}; + +class DLL_EXPORT WindowCoveringCluster : public ClusterBase +{ +public: + WindowCoveringCluster() : ClusterBase(kWindowCoveringClusterId) {} + ~WindowCoveringCluster() {} + + // Cluster Commands + CHIP_ERROR WindowCoveringDownClose(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR WindowCoveringGoToLiftPercentage(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t percentageLiftValue); + CHIP_ERROR WindowCoveringGoToLiftValue(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t liftValue); + CHIP_ERROR WindowCoveringGoToTiltPercentage(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t percentageTiltValue); + CHIP_ERROR WindowCoveringGoToTiltValue(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t tiltValue); + CHIP_ERROR WindowCoveringStop(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR WindowCoveringUpOpen(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + + // Cluster Attributes + CHIP_ERROR DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeWindowCoveringType(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeCurrentPositionLift(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeCurrentPositionTilt(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeConfigStatus(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeInstalledOpenLimitLift(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeInstalledClosedLimitLift(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeInstalledOpenLimitTilt(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeInstalledClosedLimitTilt(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeMode(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR WriteAttributeMode(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t value); + CHIP_ERROR ConfigureAttributeWindowCoveringType(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t minInterval, + uint16_t maxInterval); + CHIP_ERROR ReportAttributeWindowCoveringType(Callback::Cancelable * onReportCallback); + CHIP_ERROR ConfigureAttributeCurrentPositionLift(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t minInterval, + uint16_t maxInterval, uint16_t change); + CHIP_ERROR ReportAttributeCurrentPositionLift(Callback::Cancelable * onReportCallback); + CHIP_ERROR ConfigureAttributeCurrentPositionTilt(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t minInterval, + uint16_t maxInterval, uint16_t change); + CHIP_ERROR ReportAttributeCurrentPositionTilt(Callback::Cancelable * onReportCallback); + CHIP_ERROR ConfigureAttributeConfigStatus(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t minInterval, uint16_t maxInterval); + CHIP_ERROR ReportAttributeConfigStatus(Callback::Cancelable * onReportCallback); + +private: + static constexpr CommandId kWindowCoveringDownCloseCommandId = 0x01; + static constexpr CommandId kWindowCoveringGoToLiftPercentageCommandId = 0x05; + static constexpr CommandId kWindowCoveringGoToLiftValueCommandId = 0x04; + static constexpr CommandId kWindowCoveringGoToTiltPercentageCommandId = 0x08; + static constexpr CommandId kWindowCoveringGoToTiltValueCommandId = 0x07; + static constexpr CommandId kWindowCoveringStopCommandId = 0x02; + static constexpr CommandId kWindowCoveringUpOpenCommandId = 0x00; +}; + } // namespace Controller } // namespace chip diff --git a/src/controller/python/gen/CHIPClustersObjc.h b/src/controller/python/gen/CHIPClustersObjc.h index 7f2b23391cfce5..d368536c5171ab 100644 --- a/src/controller/python/gen/CHIPClustersObjc.h +++ b/src/controller/python/gen/CHIPClustersObjc.h @@ -307,6 +307,20 @@ NS_ASSUME_NONNULL_BEGIN @end +/** + * Cluster Descriptor + * + */ +@interface CHIPDescriptor : CHIPCluster + +- (void)readAttributeDeviceList:(ResponseHandler)completionHandler; +- (void)readAttributeServerList:(ResponseHandler)completionHandler; +- (void)readAttributeClientList:(ResponseHandler)completionHandler; +- (void)readAttributePartsList:(ResponseHandler)completionHandler; +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler; + +@end + /** * Cluster Door Lock * @@ -381,6 +395,7 @@ NS_ASSUME_NONNULL_BEGIN breadcrumb:(uint64_t)breadcrumb timeoutMs:(uint32_t)timeoutMs completionHandler:(ResponseHandler)completionHandler; +- (void)commissioningComplete:(ResponseHandler)completionHandler; - (void)setRegulatoryConfig:(uint8_t)location countryCode:(NSString *)countryCode breadcrumb:(uint64_t)breadcrumb @@ -394,6 +409,18 @@ NS_ASSUME_NONNULL_BEGIN @end +/** + * Cluster Group Key Management + * + */ +@interface CHIPGroupKeyManagement : CHIPCluster + +- (void)readAttributeGroups:(ResponseHandler)completionHandler; +- (void)readAttributeGroupKeys:(ResponseHandler)completionHandler; +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler; + +@end + /** * Cluster Groups * @@ -549,6 +576,47 @@ NS_ASSUME_NONNULL_BEGIN @end +/** + * Cluster Operational Credentials + * + */ +@interface CHIPOperationalCredentials : CHIPCluster + +- (void)getFabricId:(ResponseHandler)completionHandler; +- (void)removeFabric:(uint64_t)fabricId + nodeId:(uint64_t)nodeId + vendorId:(uint16_t)vendorId + completionHandler:(ResponseHandler)completionHandler; +- (void)updateFabricLabel:(NSString *)label completionHandler:(ResponseHandler)completionHandler; + +- (void)readAttributeFabricsList:(ResponseHandler)completionHandler; +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler; + +@end + +/** + * Cluster Pump Configuration and Control + * + */ +@interface CHIPPumpConfigurationAndControl : CHIPCluster + +- (void)readAttributeMaxPressure:(ResponseHandler)completionHandler; +- (void)readAttributeMaxSpeed:(ResponseHandler)completionHandler; +- (void)readAttributeMaxFlow:(ResponseHandler)completionHandler; +- (void)readAttributeEffectiveOperationMode:(ResponseHandler)completionHandler; +- (void)readAttributeEffectiveControlMode:(ResponseHandler)completionHandler; +- (void)readAttributeCapacity:(ResponseHandler)completionHandler; +- (void)configureAttributeCapacity:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + change:(int16_t)change + completionHandler:(ResponseHandler)completionHandler; +- (void)reportAttributeCapacity:(ResponseHandler)reportHandler; +- (void)readAttributeOperationMode:(ResponseHandler)completionHandler; +- (void)writeAttributeOperationMode:(uint8_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler; + +@end + /** * Cluster Scenes * @@ -582,6 +650,23 @@ NS_ASSUME_NONNULL_BEGIN @end +/** + * Cluster Switch + * + */ +@interface CHIPSwitch : CHIPCluster + +- (void)readAttributeNumberOfPositions:(ResponseHandler)completionHandler; +- (void)readAttributeCurrentPosition:(ResponseHandler)completionHandler; +- (void)configureAttributeCurrentPosition:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + change:(uint8_t)change + completionHandler:(ResponseHandler)completionHandler; +- (void)reportAttributeCurrentPosition:(ResponseHandler)reportHandler; +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler; + +@end + /** * Cluster Temperature Measurement * @@ -600,6 +685,88 @@ NS_ASSUME_NONNULL_BEGIN @end +/** + * Cluster Thermostat + * + */ +@interface CHIPThermostat : CHIPCluster + +- (void)clearWeeklySchedule:(ResponseHandler)completionHandler; +- (void)getRelayStatusLog:(ResponseHandler)completionHandler; +- (void)getWeeklySchedule:(uint8_t)daysToReturn + modeToReturn:(uint8_t)modeToReturn + completionHandler:(ResponseHandler)completionHandler; +- (void)setWeeklySchedule:(uint8_t)numberOfTransitionsForSequence + dayOfWeekForSequence:(uint8_t)dayOfWeekForSequence + modeForSequence:(uint8_t)modeForSequence + payload:(uint8_t)payload + completionHandler:(ResponseHandler)completionHandler; +- (void)setpointRaiseLower:(uint8_t)mode amount:(int8_t)amount completionHandler:(ResponseHandler)completionHandler; + +- (void)readAttributeLocalTemperature:(ResponseHandler)completionHandler; +- (void)configureAttributeLocalTemperature:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + change:(int16_t)change + completionHandler:(ResponseHandler)completionHandler; +- (void)reportAttributeLocalTemperature:(ResponseHandler)reportHandler; +- (void)readAttributeOccupiedCoolingSetpoint:(ResponseHandler)completionHandler; +- (void)writeAttributeOccupiedCoolingSetpoint:(int16_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeOccupiedHeatingSetpoint:(ResponseHandler)completionHandler; +- (void)writeAttributeOccupiedHeatingSetpoint:(int16_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeControlSequenceOfOperation:(ResponseHandler)completionHandler; +- (void)writeAttributeControlSequenceOfOperation:(uint8_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeSystemMode:(ResponseHandler)completionHandler; +- (void)writeAttributeSystemMode:(uint8_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler; + +@end + +/** + * Cluster Window Covering + * + */ +@interface CHIPWindowCovering : CHIPCluster + +- (void)windowCoveringDownClose:(ResponseHandler)completionHandler; +- (void)windowCoveringGoToLiftPercentage:(uint8_t)percentageLiftValue completionHandler:(ResponseHandler)completionHandler; +- (void)windowCoveringGoToLiftValue:(uint16_t)liftValue completionHandler:(ResponseHandler)completionHandler; +- (void)windowCoveringGoToTiltPercentage:(uint8_t)percentageTiltValue completionHandler:(ResponseHandler)completionHandler; +- (void)windowCoveringGoToTiltValue:(uint16_t)tiltValue completionHandler:(ResponseHandler)completionHandler; +- (void)windowCoveringStop:(ResponseHandler)completionHandler; +- (void)windowCoveringUpOpen:(ResponseHandler)completionHandler; + +- (void)readAttributeWindowCoveringType:(ResponseHandler)completionHandler; +- (void)configureAttributeWindowCoveringType:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + completionHandler:(ResponseHandler)completionHandler; +- (void)reportAttributeWindowCoveringType:(ResponseHandler)reportHandler; +- (void)readAttributeCurrentPositionLift:(ResponseHandler)completionHandler; +- (void)configureAttributeCurrentPositionLift:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + change:(uint16_t)change + completionHandler:(ResponseHandler)completionHandler; +- (void)reportAttributeCurrentPositionLift:(ResponseHandler)reportHandler; +- (void)readAttributeCurrentPositionTilt:(ResponseHandler)completionHandler; +- (void)configureAttributeCurrentPositionTilt:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + change:(uint16_t)change + completionHandler:(ResponseHandler)completionHandler; +- (void)reportAttributeCurrentPositionTilt:(ResponseHandler)reportHandler; +- (void)readAttributeConfigStatus:(ResponseHandler)completionHandler; +- (void)configureAttributeConfigStatus:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + completionHandler:(ResponseHandler)completionHandler; +- (void)reportAttributeConfigStatus:(ResponseHandler)reportHandler; +- (void)readAttributeInstalledOpenLimitLift:(ResponseHandler)completionHandler; +- (void)readAttributeInstalledClosedLimitLift:(ResponseHandler)completionHandler; +- (void)readAttributeInstalledOpenLimitTilt:(ResponseHandler)completionHandler; +- (void)readAttributeInstalledClosedLimitTilt:(ResponseHandler)completionHandler; +- (void)readAttributeMode:(ResponseHandler)completionHandler; +- (void)writeAttributeMode:(uint8_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler; + +@end + NS_ASSUME_NONNULL_END #endif /* CHIP_CLUSTERS_H */ diff --git a/src/controller/python/gen/CHIPClustersObjc.mm b/src/controller/python/gen/CHIPClustersObjc.mm index 6c9af08b5c31fa..93e0782612268b 100644 --- a/src/controller/python/gen/CHIPClustersObjc.mm +++ b/src/controller/python/gen/CHIPClustersObjc.mm @@ -1110,6 +1110,39 @@ static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText) dispatch_queue_t mQueue; }; +class CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallbackBridge + : public Callback::Callback { +public: + CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallbackBridge() {}; + + static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText) + { + CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { + @"errorCode" : [NSNumber numberWithUnsignedChar:errorCode], + @"debugText" : [NSString stringWithFormat:@"%s", debugText], + }); + callback->Cancel(); + delete callback; + }); + } + }; + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + class CHIPGeneralCommissioningClusterSetRegulatoryConfigResponseCallbackBridge : public Callback::Callback { public: @@ -1575,6 +1608,38 @@ static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText) dispatch_queue_t mQueue; }; +class CHIPOperationalCredentialsClusterGetFabricIdResponseCallbackBridge + : public Callback::Callback { +public: + CHIPOperationalCredentialsClusterGetFabricIdResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPOperationalCredentialsClusterGetFabricIdResponseCallbackBridge() {}; + + static void CallbackFn(void * context, chip::FabricId FabricId) + { + CHIPOperationalCredentialsClusterGetFabricIdResponseCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { + @"FabricId" : [NSNumber numberWithUnsignedLongLong:FabricId], + }); + callback->Cancel(); + delete callback; + }); + } + }; + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + class CHIPScenesClusterAddSceneResponseCallbackBridge : public Callback::Callback { public: CHIPScenesClusterAddSceneResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) @@ -1777,6 +1842,268 @@ static void CallbackFn(void * context, uint16_t groupId, uint8_t sceneId, uint16 dispatch_queue_t mQueue; }; +class CHIPDescriptorDeviceListAttributeCallbackBridge : public Callback::Callback { +public: + CHIPDescriptorDeviceListAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPDescriptorDeviceListAttributeCallbackBridge() {}; + + static void CallbackFn(void * context, uint16_t count, _DeviceType * entries) + { + CHIPDescriptorDeviceListAttributeCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + id values[count]; + for (uint16_t i = 0; i < count; i++) { + values[i] = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithUnsignedLong:entries[i].type], @"type", + [NSNumber numberWithUnsignedShort:entries[i].revision], @"revision", nil]; + } + + id array = [NSArray arrayWithObjects:values count:count]; + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { @"value" : array }); + callback->Cancel(); + delete callback; + }); + } + } + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + +class CHIPDescriptorServerListAttributeCallbackBridge : public Callback::Callback { +public: + CHIPDescriptorServerListAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPDescriptorServerListAttributeCallbackBridge() {}; + + static void CallbackFn(void * context, uint16_t count, chip::ClusterId * entries) + { + CHIPDescriptorServerListAttributeCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + id values[count]; + for (uint16_t i = 0; i < count; i++) { + values[i] = [NSNumber numberWithUnsignedShort:entries[i]]; + } + + id array = [NSArray arrayWithObjects:values count:count]; + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { @"value" : array }); + callback->Cancel(); + delete callback; + }); + } + } + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + +class CHIPDescriptorClientListAttributeCallbackBridge : public Callback::Callback { +public: + CHIPDescriptorClientListAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPDescriptorClientListAttributeCallbackBridge() {}; + + static void CallbackFn(void * context, uint16_t count, chip::ClusterId * entries) + { + CHIPDescriptorClientListAttributeCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + id values[count]; + for (uint16_t i = 0; i < count; i++) { + values[i] = [NSNumber numberWithUnsignedShort:entries[i]]; + } + + id array = [NSArray arrayWithObjects:values count:count]; + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { @"value" : array }); + callback->Cancel(); + delete callback; + }); + } + } + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + +class CHIPDescriptorPartsListAttributeCallbackBridge : public Callback::Callback { +public: + CHIPDescriptorPartsListAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPDescriptorPartsListAttributeCallbackBridge() {}; + + static void CallbackFn(void * context, uint16_t count, chip::EndpointId * entries) + { + CHIPDescriptorPartsListAttributeCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + id values[count]; + for (uint16_t i = 0; i < count; i++) { + values[i] = [NSNumber numberWithUnsignedChar:entries[i]]; + } + + id array = [NSArray arrayWithObjects:values count:count]; + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { @"value" : array }); + callback->Cancel(); + delete callback; + }); + } + } + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + +class CHIPGroupKeyManagementGroupsAttributeCallbackBridge + : public Callback::Callback { +public: + CHIPGroupKeyManagementGroupsAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPGroupKeyManagementGroupsAttributeCallbackBridge() {}; + + static void CallbackFn(void * context, uint16_t count, _GroupState * entries) + { + CHIPGroupKeyManagementGroupsAttributeCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + id values[count]; + for (uint16_t i = 0; i < count; i++) { + values[i] = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithUnsignedShort:entries[i].VendorId], + @"VendorId", [NSNumber numberWithUnsignedShort:entries[i].VendorGroupId], + @"VendorGroupId", [NSNumber numberWithUnsignedShort:entries[i].GroupKeySetIndex], + @"GroupKeySetIndex", nil]; + } + + id array = [NSArray arrayWithObjects:values count:count]; + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { @"value" : array }); + callback->Cancel(); + delete callback; + }); + } + } + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + +class CHIPGroupKeyManagementGroupKeysAttributeCallbackBridge + : public Callback::Callback { +public: + CHIPGroupKeyManagementGroupKeysAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPGroupKeyManagementGroupKeysAttributeCallbackBridge() {}; + + static void CallbackFn(void * context, uint16_t count, _GroupKey * entries) + { + CHIPGroupKeyManagementGroupKeysAttributeCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + id values[count]; + for (uint16_t i = 0; i < count; i++) { + values[i] = [[NSDictionary alloc] + initWithObjectsAndKeys:[NSNumber numberWithUnsignedShort:entries[i].VendorId], @"VendorId", + [NSNumber numberWithUnsignedShort:entries[i].GroupKeyIndex], @"GroupKeyIndex", + [NSData dataWithBytes:entries[i].GroupKeyRoot + 1u length:emberAfStringLength(entries[i].GroupKeyRoot)], + @"GroupKeyRoot", [NSNumber numberWithUnsignedLongLong:entries[i].GroupKeyEpochStartTime], + @"GroupKeyEpochStartTime", [NSNumber numberWithUnsignedChar:entries[i].GroupKeySecurityPolicy], + @"GroupKeySecurityPolicy", nil]; + } + + id array = [NSArray arrayWithObjects:values count:count]; + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { @"value" : array }); + callback->Cancel(); + delete callback; + }); + } + } + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + +class CHIPOperationalCredentialsFabricsListAttributeCallbackBridge + : public Callback::Callback { +public: + CHIPOperationalCredentialsFabricsListAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPOperationalCredentialsFabricsListAttributeCallbackBridge() {}; + + static void CallbackFn(void * context, uint16_t count, _FabricDescriptor * entries) + { + CHIPOperationalCredentialsFabricsListAttributeCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + id values[count]; + for (uint16_t i = 0; i < count; i++) { + values[i] = + [[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithUnsignedLongLong:entries[i].FabricId], + @"FabricId", [NSNumber numberWithUnsignedShort:entries[i].VendorId], @"VendorId", + [NSData dataWithBytes:entries[i].Label + 1u length:emberAfStringLength(entries[i].Label)], + @"Label", [NSNumber numberWithUnsignedLongLong:entries[i].NodeId], @"NodeId", nil]; + } + + id array = [NSArray arrayWithObjects:values count:count]; + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { @"value" : array }); + callback->Cancel(); + delete callback; + }); + } + } + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + @interface CHIPCluster () @property (readonly, nonatomic) dispatch_queue_t callbackQueue; - (Controller::ClusterBase *)getCluster; @@ -4891,21 +5218,21 @@ - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler @end -@interface CHIPDoorLock () -@property (readonly) Controller::DoorLockCluster cppCluster; +@interface CHIPDescriptor () +@property (readonly) Controller::DescriptorCluster cppCluster; @end -@implementation CHIPDoorLock +@implementation CHIPDescriptor - (Controller::ClusterBase *)getCluster { return &_cppCluster; } -- (void)clearAllPins:(ResponseHandler)completionHandler +- (void)readAttributeDeviceList:(ResponseHandler)completionHandler { - CHIPDoorLockClusterClearAllPinsResponseCallbackBridge * onSuccess - = new CHIPDoorLockClusterClearAllPinsResponseCallbackBridge(completionHandler, [self callbackQueue]); + CHIPDescriptorDeviceListAttributeCallbackBridge * onSuccess + = new CHIPDescriptorDeviceListAttributeCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -4918,17 +5245,18 @@ - (void)clearAllPins:(ResponseHandler)completionHandler return; } - CHIP_ERROR err = self.cppCluster.ClearAllPins(onSuccess->Cancel(), onFailure->Cancel()); + CHIP_ERROR err = self.cppCluster.ReadAttributeDeviceList(onSuccess->Cancel(), onFailure->Cancel()); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; completionHandler([CHIPError errorForCHIPErrorCode:err], nil); } } -- (void)clearAllRfids:(ResponseHandler)completionHandler + +- (void)readAttributeServerList:(ResponseHandler)completionHandler { - CHIPDoorLockClusterClearAllRfidsResponseCallbackBridge * onSuccess - = new CHIPDoorLockClusterClearAllRfidsResponseCallbackBridge(completionHandler, [self callbackQueue]); + CHIPDescriptorServerListAttributeCallbackBridge * onSuccess + = new CHIPDescriptorServerListAttributeCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -4941,17 +5269,18 @@ - (void)clearAllRfids:(ResponseHandler)completionHandler return; } - CHIP_ERROR err = self.cppCluster.ClearAllRfids(onSuccess->Cancel(), onFailure->Cancel()); + CHIP_ERROR err = self.cppCluster.ReadAttributeServerList(onSuccess->Cancel(), onFailure->Cancel()); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; completionHandler([CHIPError errorForCHIPErrorCode:err], nil); } } -- (void)clearHolidaySchedule:(uint8_t)scheduleId completionHandler:(ResponseHandler)completionHandler + +- (void)readAttributeClientList:(ResponseHandler)completionHandler { - CHIPDoorLockClusterClearHolidayScheduleResponseCallbackBridge * onSuccess - = new CHIPDoorLockClusterClearHolidayScheduleResponseCallbackBridge(completionHandler, [self callbackQueue]); + CHIPDescriptorClientListAttributeCallbackBridge * onSuccess + = new CHIPDescriptorClientListAttributeCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -4964,17 +5293,18 @@ - (void)clearHolidaySchedule:(uint8_t)scheduleId completionHandler:(ResponseHand return; } - CHIP_ERROR err = self.cppCluster.ClearHolidaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId); + CHIP_ERROR err = self.cppCluster.ReadAttributeClientList(onSuccess->Cancel(), onFailure->Cancel()); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; completionHandler([CHIPError errorForCHIPErrorCode:err], nil); } } -- (void)clearPin:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler + +- (void)readAttributePartsList:(ResponseHandler)completionHandler { - CHIPDoorLockClusterClearPinResponseCallbackBridge * onSuccess - = new CHIPDoorLockClusterClearPinResponseCallbackBridge(completionHandler, [self callbackQueue]); + CHIPDescriptorPartsListAttributeCallbackBridge * onSuccess + = new CHIPDescriptorPartsListAttributeCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -4987,17 +5317,17 @@ - (void)clearPin:(uint16_t)userId completionHandler:(ResponseHandler)completionH return; } - CHIP_ERROR err = self.cppCluster.ClearPin(onSuccess->Cancel(), onFailure->Cancel(), userId); + CHIP_ERROR err = self.cppCluster.ReadAttributePartsList(onSuccess->Cancel(), onFailure->Cancel()); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; completionHandler([CHIPError errorForCHIPErrorCode:err], nil); } } -- (void)clearRfid:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler + +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler { - CHIPDoorLockClusterClearRfidResponseCallbackBridge * onSuccess - = new CHIPDoorLockClusterClearRfidResponseCallbackBridge(completionHandler, [self callbackQueue]); + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -5010,17 +5340,31 @@ - (void)clearRfid:(uint16_t)userId completionHandler:(ResponseHandler)completion return; } - CHIP_ERROR err = self.cppCluster.ClearRfid(onSuccess->Cancel(), onFailure->Cancel(), userId); + CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel()); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; completionHandler([CHIPError errorForCHIPErrorCode:err], nil); } } -- (void)clearWeekdaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler + +@end + +@interface CHIPDoorLock () +@property (readonly) Controller::DoorLockCluster cppCluster; +@end + +@implementation CHIPDoorLock + +- (Controller::ClusterBase *)getCluster { - CHIPDoorLockClusterClearWeekdayScheduleResponseCallbackBridge * onSuccess - = new CHIPDoorLockClusterClearWeekdayScheduleResponseCallbackBridge(completionHandler, [self callbackQueue]); + return &_cppCluster; +} + +- (void)clearAllPins:(ResponseHandler)completionHandler +{ + CHIPDoorLockClusterClearAllPinsResponseCallbackBridge * onSuccess + = new CHIPDoorLockClusterClearAllPinsResponseCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -5033,17 +5377,132 @@ - (void)clearWeekdaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId complet return; } - CHIP_ERROR err = self.cppCluster.ClearWeekdaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId); + CHIP_ERROR err = self.cppCluster.ClearAllPins(onSuccess->Cancel(), onFailure->Cancel()); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; completionHandler([CHIPError errorForCHIPErrorCode:err], nil); } } -- (void)clearYeardaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler +- (void)clearAllRfids:(ResponseHandler)completionHandler { - CHIPDoorLockClusterClearYeardayScheduleResponseCallbackBridge * onSuccess - = new CHIPDoorLockClusterClearYeardayScheduleResponseCallbackBridge(completionHandler, [self callbackQueue]); + CHIPDoorLockClusterClearAllRfidsResponseCallbackBridge * onSuccess + = new CHIPDoorLockClusterClearAllRfidsResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ClearAllRfids(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)clearHolidaySchedule:(uint8_t)scheduleId completionHandler:(ResponseHandler)completionHandler +{ + CHIPDoorLockClusterClearHolidayScheduleResponseCallbackBridge * onSuccess + = new CHIPDoorLockClusterClearHolidayScheduleResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ClearHolidaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)clearPin:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler +{ + CHIPDoorLockClusterClearPinResponseCallbackBridge * onSuccess + = new CHIPDoorLockClusterClearPinResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ClearPin(onSuccess->Cancel(), onFailure->Cancel(), userId); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)clearRfid:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler +{ + CHIPDoorLockClusterClearRfidResponseCallbackBridge * onSuccess + = new CHIPDoorLockClusterClearRfidResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ClearRfid(onSuccess->Cancel(), onFailure->Cancel(), userId); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)clearWeekdaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler +{ + CHIPDoorLockClusterClearWeekdayScheduleResponseCallbackBridge * onSuccess + = new CHIPDoorLockClusterClearWeekdayScheduleResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ClearWeekdaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)clearYeardaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler +{ + CHIPDoorLockClusterClearYeardayScheduleResponseCallbackBridge * onSuccess + = new CHIPDoorLockClusterClearYeardayScheduleResponseCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -5642,6 +6101,29 @@ - (void)armFailSafe:(uint16_t)expiryLengthSeconds completionHandler([CHIPError errorForCHIPErrorCode:err], nil); } } +- (void)commissioningComplete:(ResponseHandler)completionHandler +{ + CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallbackBridge * onSuccess + = new CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.CommissioningComplete(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} - (void)setRegulatoryConfig:(uint8_t)location countryCode:(NSString *)countryCode breadcrumb:(uint64_t)breadcrumb @@ -5768,6 +6250,90 @@ - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler @end +@interface CHIPGroupKeyManagement () +@property (readonly) Controller::GroupKeyManagementCluster cppCluster; +@end + +@implementation CHIPGroupKeyManagement + +- (Controller::ClusterBase *)getCluster +{ + return &_cppCluster; +} + +- (void)readAttributeGroups:(ResponseHandler)completionHandler +{ + CHIPGroupKeyManagementGroupsAttributeCallbackBridge * onSuccess + = new CHIPGroupKeyManagementGroupsAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeGroups(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeGroupKeys:(ResponseHandler)completionHandler +{ + CHIPGroupKeyManagementGroupKeysAttributeCallbackBridge * onSuccess + = new CHIPGroupKeyManagementGroupKeysAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeGroupKeys(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +@end + @interface CHIPGroups () @property (readonly) Controller::GroupsCluster cppCluster; @end @@ -6900,28 +7466,21 @@ - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler @end -@interface CHIPScenes () -@property (readonly) Controller::ScenesCluster cppCluster; +@interface CHIPOperationalCredentials () +@property (readonly) Controller::OperationalCredentialsCluster cppCluster; @end -@implementation CHIPScenes +@implementation CHIPOperationalCredentials - (Controller::ClusterBase *)getCluster { return &_cppCluster; } -- (void)addScene:(uint16_t)groupId - sceneId:(uint8_t)sceneId - transitionTime:(uint16_t)transitionTime - sceneName:(NSString *)sceneName - clusterId:(uint16_t)clusterId - length:(uint8_t)length - value:(uint8_t)value - completionHandler:(ResponseHandler)completionHandler +- (void)getFabricId:(ResponseHandler)completionHandler { - CHIPScenesClusterAddSceneResponseCallbackBridge * onSuccess - = new CHIPScenesClusterAddSceneResponseCallbackBridge(completionHandler, [self callbackQueue]); + CHIPOperationalCredentialsClusterGetFabricIdResponseCallbackBridge * onSuccess + = new CHIPOperationalCredentialsClusterGetFabricIdResponseCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -6934,20 +7493,19 @@ - (void)addScene:(uint16_t)groupId return; } - CHIP_ERROR err = self.cppCluster.AddScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId, transitionTime, - chip::ByteSpan((const uint8_t *) [sceneName dataUsingEncoding:NSUTF8StringEncoding].bytes, - [sceneName lengthOfBytesUsingEncoding:NSUTF8StringEncoding]), - clusterId, length, value); + CHIP_ERROR err = self.cppCluster.GetFabricId(onSuccess->Cancel(), onFailure->Cancel()); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; completionHandler([CHIPError errorForCHIPErrorCode:err], nil); } } -- (void)getSceneMembership:(uint16_t)groupId completionHandler:(ResponseHandler)completionHandler +- (void)removeFabric:(uint64_t)fabricId + nodeId:(uint64_t)nodeId + vendorId:(uint16_t)vendorId + completionHandler:(ResponseHandler)completionHandler { - CHIPScenesClusterGetSceneMembershipResponseCallbackBridge * onSuccess - = new CHIPScenesClusterGetSceneMembershipResponseCallbackBridge(completionHandler, [self callbackQueue]); + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -6960,17 +7518,14 @@ - (void)getSceneMembership:(uint16_t)groupId completionHandler:(ResponseHandler) return; } - CHIP_ERROR err = self.cppCluster.GetSceneMembership(onSuccess->Cancel(), onFailure->Cancel(), groupId); + CHIP_ERROR err = self.cppCluster.RemoveFabric(onSuccess->Cancel(), onFailure->Cancel(), fabricId, nodeId, vendorId); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; completionHandler([CHIPError errorForCHIPErrorCode:err], nil); } } -- (void)recallScene:(uint16_t)groupId - sceneId:(uint8_t)sceneId - transitionTime:(uint16_t)transitionTime - completionHandler:(ResponseHandler)completionHandler +- (void)updateFabricLabel:(NSString *)label completionHandler:(ResponseHandler)completionHandler { CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { @@ -6985,17 +7540,20 @@ - (void)recallScene:(uint16_t)groupId return; } - CHIP_ERROR err = self.cppCluster.RecallScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId, transitionTime); + CHIP_ERROR err = self.cppCluster.UpdateFabricLabel(onSuccess->Cancel(), onFailure->Cancel(), + chip::ByteSpan((const uint8_t *) [label dataUsingEncoding:NSUTF8StringEncoding].bytes, + [label lengthOfBytesUsingEncoding:NSUTF8StringEncoding])); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; completionHandler([CHIPError errorForCHIPErrorCode:err], nil); } } -- (void)removeAllScenes:(uint16_t)groupId completionHandler:(ResponseHandler)completionHandler + +- (void)readAttributeFabricsList:(ResponseHandler)completionHandler { - CHIPScenesClusterRemoveAllScenesResponseCallbackBridge * onSuccess - = new CHIPScenesClusterRemoveAllScenesResponseCallbackBridge(completionHandler, [self callbackQueue]); + CHIPOperationalCredentialsFabricsListAttributeCallbackBridge * onSuccess + = new CHIPOperationalCredentialsFabricsListAttributeCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -7008,17 +7566,17 @@ - (void)removeAllScenes:(uint16_t)groupId completionHandler:(ResponseHandler)com return; } - CHIP_ERROR err = self.cppCluster.RemoveAllScenes(onSuccess->Cancel(), onFailure->Cancel(), groupId); + CHIP_ERROR err = self.cppCluster.ReadAttributeFabricsList(onSuccess->Cancel(), onFailure->Cancel()); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; completionHandler([CHIPError errorForCHIPErrorCode:err], nil); } } -- (void)removeScene:(uint16_t)groupId sceneId:(uint8_t)sceneId completionHandler:(ResponseHandler)completionHandler + +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler { - CHIPScenesClusterRemoveSceneResponseCallbackBridge * onSuccess - = new CHIPScenesClusterRemoveSceneResponseCallbackBridge(completionHandler, [self callbackQueue]); + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -7031,19 +7589,32 @@ - (void)removeScene:(uint16_t)groupId sceneId:(uint8_t)sceneId completionHandler return; } - CHIP_ERROR err = self.cppCluster.RemoveScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId); + CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel()); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; completionHandler([CHIPError errorForCHIPErrorCode:err], nil); } } -- (void)storeScene:(uint16_t)groupId sceneId:(uint8_t)sceneId completionHandler:(ResponseHandler)completionHandler -{ - CHIPScenesClusterStoreSceneResponseCallbackBridge * onSuccess - = new CHIPScenesClusterStoreSceneResponseCallbackBridge(completionHandler, [self callbackQueue]); - if (!onSuccess) { - completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + +@end + +@interface CHIPPumpConfigurationAndControl () +@property (readonly) Controller::PumpConfigurationAndControlCluster cppCluster; +@end + +@implementation CHIPPumpConfigurationAndControl + +- (Controller::ClusterBase *)getCluster +{ + return &_cppCluster; +} + +- (void)readAttributeMaxPressure:(ResponseHandler)completionHandler +{ + CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; } @@ -7054,17 +7625,17 @@ - (void)storeScene:(uint16_t)groupId sceneId:(uint8_t)sceneId completionHandler: return; } - CHIP_ERROR err = self.cppCluster.StoreScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId); + CHIP_ERROR err = self.cppCluster.ReadAttributeMaxPressure(onSuccess->Cancel(), onFailure->Cancel()); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; completionHandler([CHIPError errorForCHIPErrorCode:err], nil); } } -- (void)viewScene:(uint16_t)groupId sceneId:(uint8_t)sceneId completionHandler:(ResponseHandler)completionHandler + +- (void)readAttributeMaxSpeed:(ResponseHandler)completionHandler { - CHIPScenesClusterViewSceneResponseCallbackBridge * onSuccess - = new CHIPScenesClusterViewSceneResponseCallbackBridge(completionHandler, [self callbackQueue]); + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -7077,7 +7648,7 @@ - (void)viewScene:(uint16_t)groupId sceneId:(uint8_t)sceneId completionHandler:( return; } - CHIP_ERROR err = self.cppCluster.ViewScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId); + CHIP_ERROR err = self.cppCluster.ReadAttributeMaxSpeed(onSuccess->Cancel(), onFailure->Cancel()); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; @@ -7085,7 +7656,30 @@ - (void)viewScene:(uint16_t)groupId sceneId:(uint8_t)sceneId completionHandler:( } } -- (void)readAttributeSceneCount:(ResponseHandler)completionHandler +- (void)readAttributeMaxFlow:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeMaxFlow(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeEffectiveOperationMode:(ResponseHandler)completionHandler { CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { @@ -7100,7 +7694,7 @@ - (void)readAttributeSceneCount:(ResponseHandler)completionHandler return; } - CHIP_ERROR err = self.cppCluster.ReadAttributeSceneCount(onSuccess->Cancel(), onFailure->Cancel()); + CHIP_ERROR err = self.cppCluster.ReadAttributeEffectiveOperationMode(onSuccess->Cancel(), onFailure->Cancel()); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; @@ -7108,7 +7702,7 @@ - (void)readAttributeSceneCount:(ResponseHandler)completionHandler } } -- (void)readAttributeCurrentScene:(ResponseHandler)completionHandler +- (void)readAttributeEffectiveControlMode:(ResponseHandler)completionHandler { CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { @@ -7123,7 +7717,7 @@ - (void)readAttributeCurrentScene:(ResponseHandler)completionHandler return; } - CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentScene(onSuccess->Cancel(), onFailure->Cancel()); + CHIP_ERROR err = self.cppCluster.ReadAttributeEffectiveControlMode(onSuccess->Cancel(), onFailure->Cancel()); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; @@ -7131,9 +7725,9 @@ - (void)readAttributeCurrentScene:(ResponseHandler)completionHandler } } -- (void)readAttributeCurrentGroup:(ResponseHandler)completionHandler +- (void)readAttributeCapacity:(ResponseHandler)completionHandler { - CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -7146,7 +7740,7 @@ - (void)readAttributeCurrentGroup:(ResponseHandler)completionHandler return; } - CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentGroup(onSuccess->Cancel(), onFailure->Cancel()); + CHIP_ERROR err = self.cppCluster.ReadAttributeCapacity(onSuccess->Cancel(), onFailure->Cancel()); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; @@ -7154,10 +7748,12 @@ - (void)readAttributeCurrentGroup:(ResponseHandler)completionHandler } } -- (void)readAttributeSceneValid:(ResponseHandler)completionHandler +- (void)configureAttributeCapacity:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + change:(int16_t)change + completionHandler:(ResponseHandler)completionHandler { - CHIPBooleanAttributeCallbackBridge * onSuccess - = new CHIPBooleanAttributeCallbackBridge(completionHandler, [self callbackQueue]); + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -7170,7 +7766,8 @@ - (void)readAttributeSceneValid:(ResponseHandler)completionHandler return; } - CHIP_ERROR err = self.cppCluster.ReadAttributeSceneValid(onSuccess->Cancel(), onFailure->Cancel()); + CHIP_ERROR err + = self.cppCluster.ConfigureAttributeCapacity(onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; @@ -7178,7 +7775,22 @@ - (void)readAttributeSceneValid:(ResponseHandler)completionHandler } } -- (void)readAttributeNameSupport:(ResponseHandler)completionHandler +- (void)reportAttributeCapacity:(ResponseHandler)reportHandler +{ + CHIPInt16sAttributeCallbackBridge * onReport = new CHIPInt16sAttributeCallbackBridge(reportHandler, [self callbackQueue], true); + if (!onReport) { + reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReportAttributeCapacity(onReport->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onReport; + reportHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeOperationMode:(ResponseHandler)completionHandler { CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { @@ -7193,7 +7805,30 @@ - (void)readAttributeNameSupport:(ResponseHandler)completionHandler return; } - CHIP_ERROR err = self.cppCluster.ReadAttributeNameSupport(onSuccess->Cancel(), onFailure->Cancel()); + CHIP_ERROR err = self.cppCluster.ReadAttributeOperationMode(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeOperationMode:(uint8_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.WriteAttributeOperationMode(onSuccess->Cancel(), onFailure->Cancel(), value); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; @@ -7226,20 +7861,28 @@ - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler @end -@interface CHIPTemperatureMeasurement () -@property (readonly) Controller::TemperatureMeasurementCluster cppCluster; +@interface CHIPScenes () +@property (readonly) Controller::ScenesCluster cppCluster; @end -@implementation CHIPTemperatureMeasurement +@implementation CHIPScenes - (Controller::ClusterBase *)getCluster { return &_cppCluster; } -- (void)readAttributeMeasuredValue:(ResponseHandler)completionHandler +- (void)addScene:(uint16_t)groupId + sceneId:(uint8_t)sceneId + transitionTime:(uint16_t)transitionTime + sceneName:(NSString *)sceneName + clusterId:(uint16_t)clusterId + length:(uint8_t)length + value:(uint8_t)value + completionHandler:(ResponseHandler)completionHandler { - CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + CHIPScenesClusterAddSceneResponseCallbackBridge * onSuccess + = new CHIPScenesClusterAddSceneResponseCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -7252,18 +7895,43 @@ - (void)readAttributeMeasuredValue:(ResponseHandler)completionHandler return; } - CHIP_ERROR err = self.cppCluster.ReadAttributeMeasuredValue(onSuccess->Cancel(), onFailure->Cancel()); + CHIP_ERROR err = self.cppCluster.AddScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId, transitionTime, + chip::ByteSpan((const uint8_t *) [sceneName dataUsingEncoding:NSUTF8StringEncoding].bytes, + [sceneName lengthOfBytesUsingEncoding:NSUTF8StringEncoding]), + clusterId, length, value); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; completionHandler([CHIPError errorForCHIPErrorCode:err], nil); } } +- (void)getSceneMembership:(uint16_t)groupId completionHandler:(ResponseHandler)completionHandler +{ + CHIPScenesClusterGetSceneMembershipResponseCallbackBridge * onSuccess + = new CHIPScenesClusterGetSceneMembershipResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } -- (void)configureAttributeMeasuredValue:(uint16_t)minInterval - maxInterval:(uint16_t)maxInterval - change:(int16_t)change - completionHandler:(ResponseHandler)completionHandler + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.GetSceneMembership(onSuccess->Cancel(), onFailure->Cancel(), groupId); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)recallScene:(uint16_t)groupId + sceneId:(uint8_t)sceneId + transitionTime:(uint16_t)transitionTime + completionHandler:(ResponseHandler)completionHandler { CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { @@ -7278,33 +7946,86 @@ - (void)configureAttributeMeasuredValue:(uint16_t)minInterval return; } - CHIP_ERROR err = self.cppCluster.ConfigureAttributeMeasuredValue( - onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change); + CHIP_ERROR err = self.cppCluster.RecallScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId, transitionTime); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; completionHandler([CHIPError errorForCHIPErrorCode:err], nil); } } +- (void)removeAllScenes:(uint16_t)groupId completionHandler:(ResponseHandler)completionHandler +{ + CHIPScenesClusterRemoveAllScenesResponseCallbackBridge * onSuccess + = new CHIPScenesClusterRemoveAllScenesResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } -- (void)reportAttributeMeasuredValue:(ResponseHandler)reportHandler + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.RemoveAllScenes(onSuccess->Cancel(), onFailure->Cancel(), groupId); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)removeScene:(uint16_t)groupId sceneId:(uint8_t)sceneId completionHandler:(ResponseHandler)completionHandler { - CHIPInt16sAttributeCallbackBridge * onReport = new CHIPInt16sAttributeCallbackBridge(reportHandler, [self callbackQueue], true); - if (!onReport) { - reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + CHIPScenesClusterRemoveSceneResponseCallbackBridge * onSuccess + = new CHIPScenesClusterRemoveSceneResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; } - CHIP_ERROR err = self.cppCluster.ReportAttributeMeasuredValue(onReport->Cancel()); + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.RemoveScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId); if (err != CHIP_NO_ERROR) { - delete onReport; - reportHandler([CHIPError errorForCHIPErrorCode:err], nil); + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); } } +- (void)storeScene:(uint16_t)groupId sceneId:(uint8_t)sceneId completionHandler:(ResponseHandler)completionHandler +{ + CHIPScenesClusterStoreSceneResponseCallbackBridge * onSuccess + = new CHIPScenesClusterStoreSceneResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } -- (void)readAttributeMinMeasuredValue:(ResponseHandler)completionHandler + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.StoreScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)viewScene:(uint16_t)groupId sceneId:(uint8_t)sceneId completionHandler:(ResponseHandler)completionHandler { - CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + CHIPScenesClusterViewSceneResponseCallbackBridge * onSuccess + = new CHIPScenesClusterViewSceneResponseCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -7317,7 +8038,7 @@ - (void)readAttributeMinMeasuredValue:(ResponseHandler)completionHandler return; } - CHIP_ERROR err = self.cppCluster.ReadAttributeMinMeasuredValue(onSuccess->Cancel(), onFailure->Cancel()); + CHIP_ERROR err = self.cppCluster.ViewScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; @@ -7325,9 +8046,9 @@ - (void)readAttributeMinMeasuredValue:(ResponseHandler)completionHandler } } -- (void)readAttributeMaxMeasuredValue:(ResponseHandler)completionHandler +- (void)readAttributeSceneCount:(ResponseHandler)completionHandler { - CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -7340,7 +8061,1363 @@ - (void)readAttributeMaxMeasuredValue:(ResponseHandler)completionHandler return; } - CHIP_ERROR err = self.cppCluster.ReadAttributeMaxMeasuredValue(onSuccess->Cancel(), onFailure->Cancel()); + CHIP_ERROR err = self.cppCluster.ReadAttributeSceneCount(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeCurrentScene:(ResponseHandler)completionHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentScene(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeCurrentGroup:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentGroup(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeSceneValid:(ResponseHandler)completionHandler +{ + CHIPBooleanAttributeCallbackBridge * onSuccess + = new CHIPBooleanAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeSceneValid(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeNameSupport:(ResponseHandler)completionHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeNameSupport(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +@end + +@interface CHIPSwitch () +@property (readonly) Controller::SwitchCluster cppCluster; +@end + +@implementation CHIPSwitch + +- (Controller::ClusterBase *)getCluster +{ + return &_cppCluster; +} + +- (void)readAttributeNumberOfPositions:(ResponseHandler)completionHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeNumberOfPositions(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeCurrentPosition:(ResponseHandler)completionHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentPosition(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)configureAttributeCurrentPosition:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + change:(uint8_t)change + completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ConfigureAttributeCurrentPosition( + onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)reportAttributeCurrentPosition:(ResponseHandler)reportHandler +{ + CHIPInt8uAttributeCallbackBridge * onReport = new CHIPInt8uAttributeCallbackBridge(reportHandler, [self callbackQueue], true); + if (!onReport) { + reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReportAttributeCurrentPosition(onReport->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onReport; + reportHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +@end + +@interface CHIPTemperatureMeasurement () +@property (readonly) Controller::TemperatureMeasurementCluster cppCluster; +@end + +@implementation CHIPTemperatureMeasurement + +- (Controller::ClusterBase *)getCluster +{ + return &_cppCluster; +} + +- (void)readAttributeMeasuredValue:(ResponseHandler)completionHandler +{ + CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeMeasuredValue(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)configureAttributeMeasuredValue:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + change:(int16_t)change + completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ConfigureAttributeMeasuredValue( + onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)reportAttributeMeasuredValue:(ResponseHandler)reportHandler +{ + CHIPInt16sAttributeCallbackBridge * onReport = new CHIPInt16sAttributeCallbackBridge(reportHandler, [self callbackQueue], true); + if (!onReport) { + reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReportAttributeMeasuredValue(onReport->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onReport; + reportHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeMinMeasuredValue:(ResponseHandler)completionHandler +{ + CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeMinMeasuredValue(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeMaxMeasuredValue:(ResponseHandler)completionHandler +{ + CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeMaxMeasuredValue(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +@end + +@interface CHIPThermostat () +@property (readonly) Controller::ThermostatCluster cppCluster; +@end + +@implementation CHIPThermostat + +- (Controller::ClusterBase *)getCluster +{ + return &_cppCluster; +} + +- (void)clearWeeklySchedule:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ClearWeeklySchedule(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)getRelayStatusLog:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.GetRelayStatusLog(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)getWeeklySchedule:(uint8_t)daysToReturn + modeToReturn:(uint8_t)modeToReturn + completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.GetWeeklySchedule(onSuccess->Cancel(), onFailure->Cancel(), daysToReturn, modeToReturn); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)setWeeklySchedule:(uint8_t)numberOfTransitionsForSequence + dayOfWeekForSequence:(uint8_t)dayOfWeekForSequence + modeForSequence:(uint8_t)modeForSequence + payload:(uint8_t)payload + completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.SetWeeklySchedule( + onSuccess->Cancel(), onFailure->Cancel(), numberOfTransitionsForSequence, dayOfWeekForSequence, modeForSequence, payload); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)setpointRaiseLower:(uint8_t)mode amount:(int8_t)amount completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.SetpointRaiseLower(onSuccess->Cancel(), onFailure->Cancel(), mode, amount); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeLocalTemperature:(ResponseHandler)completionHandler +{ + CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeLocalTemperature(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)configureAttributeLocalTemperature:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + change:(int16_t)change + completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ConfigureAttributeLocalTemperature( + onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)reportAttributeLocalTemperature:(ResponseHandler)reportHandler +{ + CHIPInt16sAttributeCallbackBridge * onReport = new CHIPInt16sAttributeCallbackBridge(reportHandler, [self callbackQueue], true); + if (!onReport) { + reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReportAttributeLocalTemperature(onReport->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onReport; + reportHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeOccupiedCoolingSetpoint:(ResponseHandler)completionHandler +{ + CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeOccupiedCoolingSetpoint(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeOccupiedCoolingSetpoint:(int16_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.WriteAttributeOccupiedCoolingSetpoint(onSuccess->Cancel(), onFailure->Cancel(), value); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeOccupiedHeatingSetpoint:(ResponseHandler)completionHandler +{ + CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeOccupiedHeatingSetpoint(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeOccupiedHeatingSetpoint:(int16_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.WriteAttributeOccupiedHeatingSetpoint(onSuccess->Cancel(), onFailure->Cancel(), value); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeControlSequenceOfOperation:(ResponseHandler)completionHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeControlSequenceOfOperation(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeControlSequenceOfOperation:(uint8_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.WriteAttributeControlSequenceOfOperation(onSuccess->Cancel(), onFailure->Cancel(), value); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeSystemMode:(ResponseHandler)completionHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeSystemMode(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeSystemMode:(uint8_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.WriteAttributeSystemMode(onSuccess->Cancel(), onFailure->Cancel(), value); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +@end + +@interface CHIPWindowCovering () +@property (readonly) Controller::WindowCoveringCluster cppCluster; +@end + +@implementation CHIPWindowCovering + +- (Controller::ClusterBase *)getCluster +{ + return &_cppCluster; +} + +- (void)windowCoveringDownClose:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.WindowCoveringDownClose(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)windowCoveringGoToLiftPercentage:(uint8_t)percentageLiftValue completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err + = self.cppCluster.WindowCoveringGoToLiftPercentage(onSuccess->Cancel(), onFailure->Cancel(), percentageLiftValue); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)windowCoveringGoToLiftValue:(uint16_t)liftValue completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.WindowCoveringGoToLiftValue(onSuccess->Cancel(), onFailure->Cancel(), liftValue); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)windowCoveringGoToTiltPercentage:(uint8_t)percentageTiltValue completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err + = self.cppCluster.WindowCoveringGoToTiltPercentage(onSuccess->Cancel(), onFailure->Cancel(), percentageTiltValue); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)windowCoveringGoToTiltValue:(uint16_t)tiltValue completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.WindowCoveringGoToTiltValue(onSuccess->Cancel(), onFailure->Cancel(), tiltValue); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)windowCoveringStop:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.WindowCoveringStop(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)windowCoveringUpOpen:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.WindowCoveringUpOpen(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeWindowCoveringType:(ResponseHandler)completionHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeWindowCoveringType(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)configureAttributeWindowCoveringType:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err + = self.cppCluster.ConfigureAttributeWindowCoveringType(onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)reportAttributeWindowCoveringType:(ResponseHandler)reportHandler +{ + CHIPInt8uAttributeCallbackBridge * onReport = new CHIPInt8uAttributeCallbackBridge(reportHandler, [self callbackQueue], true); + if (!onReport) { + reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReportAttributeWindowCoveringType(onReport->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onReport; + reportHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeCurrentPositionLift:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentPositionLift(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)configureAttributeCurrentPositionLift:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + change:(uint16_t)change + completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ConfigureAttributeCurrentPositionLift( + onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)reportAttributeCurrentPositionLift:(ResponseHandler)reportHandler +{ + CHIPInt16uAttributeCallbackBridge * onReport = new CHIPInt16uAttributeCallbackBridge(reportHandler, [self callbackQueue], true); + if (!onReport) { + reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReportAttributeCurrentPositionLift(onReport->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onReport; + reportHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeCurrentPositionTilt:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentPositionTilt(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)configureAttributeCurrentPositionTilt:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + change:(uint16_t)change + completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ConfigureAttributeCurrentPositionTilt( + onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)reportAttributeCurrentPositionTilt:(ResponseHandler)reportHandler +{ + CHIPInt16uAttributeCallbackBridge * onReport = new CHIPInt16uAttributeCallbackBridge(reportHandler, [self callbackQueue], true); + if (!onReport) { + reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReportAttributeCurrentPositionTilt(onReport->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onReport; + reportHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeConfigStatus:(ResponseHandler)completionHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeConfigStatus(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)configureAttributeConfigStatus:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err + = self.cppCluster.ConfigureAttributeConfigStatus(onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)reportAttributeConfigStatus:(ResponseHandler)reportHandler +{ + CHIPInt8uAttributeCallbackBridge * onReport = new CHIPInt8uAttributeCallbackBridge(reportHandler, [self callbackQueue], true); + if (!onReport) { + reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReportAttributeConfigStatus(onReport->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onReport; + reportHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeInstalledOpenLimitLift:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeInstalledOpenLimitLift(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeInstalledClosedLimitLift:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeInstalledClosedLimitLift(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeInstalledOpenLimitTilt:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeInstalledOpenLimitTilt(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeInstalledClosedLimitTilt:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeInstalledClosedLimitTilt(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeMode:(ResponseHandler)completionHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeMode(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeMode:(uint8_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.WriteAttributeMode(onSuccess->Cancel(), onFailure->Cancel(), value); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; diff --git a/src/controller/python/gen/IMClusterCommandHandler.cpp b/src/controller/python/gen/IMClusterCommandHandler.cpp index a634a043c0444d..934fb34f6b2abf 100644 --- a/src/controller/python/gen/IMClusterCommandHandler.cpp +++ b/src/controller/python/gen/IMClusterCommandHandler.cpp @@ -2149,6 +2149,91 @@ void DispatchClientCommand(app::Command * apCommandObj, CommandId aCommandId, En } break; } + case ZCL_COMMISSIONING_COMPLETE_RESPONSE_COMMAND_ID: { + // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV + // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. + // Any error value TLVUnpackError means we have received an illegal value. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t errorCode; + bool errorCodeExists = false; + const uint8_t * debugText; + bool debugTextExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(aDataTlv.GetTag())) + { + case 0: + if (errorCodeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(errorCode); + if (CHIP_NO_ERROR == TLVUnpackError) + { + errorCodeExists = true; + validArgumentCount++; + } + break; + case 1: + if (debugTextExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = aDataTlv.GetDataPtr(debugText); + if (CHIP_NO_ERROR == TLVUnpackError) + { + debugTextExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(aDataTlv.GetTag()), TLVUnpackError); + break; + } + } + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfGeneralCommissioningClusterCommissioningCompleteResponseCallback(apCommandObj, errorCode, + const_cast(debugText)); + } + else + { + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kBadRequest, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogProgress( + Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, + 2, validArgumentCount, TLVError, TLVUnpackError); + } + break; + } case ZCL_SET_REGULATORY_CONFIG_RESPONSE_COMMAND_ID: { // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. @@ -3454,6 +3539,94 @@ void DispatchClientCommand(app::Command * apCommandObj, CommandId aCommandId, En } // namespace NetworkCommissioning +namespace OperationalCredentials { + +void DispatchClientCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) +{ + { + switch (aCommandId) + { + case ZCL_GET_FABRIC_ID_RESPONSE_COMMAND_ID: { + // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV + // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. + // Any error value TLVUnpackError means we have received an illegal value. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + chip::FabricId FabricId; + bool FabricIdExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(aDataTlv.GetTag())) + { + case 0: + if (FabricIdExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(FabricId); + if (CHIP_NO_ERROR == TLVUnpackError) + { + FabricIdExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(aDataTlv.GetTag()), TLVUnpackError); + break; + } + } + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfOperationalCredentialsClusterGetFabricIdResponseCallback(apCommandObj, FabricId); + } + else + { + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kBadRequest, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogProgress( + Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, + 1, validArgumentCount, TLVError, TLVUnpackError); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, + ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID); + break; + } + } + } +} + +} // namespace OperationalCredentials + namespace Scenes { void DispatchClientCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) diff --git a/src/controller/python/gen/attribute-id.h b/src/controller/python/gen/attribute-id.h index 43d108726fe431..229d4014f4b1ba 100644 --- a/src/controller/python/gen/attribute-id.h +++ b/src/controller/python/gen/attribute-id.h @@ -421,6 +421,15 @@ // Server attributes +// Attribute ids for cluster: Switch + +// Client attributes + +// Server attributes +#define ZCL_NUMBER_OF_POSITIONS_ATTRIBUTE_ID (0x0000) +#define ZCL_CURRENT_POSITION_ATTRIBUTE_ID (0x0001) +#define ZCL_MULTI_PRESS_MAX_ATTRIBUTE_ID (0x0002) + // Attribute ids for cluster: Operational Credentials // Client attributes diff --git a/src/controller/python/gen/call-command-handler.cpp b/src/controller/python/gen/call-command-handler.cpp index 36c2cd5d4bca5c..25af5b817391f8 100644 --- a/src/controller/python/gen/call-command-handler.cpp +++ b/src/controller/python/gen/call-command-handler.cpp @@ -33,16 +33,23 @@ EmberAfStatus emberAfBarrierControlClusterClientCommandParse(EmberAfClusterComma EmberAfStatus emberAfBasicClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfBindingClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfColorControlClusterClientCommandParse(EmberAfClusterCommand * cmd); +EmberAfStatus emberAfDescriptorClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfDoorLockClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfGeneralCommissioningClusterClientCommandParse(EmberAfClusterCommand * cmd); +EmberAfStatus emberAfGroupKeyManagementClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfGroupsClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfIdentifyClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfLevelControlClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfLowPowerClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfNetworkCommissioningClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfOnOffClusterClientCommandParse(EmberAfClusterCommand * cmd); +EmberAfStatus emberAfOperationalCredentialsClusterClientCommandParse(EmberAfClusterCommand * cmd); +EmberAfStatus emberAfPumpConfigurationAndControlClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfScenesClusterClientCommandParse(EmberAfClusterCommand * cmd); +EmberAfStatus emberAfSwitchClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfTemperatureMeasurementClusterClientCommandParse(EmberAfClusterCommand * cmd); +EmberAfStatus emberAfThermostatClusterClientCommandParse(EmberAfClusterCommand * cmd); +EmberAfStatus emberAfWindowCoveringClusterClientCommandParse(EmberAfClusterCommand * cmd); static EmberAfStatus status(bool wasHandled, bool clusterExists, bool mfgSpecific) { @@ -93,12 +100,20 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd) // No commands are enabled for cluster Color Control result = status(false, true, cmd->mfgSpecific); break; + case ZCL_DESCRIPTOR_CLUSTER_ID: + // No commands are enabled for cluster Descriptor + result = status(false, true, cmd->mfgSpecific); + break; case ZCL_DOOR_LOCK_CLUSTER_ID: result = emberAfDoorLockClusterClientCommandParse(cmd); break; case ZCL_GENERAL_COMMISSIONING_CLUSTER_ID: result = emberAfGeneralCommissioningClusterClientCommandParse(cmd); break; + case ZCL_GROUP_KEY_MANAGEMENT_CLUSTER_ID: + // No commands are enabled for cluster Group Key Management + result = status(false, true, cmd->mfgSpecific); + break; case ZCL_GROUPS_CLUSTER_ID: result = emberAfGroupsClusterClientCommandParse(cmd); break; @@ -120,13 +135,32 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd) // No commands are enabled for cluster On/off result = status(false, true, cmd->mfgSpecific); break; + case ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID: + result = emberAfOperationalCredentialsClusterClientCommandParse(cmd); + break; + case ZCL_PUMP_CONFIG_CONTROL_CLUSTER_ID: + // No commands are enabled for cluster Pump Configuration and Control + result = status(false, true, cmd->mfgSpecific); + break; case ZCL_SCENES_CLUSTER_ID: result = emberAfScenesClusterClientCommandParse(cmd); break; + case ZCL_SWITCH_CLUSTER_ID: + // No commands are enabled for cluster Switch + result = status(false, true, cmd->mfgSpecific); + break; case ZCL_TEMP_MEASUREMENT_CLUSTER_ID: // No commands are enabled for cluster Temperature Measurement result = status(false, true, cmd->mfgSpecific); break; + case ZCL_THERMOSTAT_CLUSTER_ID: + // No commands are enabled for cluster Thermostat + result = status(false, true, cmd->mfgSpecific); + break; + case ZCL_WINDOW_COVERING_CLUSTER_ID: + // No commands are enabled for cluster Window Covering + result = status(false, true, cmd->mfgSpecific); + break; default: // Unrecognized cluster ID, error status will apply. break; @@ -690,6 +724,26 @@ EmberAfStatus emberAfGeneralCommissioningClusterClientCommandParse(EmberAfCluste wasHandled = emberAfGeneralCommissioningClusterArmFailSafeResponseCallback(nullptr, errorCode, debugText); break; } + case ZCL_COMMISSIONING_COMPLETE_RESPONSE_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t errorCode; + uint8_t * debugText; + + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + errorCode = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1u) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + debugText = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfGeneralCommissioningClusterCommissioningCompleteResponseCallback(nullptr, errorCode, debugText); + break; + } case ZCL_SET_REGULATORY_CONFIG_RESPONSE_COMMAND_ID: { uint16_t payloadOffset = cmd->payloadStartIndex; uint8_t errorCode; @@ -1035,6 +1089,35 @@ EmberAfStatus emberAfNetworkCommissioningClusterClientCommandParse(EmberAfCluste } return status(wasHandled, true, cmd->mfgSpecific); } +EmberAfStatus emberAfOperationalCredentialsClusterClientCommandParse(EmberAfClusterCommand * cmd) +{ + bool wasHandled = false; + + if (!cmd->mfgSpecific) + { + switch (cmd->commandId) + { + case ZCL_GET_FABRIC_ID_RESPONSE_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + chip::FabricId FabricId; + + if (cmd->bufLen < payloadOffset + 8) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + FabricId = emberAfGetInt64u(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfOperationalCredentialsClusterGetFabricIdResponseCallback(nullptr, FabricId); + break; + } + default: { + // Unrecognized command ID, error status will apply. + break; + } + } + } + return status(wasHandled, true, cmd->mfgSpecific); +} EmberAfStatus emberAfScenesClusterClientCommandParse(EmberAfClusterCommand * cmd) { bool wasHandled = false; diff --git a/src/controller/python/gen/callback-stub.cpp b/src/controller/python/gen/callback-stub.cpp index 6720701bf6a395..c2400d9f122741 100644 --- a/src/controller/python/gen/callback-stub.cpp +++ b/src/controller/python/gen/callback-stub.cpp @@ -44,12 +44,18 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case ZCL_COLOR_CONTROL_CLUSTER_ID: emberAfColorControlClusterInitCallback(endpoint); break; + case ZCL_DESCRIPTOR_CLUSTER_ID: + emberAfDescriptorClusterInitCallback(endpoint); + break; case ZCL_DOOR_LOCK_CLUSTER_ID: emberAfDoorLockClusterInitCallback(endpoint); break; case ZCL_GENERAL_COMMISSIONING_CLUSTER_ID: emberAfGeneralCommissioningClusterInitCallback(endpoint); break; + case ZCL_GROUP_KEY_MANAGEMENT_CLUSTER_ID: + emberAfGroupKeyManagementClusterInitCallback(endpoint); + break; case ZCL_GROUPS_CLUSTER_ID: emberAfGroupsClusterInitCallback(endpoint); break; @@ -68,12 +74,27 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case ZCL_ON_OFF_CLUSTER_ID: emberAfOnOffClusterInitCallback(endpoint); break; + case ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID: + emberAfOperationalCredentialsClusterInitCallback(endpoint); + break; + case ZCL_PUMP_CONFIG_CONTROL_CLUSTER_ID: + emberAfPumpConfigurationAndControlClusterInitCallback(endpoint); + break; case ZCL_SCENES_CLUSTER_ID: emberAfScenesClusterInitCallback(endpoint); break; + case ZCL_SWITCH_CLUSTER_ID: + emberAfSwitchClusterInitCallback(endpoint); + break; case ZCL_TEMP_MEASUREMENT_CLUSTER_ID: emberAfTemperatureMeasurementClusterInitCallback(endpoint); break; + case ZCL_THERMOSTAT_CLUSTER_ID: + emberAfThermostatClusterInitCallback(endpoint); + break; + case ZCL_WINDOW_COVERING_CLUSTER_ID: + emberAfWindowCoveringClusterInitCallback(endpoint); + break; default: // Unrecognized cluster ID break; @@ -105,6 +126,11 @@ void __attribute__((weak)) emberAfColorControlClusterInitCallback(EndpointId end // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfDescriptorClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfDoorLockClusterInitCallback(EndpointId endpoint) { // To prevent warning @@ -115,6 +141,11 @@ void __attribute__((weak)) emberAfGeneralCommissioningClusterInitCallback(Endpoi // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfGroupKeyManagementClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfGroupsClusterInitCallback(EndpointId endpoint) { // To prevent warning @@ -145,16 +176,41 @@ void __attribute__((weak)) emberAfOnOffClusterInitCallback(EndpointId endpoint) // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfOperationalCredentialsClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfPumpConfigurationAndControlClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfScenesClusterInitCallback(EndpointId endpoint) { // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfSwitchClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfTemperatureMeasurementClusterInitCallback(EndpointId endpoint) { // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfThermostatClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfWindowCoveringClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} // // Non-Cluster Related Callbacks diff --git a/src/controller/python/gen/callback.h b/src/controller/python/gen/callback.h index 303f64478110bf..45d784f60a774a 100644 --- a/src/controller/python/gen/callback.h +++ b/src/controller/python/gen/callback.h @@ -80,6 +80,14 @@ void emberAfBindingClusterInitCallback(chip::EndpointId endpoint); */ void emberAfColorControlClusterInitCallback(chip::EndpointId endpoint); +/** @brief Descriptor Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfDescriptorClusterInitCallback(chip::EndpointId endpoint); + /** @brief Door Lock Cluster Init * * Cluster Init @@ -96,6 +104,14 @@ void emberAfDoorLockClusterInitCallback(chip::EndpointId endpoint); */ void emberAfGeneralCommissioningClusterInitCallback(chip::EndpointId endpoint); +/** @brief Group Key Management Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfGroupKeyManagementClusterInitCallback(chip::EndpointId endpoint); + /** @brief Groups Cluster Init * * Cluster Init @@ -144,6 +160,22 @@ void emberAfNetworkCommissioningClusterInitCallback(chip::EndpointId endpoint); */ void emberAfOnOffClusterInitCallback(chip::EndpointId endpoint); +/** @brief Operational Credentials Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfOperationalCredentialsClusterInitCallback(chip::EndpointId endpoint); + +/** @brief Pump Configuration and Control Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfPumpConfigurationAndControlClusterInitCallback(chip::EndpointId endpoint); + /** @brief Scenes Cluster Init * * Cluster Init @@ -152,6 +184,14 @@ void emberAfOnOffClusterInitCallback(chip::EndpointId endpoint); */ void emberAfScenesClusterInitCallback(chip::EndpointId endpoint); +/** @brief Switch Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfSwitchClusterInitCallback(chip::EndpointId endpoint); + /** @brief Temperature Measurement Cluster Init * * Cluster Init @@ -160,6 +200,22 @@ void emberAfScenesClusterInitCallback(chip::EndpointId endpoint); */ void emberAfTemperatureMeasurementClusterInitCallback(chip::EndpointId endpoint); +/** @brief Thermostat Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfThermostatClusterInitCallback(chip::EndpointId endpoint); + +/** @brief Window Covering Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfWindowCoveringClusterInitCallback(chip::EndpointId endpoint); + // Cluster Server/Client Init Functions // @@ -512,6 +568,76 @@ EmberAfStatus emberAfColorControlClusterClientPreAttributeChangedCallback(chip:: */ void emberAfColorControlClusterClientTickCallback(chip::EndpointId endpoint); +// +// Descriptor Cluster client +// + +/** @brief Descriptor Cluster Client Init + * + * Client Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfDescriptorClusterClientInitCallback(chip::EndpointId endpoint); + +/** @brief Descriptor Cluster Client Attribute Changed + * + * Client Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + */ +void emberAfDescriptorClusterClientAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); + +/** @brief Descriptor Cluster Client Manufacturer Specific Attribute Changed + * + * Client Manufacturer Specific Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + * @param manufacturerCode Manufacturer Code of the attribute that changed + */ +void emberAfDescriptorClusterClientManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + uint16_t manufacturerCode); + +/** @brief Descriptor Cluster Client Message Sent + * + * Client Message Sent + * + * @param type The type of message sent + * @param indexOrDestination The destination or address to which the message was sent + * @param apsFrame The APS frame for the message + * @param msgLen The length of the message + * @param message The message that was sent + * @param status The status of the sent message + */ +void emberAfDescriptorClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, + EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, + EmberStatus status); + +/** @brief Descriptor Cluster Client Pre Attribute Changed + * + * client Pre Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +EmberAfStatus emberAfDescriptorClusterClientPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, + EmberAfAttributeType attributeType, uint8_t size, + uint8_t * value); + +/** @brief Descriptor Cluster Client Tick + * + * client Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfDescriptorClusterClientTickCallback(chip::EndpointId endpoint); + // // Door Lock Cluster client // @@ -653,6 +779,77 @@ EmberAfStatus emberAfGeneralCommissioningClusterClientPreAttributeChangedCallbac */ void emberAfGeneralCommissioningClusterClientTickCallback(chip::EndpointId endpoint); +// +// Group Key Management Cluster client +// + +/** @brief Group Key Management Cluster Client Init + * + * Client Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfGroupKeyManagementClusterClientInitCallback(chip::EndpointId endpoint); + +/** @brief Group Key Management Cluster Client Attribute Changed + * + * Client Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + */ +void emberAfGroupKeyManagementClusterClientAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); + +/** @brief Group Key Management Cluster Client Manufacturer Specific Attribute Changed + * + * Client Manufacturer Specific Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + * @param manufacturerCode Manufacturer Code of the attribute that changed + */ +void emberAfGroupKeyManagementClusterClientManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + uint16_t manufacturerCode); + +/** @brief Group Key Management Cluster Client Message Sent + * + * Client Message Sent + * + * @param type The type of message sent + * @param indexOrDestination The destination or address to which the message was sent + * @param apsFrame The APS frame for the message + * @param msgLen The length of the message + * @param message The message that was sent + * @param status The status of the sent message + */ +void emberAfGroupKeyManagementClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, + EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, + EmberStatus status); + +/** @brief Group Key Management Cluster Client Pre Attribute Changed + * + * client Pre Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +EmberAfStatus emberAfGroupKeyManagementClusterClientPreAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + EmberAfAttributeType attributeType, uint8_t size, + uint8_t * value); + +/** @brief Group Key Management Cluster Client Tick + * + * client Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfGroupKeyManagementClusterClientTickCallback(chip::EndpointId endpoint); + // // Groups Cluster client // @@ -1072,6 +1269,149 @@ EmberAfStatus emberAfOnOffClusterClientPreAttributeChangedCallback(chip::Endpoin */ void emberAfOnOffClusterClientTickCallback(chip::EndpointId endpoint); +// +// Operational Credentials Cluster client +// + +/** @brief Operational Credentials Cluster Client Init + * + * Client Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfOperationalCredentialsClusterClientInitCallback(chip::EndpointId endpoint); + +/** @brief Operational Credentials Cluster Client Attribute Changed + * + * Client Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + */ +void emberAfOperationalCredentialsClusterClientAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); + +/** @brief Operational Credentials Cluster Client Manufacturer Specific Attribute Changed + * + * Client Manufacturer Specific Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + * @param manufacturerCode Manufacturer Code of the attribute that changed + */ +void emberAfOperationalCredentialsClusterClientManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + uint16_t manufacturerCode); + +/** @brief Operational Credentials Cluster Client Message Sent + * + * Client Message Sent + * + * @param type The type of message sent + * @param indexOrDestination The destination or address to which the message was sent + * @param apsFrame The APS frame for the message + * @param msgLen The length of the message + * @param message The message that was sent + * @param status The status of the sent message + */ +void emberAfOperationalCredentialsClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, + EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, + EmberStatus status); + +/** @brief Operational Credentials Cluster Client Pre Attribute Changed + * + * client Pre Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +EmberAfStatus emberAfOperationalCredentialsClusterClientPreAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + EmberAfAttributeType attributeType, + uint8_t size, uint8_t * value); + +/** @brief Operational Credentials Cluster Client Tick + * + * client Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfOperationalCredentialsClusterClientTickCallback(chip::EndpointId endpoint); + +// +// Pump Configuration and Control Cluster client +// + +/** @brief Pump Configuration and Control Cluster Client Init + * + * Client Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfPumpConfigurationAndControlClusterClientInitCallback(chip::EndpointId endpoint); + +/** @brief Pump Configuration and Control Cluster Client Attribute Changed + * + * Client Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + */ +void emberAfPumpConfigurationAndControlClusterClientAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId); + +/** @brief Pump Configuration and Control Cluster Client Manufacturer Specific Attribute Changed + * + * Client Manufacturer Specific Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + * @param manufacturerCode Manufacturer Code of the attribute that changed + */ +void emberAfPumpConfigurationAndControlClusterClientManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + uint16_t manufacturerCode); + +/** @brief Pump Configuration and Control Cluster Client Message Sent + * + * Client Message Sent + * + * @param type The type of message sent + * @param indexOrDestination The destination or address to which the message was sent + * @param apsFrame The APS frame for the message + * @param msgLen The length of the message + * @param message The message that was sent + * @param status The status of the sent message + */ +void emberAfPumpConfigurationAndControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, + EmberApsFrame * apsFrame, uint16_t msgLen, + uint8_t * message, EmberStatus status); + +/** @brief Pump Configuration and Control Cluster Client Pre Attribute Changed + * + * client Pre Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +EmberAfStatus emberAfPumpConfigurationAndControlClusterClientPreAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + EmberAfAttributeType attributeType, + uint8_t size, uint8_t * value); + +/** @brief Pump Configuration and Control Cluster Client Tick + * + * client Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfPumpConfigurationAndControlClusterClientTickCallback(chip::EndpointId endpoint); + // // Scenes Cluster client // @@ -1142,6 +1482,76 @@ EmberAfStatus emberAfScenesClusterClientPreAttributeChangedCallback(chip::Endpoi */ void emberAfScenesClusterClientTickCallback(chip::EndpointId endpoint); +// +// Switch Cluster client +// + +/** @brief Switch Cluster Client Init + * + * Client Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfSwitchClusterClientInitCallback(chip::EndpointId endpoint); + +/** @brief Switch Cluster Client Attribute Changed + * + * Client Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + */ +void emberAfSwitchClusterClientAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); + +/** @brief Switch Cluster Client Manufacturer Specific Attribute Changed + * + * Client Manufacturer Specific Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + * @param manufacturerCode Manufacturer Code of the attribute that changed + */ +void emberAfSwitchClusterClientManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + uint16_t manufacturerCode); + +/** @brief Switch Cluster Client Message Sent + * + * Client Message Sent + * + * @param type The type of message sent + * @param indexOrDestination The destination or address to which the message was sent + * @param apsFrame The APS frame for the message + * @param msgLen The length of the message + * @param message The message that was sent + * @param status The status of the sent message + */ +void emberAfSwitchClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, + EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, + EmberStatus status); + +/** @brief Switch Cluster Client Pre Attribute Changed + * + * client Pre Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +EmberAfStatus emberAfSwitchClusterClientPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, + EmberAfAttributeType attributeType, uint8_t size, + uint8_t * value); + +/** @brief Switch Cluster Client Tick + * + * client Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfSwitchClusterClientTickCallback(chip::EndpointId endpoint); + // // Temperature Measurement Cluster client // @@ -1213,6 +1623,147 @@ EmberAfStatus emberAfTemperatureMeasurementClusterClientPreAttributeChangedCallb */ void emberAfTemperatureMeasurementClusterClientTickCallback(chip::EndpointId endpoint); +// +// Thermostat Cluster client +// + +/** @brief Thermostat Cluster Client Init + * + * Client Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfThermostatClusterClientInitCallback(chip::EndpointId endpoint); + +/** @brief Thermostat Cluster Client Attribute Changed + * + * Client Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + */ +void emberAfThermostatClusterClientAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); + +/** @brief Thermostat Cluster Client Manufacturer Specific Attribute Changed + * + * Client Manufacturer Specific Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + * @param manufacturerCode Manufacturer Code of the attribute that changed + */ +void emberAfThermostatClusterClientManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + uint16_t manufacturerCode); + +/** @brief Thermostat Cluster Client Message Sent + * + * Client Message Sent + * + * @param type The type of message sent + * @param indexOrDestination The destination or address to which the message was sent + * @param apsFrame The APS frame for the message + * @param msgLen The length of the message + * @param message The message that was sent + * @param status The status of the sent message + */ +void emberAfThermostatClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, + EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, + EmberStatus status); + +/** @brief Thermostat Cluster Client Pre Attribute Changed + * + * client Pre Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +EmberAfStatus emberAfThermostatClusterClientPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, + EmberAfAttributeType attributeType, uint8_t size, + uint8_t * value); + +/** @brief Thermostat Cluster Client Tick + * + * client Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfThermostatClusterClientTickCallback(chip::EndpointId endpoint); + +// +// Window Covering Cluster client +// + +/** @brief Window Covering Cluster Client Init + * + * Client Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfWindowCoveringClusterClientInitCallback(chip::EndpointId endpoint); + +/** @brief Window Covering Cluster Client Attribute Changed + * + * Client Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + */ +void emberAfWindowCoveringClusterClientAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); + +/** @brief Window Covering Cluster Client Manufacturer Specific Attribute Changed + * + * Client Manufacturer Specific Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + * @param manufacturerCode Manufacturer Code of the attribute that changed + */ +void emberAfWindowCoveringClusterClientManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + uint16_t manufacturerCode); + +/** @brief Window Covering Cluster Client Message Sent + * + * Client Message Sent + * + * @param type The type of message sent + * @param indexOrDestination The destination or address to which the message was sent + * @param apsFrame The APS frame for the message + * @param msgLen The length of the message + * @param message The message that was sent + * @param status The status of the sent message + */ +void emberAfWindowCoveringClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, + EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, + EmberStatus status); + +/** @brief Window Covering Cluster Client Pre Attribute Changed + * + * client Pre Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +EmberAfStatus emberAfWindowCoveringClusterClientPreAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + EmberAfAttributeType attributeType, uint8_t size, + uint8_t * value); + +/** @brief Window Covering Cluster Client Tick + * + * client Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfWindowCoveringClusterClientTickCallback(chip::EndpointId endpoint); + // Cluster Commands Callback /** @@ -1422,6 +1973,15 @@ bool emberAfDoorLockClusterUnlockWithTimeoutResponseCallback(chip::app::Command bool emberAfGeneralCommissioningClusterArmFailSafeResponseCallback(chip::app::Command * commandObj, uint8_t errorCode, uint8_t * debugText); +/** + * @brief General Commissioning Cluster CommissioningCompleteResponse Command callback + * @param errorCode + * @param debugText + */ + +bool emberAfGeneralCommissioningClusterCommissioningCompleteResponseCallback(chip::app::Command * commandObj, uint8_t errorCode, + uint8_t * debugText); + /** * @brief General Commissioning Cluster SetRegulatoryConfigResponse Command callback * @param errorCode @@ -1550,6 +2110,13 @@ bool emberAfNetworkCommissioningClusterUpdateThreadNetworkResponseCallback(chip: bool emberAfNetworkCommissioningClusterUpdateWiFiNetworkResponseCallback(chip::app::Command * commandObj, uint8_t errorCode, uint8_t * debugText); +/** + * @brief Operational Credentials Cluster GetFabricIdResponse Command callback + * @param fabricId + */ + +bool emberAfOperationalCredentialsClusterGetFabricIdResponseCallback(chip::app::Command * commandObj, chip::FabricId FabricId); + /** * @brief Scenes Cluster AddSceneResponse Command callback * @param status diff --git a/src/controller/python/gen/cluster-id.h b/src/controller/python/gen/cluster-id.h index 3aea880546f261..b8d9a9f7ed09bf 100644 --- a/src/controller/python/gen/cluster-id.h +++ b/src/controller/python/gen/cluster-id.h @@ -98,6 +98,9 @@ // Definitions for cluster: Network Commissioning #define ZCL_NETWORK_COMMISSIONING_CLUSTER_ID (0x0031) +// Definitions for cluster: Switch +#define ZCL_SWITCH_CLUSTER_ID (0x003B) + // Definitions for cluster: Operational Credentials #define ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID (0x003E) diff --git a/src/controller/python/gen/endpoint_config.h b/src/controller/python/gen/endpoint_config.h index 14f176b50c8af0..8de5298046d3f1 100644 --- a/src/controller/python/gen/endpoint_config.h +++ b/src/controller/python/gen/endpoint_config.h @@ -63,7 +63,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 15 +#define GENERATED_ATTRIBUTE_COUNT 22 #define GENERATED_ATTRIBUTES \ { \ \ @@ -82,6 +82,9 @@ /* Endpoint: 1, Cluster: Level Control (client) */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(3) }, /* cluster revision */ \ \ + /* Endpoint: 1, Cluster: Descriptor (client) */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ + \ /* Endpoint: 1, Cluster: Basic (client) */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ ZAP_SIMPLE_DEFAULT(3) }, /* cluster revision */ \ @@ -90,14 +93,29 @@ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ /* Endpoint: 1, Cluster: Network Commissioning (client) */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ + \ + /* Endpoint: 1, Cluster: Switch (client) */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ + \ + /* Endpoint: 1, Cluster: Operational Credentials (client) */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ /* Endpoint: 1, Cluster: Door Lock (client) */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(3) }, /* cluster revision */ \ + \ + /* Endpoint: 1, Cluster: Window Covering (client) */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(3) }, /* cluster revision */ \ \ /* Endpoint: 1, Cluster: Barrier Control (client) */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ + /* Endpoint: 1, Cluster: Pump Configuration and Control (client) */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ + \ + /* Endpoint: 1, Cluster: Thermostat (client) */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(3) }, /* cluster revision */ \ + \ /* Endpoint: 1, Cluster: Color Control (client) */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(3) }, /* cluster revision */ \ \ @@ -111,6 +129,9 @@ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ /* Endpoint: 1, Cluster: Binding (client) */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ + \ + /* Endpoint: 1, Cluster: Group Key Management (client) */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ } @@ -121,7 +142,7 @@ #define GENERATED_FUNCTION_ARRAYS #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask -#define GENERATED_CLUSTER_COUNT 15 +#define GENERATED_CLUSTER_COUNT 22 #define GENERATED_CLUSTERS \ { \ { 0x0003, ZAP_ATTRIBUTE_INDEX(0), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Identify (client) */ \ @@ -131,34 +152,53 @@ { \ 0x0008, ZAP_ATTRIBUTE_INDEX(4), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Level Control (client) */ \ - { 0x0028, ZAP_ATTRIBUTE_INDEX(5), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Basic (client) */ \ { \ - 0x0030, ZAP_ATTRIBUTE_INDEX(6), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x001D, ZAP_ATTRIBUTE_INDEX(5), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + }, /* Endpoint: 1, Cluster: Descriptor (client) */ \ + { 0x0028, ZAP_ATTRIBUTE_INDEX(6), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Basic (client) */ \ + { \ + 0x0030, ZAP_ATTRIBUTE_INDEX(7), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: General Commissioning (client) */ \ { \ - 0x0031, ZAP_ATTRIBUTE_INDEX(7), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0031, ZAP_ATTRIBUTE_INDEX(8), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Network Commissioning (client) */ \ + { 0x003B, ZAP_ATTRIBUTE_INDEX(9), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Switch (client) */ \ { \ - 0x0101, ZAP_ATTRIBUTE_INDEX(8), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x003E, ZAP_ATTRIBUTE_INDEX(10), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + }, /* Endpoint: 1, Cluster: Operational Credentials (client) */ \ + { \ + 0x0101, ZAP_ATTRIBUTE_INDEX(11), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Door Lock (client) */ \ { \ - 0x0103, ZAP_ATTRIBUTE_INDEX(9), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0102, ZAP_ATTRIBUTE_INDEX(12), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + }, /* Endpoint: 1, Cluster: Window Covering (client) */ \ + { \ + 0x0103, ZAP_ATTRIBUTE_INDEX(13), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Barrier Control (client) */ \ { \ - 0x0300, ZAP_ATTRIBUTE_INDEX(10), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0200, ZAP_ATTRIBUTE_INDEX(14), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + }, /* Endpoint: 1, Cluster: Pump Configuration and Control (client) */ \ + { \ + 0x0201, ZAP_ATTRIBUTE_INDEX(15), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + }, /* Endpoint: 1, Cluster: Thermostat (client) */ \ + { \ + 0x0300, ZAP_ATTRIBUTE_INDEX(16), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Color Control (client) */ \ { \ - 0x0402, ZAP_ATTRIBUTE_INDEX(11), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0402, ZAP_ATTRIBUTE_INDEX(17), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Temperature Measurement (client) */ \ { \ - 0x0508, ZAP_ATTRIBUTE_INDEX(12), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0508, ZAP_ATTRIBUTE_INDEX(18), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Low Power (client) */ \ { \ - 0x050D, ZAP_ATTRIBUTE_INDEX(13), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x050D, ZAP_ATTRIBUTE_INDEX(19), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Application Basic (client) */ \ { \ - 0xF000, ZAP_ATTRIBUTE_INDEX(14), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0xF000, ZAP_ATTRIBUTE_INDEX(20), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Binding (client) */ \ + { \ + 0xF004, ZAP_ATTRIBUTE_INDEX(21), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + }, /* Endpoint: 1, Cluster: Group Key Management (client) */ \ } #define ZAP_CLUSTER_INDEX(index) ((EmberAfCluster *) (&generatedClusters[index])) @@ -166,7 +206,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 15, 30 }, \ + { ZAP_CLUSTER_INDEX(0), 22, 44 }, \ } // Largest attribute size is needed for various buffers @@ -176,7 +216,7 @@ #define ATTRIBUTE_SINGLETONS_SIZE (2) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (30) +#define ATTRIBUTE_MAX_SIZE (44) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (1) @@ -220,7 +260,7 @@ // Array of EmberAfCommandMetadata structs. #define ZAP_COMMAND_MASK(mask) COMMAND_MASK_##mask -#define EMBER_AF_GENERATED_COMMAND_COUNT (129) +#define EMBER_AF_GENERATED_COMMAND_COUNT (149) #define GENERATED_COMMANDS \ { \ \ @@ -283,6 +323,8 @@ { 0x0030, 0x02, ZAP_COMMAND_MASK(INCOMING_CLIENT) | ZAP_COMMAND_MASK(OUTGOING_CLIENT) }, /* SetRegulatoryConfig */ \ { 0x0030, 0x03, \ ZAP_COMMAND_MASK(INCOMING_CLIENT) | ZAP_COMMAND_MASK(OUTGOING_CLIENT) }, /* SetRegulatoryConfigResponse */ \ + { 0x0030, 0x04, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* CommissioningComplete */ \ + { 0x0030, 0x05, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* CommissioningCompleteResponse */ \ \ /* Endpoint: 1, Cluster: Network Commissioning (client) */ \ { 0x0031, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* ScanNetworks */ \ @@ -303,6 +345,12 @@ { 0x0031, 0x0F, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* DisableNetworkResponse */ \ { 0x0031, 0x10, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* GetLastNetworkCommissioningResult */ \ \ + /* Endpoint: 1, Cluster: Operational Credentials (client) */ \ + { 0x003E, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* GetFabricId */ \ + { 0x003E, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* GetFabricIdResponse */ \ + { 0x003E, 0x09, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* UpdateFabricLabel */ \ + { 0x003E, 0x0A, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* RemoveFabric */ \ + \ /* Endpoint: 1, Cluster: Door Lock (client) */ \ { 0x0101, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* LockDoor */ \ { 0x0101, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* LockDoorResponse */ \ @@ -363,10 +411,28 @@ { 0x0101, 0x19, ZAP_COMMAND_MASK(INCOMING_CLIENT) | ZAP_COMMAND_MASK(OUTGOING_CLIENT) }, /* ClearAllRfids */ \ { 0x0101, 0x19, ZAP_COMMAND_MASK(INCOMING_CLIENT) | ZAP_COMMAND_MASK(OUTGOING_CLIENT) }, /* ClearAllRfidsResponse */ \ \ + /* Endpoint: 1, Cluster: Window Covering (client) */ \ + { 0x0102, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* WindowCoveringUpOpen */ \ + { 0x0102, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* WindowCoveringDownClose */ \ + { 0x0102, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* WindowCoveringStop */ \ + { 0x0102, 0x04, ZAP_COMMAND_MASK(OUTGOING_CLIENT) }, /* WindowCoveringGoToLiftValue */ \ + { 0x0102, 0x05, ZAP_COMMAND_MASK(OUTGOING_CLIENT) }, /* WindowCoveringGoToLiftPercentage */ \ + { 0x0102, 0x07, ZAP_COMMAND_MASK(OUTGOING_CLIENT) }, /* WindowCoveringGoToTiltValue */ \ + { 0x0102, 0x08, ZAP_COMMAND_MASK(OUTGOING_CLIENT) }, /* WindowCoveringGoToTiltPercentage */ \ + \ /* Endpoint: 1, Cluster: Barrier Control (client) */ \ { 0x0103, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* BarrierControlGoToPercent */ \ { 0x0103, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* BarrierControlStop */ \ \ + /* Endpoint: 1, Cluster: Thermostat (client) */ \ + { 0x0201, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* SetpointRaiseLower */ \ + { 0x0201, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* CurrentWeeklySchedule */ \ + { 0x0201, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* SetWeeklySchedule */ \ + { 0x0201, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* RelayStatusLog */ \ + { 0x0201, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* GetWeeklySchedule */ \ + { 0x0201, 0x03, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* ClearWeeklySchedule */ \ + { 0x0201, 0x04, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* GetRelayStatusLog */ \ + \ /* Endpoint: 1, Cluster: Color Control (client) */ \ { 0x0300, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) | ZAP_COMMAND_MASK(OUTGOING_CLIENT) }, /* MoveToHue */ \ { 0x0300, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) | ZAP_COMMAND_MASK(OUTGOING_CLIENT) }, /* MoveHue */ \ diff --git a/src/controller/python/gen/gen_config.h b/src/controller/python/gen/gen_config.h index ce2caadbe4dae3..af1df0a644ab1d 100644 --- a/src/controller/python/gen/gen_config.h +++ b/src/controller/python/gen/gen_config.h @@ -34,16 +34,23 @@ #define EMBER_AF_BASIC_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_BINDING_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_COLOR_CONTROL_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_DESCRIPTOR_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_DOOR_LOCK_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_GENERAL_COMMISSIONING_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_GROUP_KEY_MANAGEMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_GROUPS_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_IDENTIFY_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_LEVEL_CONTROL_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_LOW_POWER_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_NETWORK_COMMISSIONING_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_ON_OFF_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_OPERATIONAL_CREDENTIALS_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_PUMP_CONFIG_CONTROL_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_SCENES_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_SWITCH_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_TEMP_MEASUREMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_THERMOSTAT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_WINDOW_COVERING_CLUSTER_CLIENT_ENDPOINT_COUNT (1) /**** Cluster Plugins ****/ @@ -67,6 +74,10 @@ #define ZCL_USING_COLOR_CONTROL_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_COLOR_CONTROL_CLIENT +// Use this macro to check if the client side of the Descriptor cluster is included +#define ZCL_USING_DESCRIPTOR_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_DESCRIPTOR_CLIENT + // Use this macro to check if the client side of the Door Lock cluster is included #define ZCL_USING_DOOR_LOCK_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_DOOR_LOCK_CLIENT @@ -75,6 +86,10 @@ #define ZCL_USING_GENERAL_COMMISSIONING_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_GENERAL_COMMISSIONING_CLIENT +// Use this macro to check if the client side of the Group Key Management cluster is included +#define ZCL_USING_GROUP_KEY_MANAGEMENT_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_GROUP_KEY_MANAGEMENT_CLIENT + // Use this macro to check if the client side of the Groups cluster is included #define ZCL_USING_GROUPS_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_GROUPS_CLIENT @@ -99,10 +114,30 @@ #define ZCL_USING_ON_OFF_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_ON_OFF_CLIENT +// Use this macro to check if the client side of the Operational Credentials cluster is included +#define ZCL_USING_OPERATIONAL_CREDENTIALS_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_OPERATIONAL_CREDENTIALS_CLIENT + +// Use this macro to check if the client side of the Pump Configuration and Control cluster is included +#define ZCL_USING_PUMP_CONFIG_CONTROL_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_PUMP_CONFIGURATION_AND_CONTROL_CLIENT + // Use this macro to check if the client side of the Scenes cluster is included #define ZCL_USING_SCENES_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_SCENES_CLIENT +// Use this macro to check if the client side of the Switch cluster is included +#define ZCL_USING_SWITCH_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_SWITCH_CLIENT + // Use this macro to check if the client side of the Temperature Measurement cluster is included #define ZCL_USING_TEMP_MEASUREMENT_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_TEMPERATURE_MEASUREMENT_CLIENT + +// Use this macro to check if the client side of the Thermostat cluster is included +#define ZCL_USING_THERMOSTAT_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_THERMOSTAT_CLIENT + +// Use this macro to check if the client side of the Window Covering cluster is included +#define ZCL_USING_WINDOW_COVERING_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_WINDOW_COVERING_CLIENT diff --git a/src/controller/python/gen/print-cluster.h b/src/controller/python/gen/print-cluster.h index 68d3e99e109b2b..9c879d94a9390d 100644 --- a/src/controller/python/gen/print-cluster.h +++ b/src/controller/python/gen/print-cluster.h @@ -180,6 +180,12 @@ #define CHIP_PRINTCLUSTER_NETWORK_COMMISSIONING_CLUSTER #endif +#if defined(ZCL_USING_SWITCH_CLUSTER_SERVER) || defined(ZCL_USING_SWITCH_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_SWITCH_CLUSTER { ZCL_SWITCH_CLUSTER_ID, 59, "Switch" }, +#else +#define CHIP_PRINTCLUSTER_SWITCH_CLUSTER +#endif + #if defined(ZCL_USING_OPERATIONAL_CREDENTIALS_CLUSTER_SERVER) || defined(ZCL_USING_OPERATIONAL_CREDENTIALS_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_OPERATIONAL_CREDENTIALS_CLUSTER { ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID, 62, "Operational Credentials" }, #else @@ -894,6 +900,7 @@ CHIP_PRINTCLUSTER_OTA_CLIENT_CLUSTER \ CHIP_PRINTCLUSTER_GENERAL_COMMISSIONING_CLUSTER \ CHIP_PRINTCLUSTER_NETWORK_COMMISSIONING_CLUSTER \ + CHIP_PRINTCLUSTER_SWITCH_CLUSTER \ CHIP_PRINTCLUSTER_OPERATIONAL_CREDENTIALS_CLUSTER \ CHIP_PRINTCLUSTER_SHADE_CONFIG_CLUSTER \ CHIP_PRINTCLUSTER_DOOR_LOCK_CLUSTER \ diff --git a/src/controller/python/local-clusters.zap b/src/controller/python/local-clusters.zap index d5a85e80940e73..c87f4d5e1a6f5d 100644 --- a/src/controller/python/local-clusters.zap +++ b/src/controller/python/local-clusters.zap @@ -1,5 +1,5 @@ { - "featureLevel": 26, + "featureLevel": 29, "creator": "zap", "keyValuePairs": [ { @@ -735,6 +735,118 @@ } ] }, + { + "name": "Descriptor", + "code": 29, + "mfgCode": null, + "define": "DESCRIPTOR_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Descriptor", + "code": 29, + "mfgCode": null, + "define": "DESCRIPTOR_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "device list", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "server list", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "client list", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "parts list", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, { "name": "Basic", "code": 40, @@ -1085,7 +1197,7 @@ "enabled": 1, "commands": [ { - "name": "SetFabric", + "name": "ArmFailSafe", "code": 0, "mfgCode": null, "source": "client", @@ -1093,7 +1205,7 @@ "outgoing": 1 }, { - "name": "ArmFailSafe", + "name": "SetRegulatoryConfig", "code": 2, "mfgCode": null, "source": "client", @@ -1102,10 +1214,10 @@ }, { "name": "CommissioningComplete", - "code": 6, + "code": 4, "mfgCode": null, "source": "client", - "incoming": 1, + "incoming": 0, "outgoing": 1 } ], @@ -1136,7 +1248,7 @@ "enabled": 0, "commands": [ { - "name": "SetFabricResponse", + "name": "ArmFailSafeResponse", "code": 1, "mfgCode": null, "source": "server", @@ -1144,7 +1256,7 @@ "outgoing": 1 }, { - "name": "ArmFailSafeResponse", + "name": "SetRegulatoryConfigResponse", "code": 3, "mfgCode": null, "source": "server", @@ -1153,11 +1265,11 @@ }, { "name": "CommissioningCompleteResponse", - "code": 7, + "code": 5, "mfgCode": null, "source": "server", "incoming": 1, - "outgoing": 1 + "outgoing": 0 } ], "attributes": [ @@ -1399,93 +1511,291 @@ ] }, { - "name": "Door Lock", - "code": 257, + "name": "Switch", + "code": 59, "mfgCode": null, - "define": "DOOR_LOCK_CLUSTER", + "define": "SWITCH_CLUSTER", "side": "client", "enabled": 1, - "commands": [ - { - "name": "LockDoor", - "code": 0, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, + "commands": [], + "attributes": [ { - "name": "UnlockDoor", - "code": 1, + "name": "cluster revision", + "code": 65533, "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Switch", + "code": 59, + "mfgCode": null, + "define": "SWITCH_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ { - "name": "UnlockWithTimeout", - "code": 3, + "name": "number of positions", + "code": 0, "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 }, { - "name": "GetLogRecord", - "code": 4, + "name": "current position", + "code": 1, "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 }, { - "name": "SetPin", - "code": 5, + "name": "multi press max", + "code": 2, "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 }, { - "name": "GetPin", - "code": 6, + "name": "cluster revision", + "code": 65533, "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Operational Credentials", + "code": 62, + "mfgCode": null, + "define": "OPERATIONAL_CREDENTIALS_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [ { - "name": "ClearPin", - "code": 7, + "name": "GetFabricId", + "code": 0, "mfgCode": null, "source": "client", - "incoming": 1, + "incoming": 0, "outgoing": 1 }, { - "name": "ClearAllPins", - "code": 8, + "name": "UpdateFabricLabel", + "code": 9, "mfgCode": null, "source": "client", - "incoming": 1, + "incoming": 0, "outgoing": 1 }, { - "name": "SetWeekdaySchedule", - "code": 11, + "name": "RemoveFabric", + "code": 10, "mfgCode": null, "source": "client", - "incoming": 1, + "incoming": 0, "outgoing": 1 - }, + } + ], + "attributes": [ { - "name": "GetWeekdaySchedule", - "code": 12, + "name": "cluster revision", + "code": 65533, "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Operational Credentials", + "code": 62, + "mfgCode": null, + "define": "OPERATIONAL_CREDENTIALS_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [ + { + "name": "GetFabricIdResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 0 + } + ], + "attributes": [ + { + "name": "fabrics list", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Door Lock", + "code": 257, + "mfgCode": null, + "define": "DOOR_LOCK_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [ + { + "name": "LockDoor", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "UnlockDoor", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "UnlockWithTimeout", + "code": 3, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "GetLogRecord", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "SetPin", + "code": 5, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "GetPin", + "code": 6, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "ClearPin", + "code": 7, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "ClearAllPins", + "code": 8, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "SetWeekdaySchedule", + "code": 11, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "GetWeekdaySchedule", + "code": 12, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, { "name": "ClearWeekdaySchedule", "code": 13, @@ -2124,117 +2434,662 @@ "code": 64, "mfgCode": null, "side": "server", - "included": 0, + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "keypad operation event mask", + "code": 65, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RF operation event mask", + "code": 66, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "manual operation event mask", + "code": 67, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "rfid operation event mask", + "code": 68, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "keypad programming event mask", + "code": 69, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "rf programming event mask", + "code": 70, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "rfid programming event mask", + "code": 71, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Window Covering", + "code": 258, + "mfgCode": null, + "define": "WINDOW_COVERING_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [ + { + "name": "WindowCoveringUpOpen", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "WindowCoveringDownClose", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "WindowCoveringStop", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "WindowCoveringGoToLiftValue", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "WindowCoveringGoToLiftPercentage", + "code": 5, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "WindowCoveringGoToTiltValue", + "code": 7, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "WindowCoveringGoToTiltPercentage", + "code": 8, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Window Covering", + "code": 258, + "mfgCode": null, + "define": "WINDOW_COVERING_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "window covering type", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "current position - lift", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "current position - tilt", + "code": 4, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "config status", + "code": 7, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x03", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "installed open limit - lift", + "code": 16, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "installed closed limit - lift", + "code": 17, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0xFFFF", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "installed open limit - tilt", + "code": 18, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "installed closed limit - tilt", + "code": 19, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0xFFFF", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "mode", + "code": 23, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x14", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Barrier Control", + "code": 259, + "mfgCode": null, + "define": "BARRIER_CONTROL_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [ + { + "name": "BarrierControlGoToPercent", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "BarrierControlStop", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Barrier Control", + "code": 259, + "mfgCode": null, + "define": "BARRIER_CONTROL_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "barrier moving state", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "barrier safety status", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "barrier capabilities", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "barrier position", + "code": 10, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Pump Configuration and Control", + "code": 512, + "mfgCode": null, + "define": "PUMP_CONFIG_CONTROL_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Pump Configuration and Control", + "code": 512, + "mfgCode": null, + "define": "PUMP_CONFIG_CONTROL_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "max pressure", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, + "defaultValue": "", + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "keypad operation event mask", - "code": 65, + "name": "max speed", + "code": 1, "mfgCode": null, "side": "server", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, + "defaultValue": "", + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "RF operation event mask", - "code": 66, + "name": "max flow", + "code": 2, "mfgCode": null, "side": "server", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, + "defaultValue": "", + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "manual operation event mask", - "code": 67, + "name": "pump status", + "code": 16, "mfgCode": null, "side": "server", "included": 0, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0000", + "defaultValue": "", "reportable": 1, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "rfid operation event mask", - "code": 68, + "name": "effective operation mode", + "code": 17, "mfgCode": null, "side": "server", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, + "defaultValue": "", + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "keypad programming event mask", - "code": 69, + "name": "effective control mode", + "code": 18, "mfgCode": null, "side": "server", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, + "defaultValue": "", + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "rf programming event mask", - "code": 70, + "name": "capacity", + "code": 19, "mfgCode": null, "side": "server", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0000", + "defaultValue": "", "reportable": 1, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "rfid programming event mask", - "code": 71, + "name": "operation mode", + "code": 32, "mfgCode": null, "side": "server", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, + "defaultValue": "0x00", + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -2248,7 +3103,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "0x0001", "reportable": 0, "minInterval": 0, "maxInterval": 65344, @@ -2257,27 +3112,51 @@ ] }, { - "name": "Barrier Control", - "code": 259, + "name": "Thermostat", + "code": 513, "mfgCode": null, - "define": "BARRIER_CONTROL_CLUSTER", + "define": "THERMOSTAT_CLUSTER", "side": "client", "enabled": 1, "commands": [ { - "name": "BarrierControlGoToPercent", + "name": "SetpointRaiseLower", "code": 0, "mfgCode": null, "source": "client", - "incoming": 1, + "incoming": 0, "outgoing": 1 }, { - "name": "BarrierControlStop", + "name": "SetWeeklySchedule", "code": 1, "mfgCode": null, "source": "client", - "incoming": 1, + "incoming": 0, + "outgoing": 1 + }, + { + "name": "GetWeeklySchedule", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "ClearWeeklySchedule", + "code": 3, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "GetRelayStatusLog", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 0, "outgoing": 1 } ], @@ -2291,7 +3170,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "3", "reportable": 0, "minInterval": 0, "maxInterval": 65344, @@ -2300,69 +3179,131 @@ ] }, { - "name": "Barrier Control", - "code": 259, + "name": "Thermostat", + "code": 513, "mfgCode": null, - "define": "BARRIER_CONTROL_CLUSTER", + "define": "THERMOSTAT_CLUSTER", "side": "server", "enabled": 0, - "commands": [], - "attributes": [ + "commands": [ { - "name": "barrier moving state", + "name": "CurrentWeeklySchedule", + "code": 0, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 0 + }, + { + "name": "RelayStatusLog", "code": 1, "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 0 + } + ], + "attributes": [ + { + "name": "local temperature", + "code": 0, + "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "pi cooling demand", + "code": 7, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "pi heating demand", + "code": 8, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "occupied cooling setpoint", + "code": 17, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0A28", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "barrier safety status", - "code": 2, + "name": "occupied heating setpoint", + "code": 18, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0x07D0", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "barrier capabilities", - "code": 3, + "name": "control sequence of operation", + "code": 27, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0x04", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "barrier position", - "code": 10, + "name": "system mode", + "code": 28, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0x01", "reportable": 0, "minInterval": 0, "maxInterval": 65344, @@ -2377,7 +3318,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "3", "reportable": 0, "minInterval": 0, "maxInterval": 65344, @@ -3426,7 +4367,7 @@ "mfgCode": null, "source": "client", "incoming": 1, - "outgoing": 1 + "outgoing": 0 } ], "attributes": [ @@ -3460,7 +4401,7 @@ "code": 0, "mfgCode": null, "source": "server", - "incoming": 1, + "incoming": 0, "outgoing": 1 }, { @@ -3468,7 +4409,7 @@ "code": 1, "mfgCode": null, "source": "server", - "incoming": 1, + "incoming": 0, "outgoing": 1 } ], @@ -3851,6 +4792,88 @@ "reportableChange": 0 } ] + }, + { + "name": "Group Key Management", + "code": 61444, + "mfgCode": null, + "define": "GROUP_KEY_MANAGEMENT_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Group Key Management", + "code": 61444, + "mfgCode": null, + "define": "GROUP_KEY_MANAGEMENT_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "groups", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "group keys", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] } ] } @@ -3861,7 +4884,9 @@ "endpointTypeIndex": 0, "profileId": "0x0103", "endpointId": 1, - "networkId": 0 + "networkId": 0, + "endpointVersion": null, + "deviceIdentifier": null } ], "log": [] diff --git a/src/darwin/Framework/CHIP/chip-tool.zap b/src/darwin/Framework/CHIP/chip-tool.zap index 22f563c9519c98..81a5a29338aeae 100644 --- a/src/darwin/Framework/CHIP/chip-tool.zap +++ b/src/darwin/Framework/CHIP/chip-tool.zap @@ -18,13 +18,13 @@ "package": [ { "pathRelativity": "relativeToZap", - "path": "../../../app/zap-templates/zcl/zcl.json", + "path": "../../src/app/zap-templates/zcl/zcl.json", "version": "ZCL Test Data", "type": "zcl-properties" }, { "pathRelativity": "relativeToZap", - "path": "../../../app/zap-templates/app-templates.json", + "path": "../../src/app/zap-templates/app-templates.json", "version": "chip-v1", "type": "gen-templates-json" } @@ -1197,7 +1197,7 @@ "enabled": 1, "commands": [ { - "name": "SetFabric", + "name": "ArmFailSafe", "code": 0, "mfgCode": null, "source": "client", @@ -1205,7 +1205,7 @@ "outgoing": 1 }, { - "name": "ArmFailSafe", + "name": "SetRegulatoryConfig", "code": 2, "mfgCode": null, "source": "client", @@ -1214,10 +1214,10 @@ }, { "name": "CommissioningComplete", - "code": 6, + "code": 4, "mfgCode": null, "source": "client", - "incoming": 1, + "incoming": 0, "outgoing": 1 } ], @@ -1248,7 +1248,7 @@ "enabled": 0, "commands": [ { - "name": "SetFabricResponse", + "name": "ArmFailSafeResponse", "code": 1, "mfgCode": null, "source": "server", @@ -1256,7 +1256,7 @@ "outgoing": 1 }, { - "name": "ArmFailSafeResponse", + "name": "SetRegulatoryConfigResponse", "code": 3, "mfgCode": null, "source": "server", @@ -1265,11 +1265,11 @@ }, { "name": "CommissioningCompleteResponse", - "code": 7, + "code": 5, "mfgCode": null, "source": "server", "incoming": 1, - "outgoing": 1 + "outgoing": 0 } ], "attributes": [ @@ -1510,6 +1510,103 @@ } ] }, + { + "name": "Switch", + "code": 59, + "mfgCode": null, + "define": "SWITCH_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Switch", + "code": 59, + "mfgCode": null, + "define": "SWITCH_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "number of positions", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "current position", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "multi press max", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, { "name": "Operational Credentials", "code": 62, @@ -2598,6 +2695,393 @@ } ] }, + { + "name": "Pump Configuration and Control", + "code": 512, + "mfgCode": null, + "define": "PUMP_CONFIG_CONTROL_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Pump Configuration and Control", + "code": 512, + "mfgCode": null, + "define": "PUMP_CONFIG_CONTROL_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "max pressure", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "max speed", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "max flow", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "pump status", + "code": 16, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "effective operation mode", + "code": 17, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "effective control mode", + "code": 18, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "capacity", + "code": 19, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "operation mode", + "code": 32, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Thermostat", + "code": 513, + "mfgCode": null, + "define": "THERMOSTAT_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [ + { + "name": "SetpointRaiseLower", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "SetWeeklySchedule", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "GetWeeklySchedule", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "ClearWeeklySchedule", + "code": 3, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "GetRelayStatusLog", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Thermostat", + "code": 513, + "mfgCode": null, + "define": "THERMOSTAT_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [ + { + "name": "CurrentWeeklySchedule", + "code": 0, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 0 + }, + { + "name": "RelayStatusLog", + "code": 1, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 0 + } + ], + "attributes": [ + { + "name": "local temperature", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "pi cooling demand", + "code": 7, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "pi heating demand", + "code": 8, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "occupied cooling setpoint", + "code": 17, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0A28", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "occupied heating setpoint", + "code": 18, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x07D0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "control sequence of operation", + "code": 27, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x04", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "system mode", + "code": 28, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x01", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, { "name": "Color Control", "code": 768, diff --git a/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.cpp b/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.cpp index 551438a621bb07..005ec626c44adf 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.cpp +++ b/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.cpp @@ -1372,6 +1372,21 @@ bool emberAfGeneralCommissioningClusterArmFailSafeResponseCallback(chip::app::Co return true; } +bool emberAfGeneralCommissioningClusterCommissioningCompleteResponseCallback(chip::app::Command * commandObj, uint8_t errorCode, + uint8_t * debugText) +{ + ChipLogProgress(Zcl, "CommissioningCompleteResponse:"); + ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); + ChipLogProgress(Zcl, " debugText: %s", debugText); + + GET_RESPONSE_CALLBACKS("GeneralCommissioningClusterCommissioningCompleteResponseCallback"); + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, errorCode, debugText); + return true; +} + bool emberAfGeneralCommissioningClusterSetRegulatoryConfigResponseCallback(chip::app::Command * commandObj, uint8_t errorCode, uint8_t * debugText) { diff --git a/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.h b/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.h index da7d9e35529233..8bb5691a5e5d10 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.h +++ b/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.h @@ -72,6 +72,8 @@ typedef void (*DoorLockClusterSetYeardayScheduleResponseCallback)(void * context typedef void (*DoorLockClusterUnlockDoorResponseCallback)(void * context); typedef void (*DoorLockClusterUnlockWithTimeoutResponseCallback)(void * context); typedef void (*GeneralCommissioningClusterArmFailSafeResponseCallback)(void * context, uint8_t errorCode, uint8_t * debugText); +typedef void (*GeneralCommissioningClusterCommissioningCompleteResponseCallback)(void * context, uint8_t errorCode, + uint8_t * debugText); typedef void (*GeneralCommissioningClusterSetRegulatoryConfigResponseCallback)(void * context, uint8_t errorCode, uint8_t * debugText); typedef void (*GroupsClusterAddGroupResponseCallback)(void * context, uint16_t groupId); diff --git a/src/darwin/Framework/CHIP/gen/CHIPClusters.cpp b/src/darwin/Framework/CHIP/gen/CHIPClusters.cpp index a8e94932ce7bc8..a5db71393871a4 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClusters.cpp +++ b/src/darwin/Framework/CHIP/gen/CHIPClusters.cpp @@ -2488,6 +2488,32 @@ CHIP_ERROR GeneralCommissioningCluster::ArmFailSafe(Callback::Cancelable * onSuc #endif } +CHIP_ERROR GeneralCommissioningCluster::CommissioningComplete(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kCommissioningCompleteCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + // Command takes no arguments. + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeGeneralCommissioningClusterCommissioningCompleteCommand(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + CHIP_ERROR GeneralCommissioningCluster::SetRegulatoryConfig(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t location, chip::ByteSpan countryCode, uint64_t breadcrumb, uint32_t timeoutMs) @@ -3793,6 +3819,108 @@ CHIP_ERROR OperationalCredentialsCluster::ReadAttributeClusterRevision(Callback: return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); } +// PumpConfigurationAndControl Cluster Commands +// PumpConfigurationAndControl Cluster Attributes +CHIP_ERROR PumpConfigurationAndControlCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodePumpConfigurationAndControlClusterDiscoverAttributes(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} +CHIP_ERROR PumpConfigurationAndControlCluster::ReadAttributeMaxPressure(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodePumpConfigurationAndControlClusterReadMaxPressureAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR PumpConfigurationAndControlCluster::ReadAttributeMaxSpeed(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodePumpConfigurationAndControlClusterReadMaxSpeedAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR PumpConfigurationAndControlCluster::ReadAttributeMaxFlow(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodePumpConfigurationAndControlClusterReadMaxFlowAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR PumpConfigurationAndControlCluster::ReadAttributeEffectiveOperationMode(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodePumpConfigurationAndControlClusterReadEffectiveOperationModeAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR PumpConfigurationAndControlCluster::ReadAttributeEffectiveControlMode(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodePumpConfigurationAndControlClusterReadEffectiveControlModeAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR PumpConfigurationAndControlCluster::ReadAttributeCapacity(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodePumpConfigurationAndControlClusterReadCapacityAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR PumpConfigurationAndControlCluster::ConfigureAttributeCapacity(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, + uint16_t minInterval, uint16_t maxInterval, + int16_t change) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodePumpConfigurationAndControlClusterConfigureCapacityAttribute(seqNum, mEndpoint, minInterval, maxInterval, change); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR PumpConfigurationAndControlCluster::ReportAttributeCapacity(Callback::Cancelable * onReportCallback) +{ + return RequestAttributeReporting(0x0013, onReportCallback); +} + +CHIP_ERROR PumpConfigurationAndControlCluster::ReadAttributeOperationMode(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodePumpConfigurationAndControlClusterReadOperationModeAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR PumpConfigurationAndControlCluster::WriteAttributeOperationMode(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint8_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodePumpConfigurationAndControlClusterWriteOperationModeAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR PumpConfigurationAndControlCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodePumpConfigurationAndControlClusterReadClusterRevisionAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + // Scenes Cluster Commands CHIP_ERROR ScenesCluster::AddScene(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t groupId, uint8_t sceneId, uint16_t transitionTime, chip::ByteSpan sceneName, @@ -4077,6 +4205,53 @@ CHIP_ERROR ScenesCluster::ReadAttributeClusterRevision(Callback::Cancelable * on return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); } +// Switch Cluster Commands +// Switch Cluster Attributes +CHIP_ERROR SwitchCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeSwitchClusterDiscoverAttributes(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} +CHIP_ERROR SwitchCluster::ReadAttributeNumberOfPositions(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeSwitchClusterReadNumberOfPositionsAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR SwitchCluster::ReadAttributeCurrentPosition(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeSwitchClusterReadCurrentPositionAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR SwitchCluster::ConfigureAttributeCurrentPosition(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t minInterval, + uint16_t maxInterval, uint8_t change) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodeSwitchClusterConfigureCurrentPositionAttribute(seqNum, mEndpoint, minInterval, maxInterval, change); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR SwitchCluster::ReportAttributeCurrentPosition(Callback::Cancelable * onReportCallback) +{ + return RequestAttributeReporting(0x0001, onReportCallback); +} + +CHIP_ERROR SwitchCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeSwitchClusterReadClusterRevisionAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + // TemperatureMeasurement Cluster Commands // TemperatureMeasurement Cluster Attributes CHIP_ERROR TemperatureMeasurementCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback, @@ -4134,5 +4309,262 @@ CHIP_ERROR TemperatureMeasurementCluster::ReadAttributeClusterRevision(Callback: return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); } +// Thermostat Cluster Commands +CHIP_ERROR ThermostatCluster::ClearWeeklySchedule(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kClearWeeklyScheduleCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + // Command takes no arguments. + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeThermostatClusterClearWeeklyScheduleCommand(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + +CHIP_ERROR ThermostatCluster::GetRelayStatusLog(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kGetRelayStatusLogCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + // Command takes no arguments. + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeThermostatClusterGetRelayStatusLogCommand(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + +CHIP_ERROR ThermostatCluster::GetWeeklySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t daysToReturn, uint8_t modeToReturn) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kGetWeeklyScheduleCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + TLV::TLVWriter * writer = ZCLcommand->GetCommandDataElementTLVWriter(); + uint8_t argSeqNumber = 0; + // daysToReturn: dayOfWeek + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), daysToReturn)); + // modeToReturn: modeForSequence + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), modeToReturn)); + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodeThermostatClusterGetWeeklyScheduleCommand(seqNum, mEndpoint, daysToReturn, modeToReturn); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + +CHIP_ERROR ThermostatCluster::SetWeeklySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t numberOfTransitionsForSequence, uint8_t dayOfWeekForSequence, + uint8_t modeForSequence, uint8_t payload) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kSetWeeklyScheduleCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + TLV::TLVWriter * writer = ZCLcommand->GetCommandDataElementTLVWriter(); + uint8_t argSeqNumber = 0; + // numberOfTransitionsForSequence: enum8 + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), numberOfTransitionsForSequence)); + // dayOfWeekForSequence: dayOfWeek + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), dayOfWeekForSequence)); + // modeForSequence: modeForSequence + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), modeForSequence)); + // payload: int8u + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), payload)); + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeThermostatClusterSetWeeklyScheduleCommand( + seqNum, mEndpoint, numberOfTransitionsForSequence, dayOfWeekForSequence, modeForSequence, payload); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + +CHIP_ERROR ThermostatCluster::SetpointRaiseLower(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t mode, int8_t amount) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kSetpointRaiseLowerCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + TLV::TLVWriter * writer = ZCLcommand->GetCommandDataElementTLVWriter(); + uint8_t argSeqNumber = 0; + // mode: setpointAdjustMode + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), mode)); + // amount: int8s + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), amount)); + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeThermostatClusterSetpointRaiseLowerCommand(seqNum, mEndpoint, mode, amount); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + +// Thermostat Cluster Attributes +CHIP_ERROR ThermostatCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeThermostatClusterDiscoverAttributes(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} +CHIP_ERROR ThermostatCluster::ReadAttributeLocalTemperature(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeThermostatClusterReadLocalTemperatureAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR ThermostatCluster::ConfigureAttributeLocalTemperature(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t minInterval, + uint16_t maxInterval, int16_t change) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodeThermostatClusterConfigureLocalTemperatureAttribute(seqNum, mEndpoint, minInterval, maxInterval, change); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR ThermostatCluster::ReportAttributeLocalTemperature(Callback::Cancelable * onReportCallback) +{ + return RequestAttributeReporting(0x0000, onReportCallback); +} + +CHIP_ERROR ThermostatCluster::ReadAttributeOccupiedCoolingSetpoint(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeThermostatClusterReadOccupiedCoolingSetpointAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR ThermostatCluster::WriteAttributeOccupiedCoolingSetpoint(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, int16_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodeThermostatClusterWriteOccupiedCoolingSetpointAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR ThermostatCluster::ReadAttributeOccupiedHeatingSetpoint(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeThermostatClusterReadOccupiedHeatingSetpointAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR ThermostatCluster::WriteAttributeOccupiedHeatingSetpoint(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, int16_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodeThermostatClusterWriteOccupiedHeatingSetpointAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR ThermostatCluster::ReadAttributeControlSequenceOfOperation(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeThermostatClusterReadControlSequenceOfOperationAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR ThermostatCluster::WriteAttributeControlSequenceOfOperation(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint8_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodeThermostatClusterWriteControlSequenceOfOperationAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR ThermostatCluster::ReadAttributeSystemMode(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeThermostatClusterReadSystemModeAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR ThermostatCluster::WriteAttributeSystemMode(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint8_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeThermostatClusterWriteSystemModeAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR ThermostatCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeThermostatClusterReadClusterRevisionAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + } // namespace Controller } // namespace chip diff --git a/src/darwin/Framework/CHIP/gen/CHIPClusters.h b/src/darwin/Framework/CHIP/gen/CHIPClusters.h index a578c9408d8236..751c92ab71403b 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClusters.h +++ b/src/darwin/Framework/CHIP/gen/CHIPClusters.h @@ -27,24 +27,27 @@ namespace chip { namespace Controller { -constexpr ClusterId kApplicationBasicClusterId = 0x050D; -constexpr ClusterId kBarrierControlClusterId = 0x0103; -constexpr ClusterId kBasicClusterId = 0x0028; -constexpr ClusterId kBindingClusterId = 0xF000; -constexpr ClusterId kColorControlClusterId = 0x0300; -constexpr ClusterId kDescriptorClusterId = 0x001D; -constexpr ClusterId kDoorLockClusterId = 0x0101; -constexpr ClusterId kGeneralCommissioningClusterId = 0x0030; -constexpr ClusterId kGroupKeyManagementClusterId = 0xF004; -constexpr ClusterId kGroupsClusterId = 0x0004; -constexpr ClusterId kIdentifyClusterId = 0x0003; -constexpr ClusterId kLevelControlClusterId = 0x0008; -constexpr ClusterId kLowPowerClusterId = 0x0508; -constexpr ClusterId kNetworkCommissioningClusterId = 0x0031; -constexpr ClusterId kOnOffClusterId = 0x0006; -constexpr ClusterId kOperationalCredentialsClusterId = 0x003E; -constexpr ClusterId kScenesClusterId = 0x0005; -constexpr ClusterId kTemperatureMeasurementClusterId = 0x0402; +constexpr ClusterId kApplicationBasicClusterId = 0x050D; +constexpr ClusterId kBarrierControlClusterId = 0x0103; +constexpr ClusterId kBasicClusterId = 0x0028; +constexpr ClusterId kBindingClusterId = 0xF000; +constexpr ClusterId kColorControlClusterId = 0x0300; +constexpr ClusterId kDescriptorClusterId = 0x001D; +constexpr ClusterId kDoorLockClusterId = 0x0101; +constexpr ClusterId kGeneralCommissioningClusterId = 0x0030; +constexpr ClusterId kGroupKeyManagementClusterId = 0xF004; +constexpr ClusterId kGroupsClusterId = 0x0004; +constexpr ClusterId kIdentifyClusterId = 0x0003; +constexpr ClusterId kLevelControlClusterId = 0x0008; +constexpr ClusterId kLowPowerClusterId = 0x0508; +constexpr ClusterId kNetworkCommissioningClusterId = 0x0031; +constexpr ClusterId kOnOffClusterId = 0x0006; +constexpr ClusterId kOperationalCredentialsClusterId = 0x003E; +constexpr ClusterId kPumpConfigurationAndControlClusterId = 0x0200; +constexpr ClusterId kScenesClusterId = 0x0005; +constexpr ClusterId kSwitchClusterId = 0x003B; +constexpr ClusterId kTemperatureMeasurementClusterId = 0x0402; +constexpr ClusterId kThermostatClusterId = 0x0201; class DLL_EXPORT ApplicationBasicCluster : public ClusterBase { @@ -419,6 +422,7 @@ class DLL_EXPORT GeneralCommissioningCluster : public ClusterBase // Cluster Commands CHIP_ERROR ArmFailSafe(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t expiryLengthSeconds, uint64_t breadcrumb, uint32_t timeoutMs); + CHIP_ERROR CommissioningComplete(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); CHIP_ERROR SetRegulatoryConfig(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t location, chip::ByteSpan countryCode, uint64_t breadcrumb, uint32_t timeoutMs); @@ -431,8 +435,9 @@ class DLL_EXPORT GeneralCommissioningCluster : public ClusterBase uint64_t value); private: - static constexpr CommandId kArmFailSafeCommandId = 0x00; - static constexpr CommandId kSetRegulatoryConfigCommandId = 0x02; + static constexpr CommandId kArmFailSafeCommandId = 0x00; + static constexpr CommandId kCommissioningCompleteCommandId = 0x04; + static constexpr CommandId kSetRegulatoryConfigCommandId = 0x02; }; class DLL_EXPORT GroupKeyManagementCluster : public ClusterBase @@ -651,6 +656,31 @@ class DLL_EXPORT OperationalCredentialsCluster : public ClusterBase static constexpr CommandId kUpdateFabricLabelCommandId = 0x09; }; +class DLL_EXPORT PumpConfigurationAndControlCluster : public ClusterBase +{ +public: + PumpConfigurationAndControlCluster() : ClusterBase(kPumpConfigurationAndControlClusterId) {} + ~PumpConfigurationAndControlCluster() {} + + // Cluster Attributes + CHIP_ERROR DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeMaxPressure(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeMaxSpeed(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeMaxFlow(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeEffectiveOperationMode(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeEffectiveControlMode(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeCapacity(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeOperationMode(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR WriteAttributeOperationMode(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t value); + CHIP_ERROR ConfigureAttributeCapacity(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t minInterval, uint16_t maxInterval, int16_t change); + CHIP_ERROR ReportAttributeCapacity(Callback::Cancelable * onReportCallback); +}; + class DLL_EXPORT ScenesCluster : public ClusterBase { public: @@ -693,6 +723,22 @@ class DLL_EXPORT ScenesCluster : public ClusterBase static constexpr CommandId kViewSceneCommandId = 0x01; }; +class DLL_EXPORT SwitchCluster : public ClusterBase +{ +public: + SwitchCluster() : ClusterBase(kSwitchClusterId) {} + ~SwitchCluster() {} + + // Cluster Attributes + CHIP_ERROR DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeNumberOfPositions(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeCurrentPosition(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ConfigureAttributeCurrentPosition(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t minInterval, uint16_t maxInterval, uint8_t change); + CHIP_ERROR ReportAttributeCurrentPosition(Callback::Cancelable * onReportCallback); +}; + class DLL_EXPORT TemperatureMeasurementCluster : public ClusterBase { public: @@ -710,5 +756,54 @@ class DLL_EXPORT TemperatureMeasurementCluster : public ClusterBase CHIP_ERROR ReportAttributeMeasuredValue(Callback::Cancelable * onReportCallback); }; +class DLL_EXPORT ThermostatCluster : public ClusterBase +{ +public: + ThermostatCluster() : ClusterBase(kThermostatClusterId) {} + ~ThermostatCluster() {} + + // Cluster Commands + CHIP_ERROR ClearWeeklySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR GetRelayStatusLog(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR GetWeeklySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t daysToReturn, uint8_t modeToReturn); + CHIP_ERROR SetWeeklySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t numberOfTransitionsForSequence, uint8_t dayOfWeekForSequence, uint8_t modeForSequence, + uint8_t payload); + CHIP_ERROR SetpointRaiseLower(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t mode, + int8_t amount); + + // Cluster Attributes + CHIP_ERROR DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeLocalTemperature(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeOccupiedCoolingSetpoint(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeOccupiedHeatingSetpoint(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeControlSequenceOfOperation(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeSystemMode(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR WriteAttributeOccupiedCoolingSetpoint(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, int16_t value); + CHIP_ERROR WriteAttributeOccupiedHeatingSetpoint(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, int16_t value); + CHIP_ERROR WriteAttributeControlSequenceOfOperation(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint8_t value); + CHIP_ERROR WriteAttributeSystemMode(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t value); + CHIP_ERROR ConfigureAttributeLocalTemperature(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t minInterval, + uint16_t maxInterval, int16_t change); + CHIP_ERROR ReportAttributeLocalTemperature(Callback::Cancelable * onReportCallback); + +private: + static constexpr CommandId kClearWeeklyScheduleCommandId = 0x03; + static constexpr CommandId kGetRelayStatusLogCommandId = 0x04; + static constexpr CommandId kGetWeeklyScheduleCommandId = 0x02; + static constexpr CommandId kSetWeeklyScheduleCommandId = 0x01; + static constexpr CommandId kSetpointRaiseLowerCommandId = 0x00; +}; + } // namespace Controller } // namespace chip diff --git a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h index 2cdd5d394bc4e1..c4ca0d9d92515b 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h +++ b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h @@ -395,6 +395,7 @@ NS_ASSUME_NONNULL_BEGIN breadcrumb:(uint64_t)breadcrumb timeoutMs:(uint32_t)timeoutMs completionHandler:(ResponseHandler)completionHandler; +- (void)commissioningComplete:(ResponseHandler)completionHandler; - (void)setRegulatoryConfig:(uint8_t)location countryCode:(NSString *)countryCode breadcrumb:(uint64_t)breadcrumb @@ -593,6 +594,29 @@ NS_ASSUME_NONNULL_BEGIN @end +/** + * Cluster Pump Configuration and Control + * + */ +@interface CHIPPumpConfigurationAndControl : CHIPCluster + +- (void)readAttributeMaxPressure:(ResponseHandler)completionHandler; +- (void)readAttributeMaxSpeed:(ResponseHandler)completionHandler; +- (void)readAttributeMaxFlow:(ResponseHandler)completionHandler; +- (void)readAttributeEffectiveOperationMode:(ResponseHandler)completionHandler; +- (void)readAttributeEffectiveControlMode:(ResponseHandler)completionHandler; +- (void)readAttributeCapacity:(ResponseHandler)completionHandler; +- (void)configureAttributeCapacity:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + change:(int16_t)change + completionHandler:(ResponseHandler)completionHandler; +- (void)reportAttributeCapacity:(ResponseHandler)reportHandler; +- (void)readAttributeOperationMode:(ResponseHandler)completionHandler; +- (void)writeAttributeOperationMode:(uint8_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler; + +@end + /** * Cluster Scenes * @@ -626,6 +650,23 @@ NS_ASSUME_NONNULL_BEGIN @end +/** + * Cluster Switch + * + */ +@interface CHIPSwitch : CHIPCluster + +- (void)readAttributeNumberOfPositions:(ResponseHandler)completionHandler; +- (void)readAttributeCurrentPosition:(ResponseHandler)completionHandler; +- (void)configureAttributeCurrentPosition:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + change:(uint8_t)change + completionHandler:(ResponseHandler)completionHandler; +- (void)reportAttributeCurrentPosition:(ResponseHandler)reportHandler; +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler; + +@end + /** * Cluster Temperature Measurement * @@ -644,6 +685,42 @@ NS_ASSUME_NONNULL_BEGIN @end +/** + * Cluster Thermostat + * + */ +@interface CHIPThermostat : CHIPCluster + +- (void)clearWeeklySchedule:(ResponseHandler)completionHandler; +- (void)getRelayStatusLog:(ResponseHandler)completionHandler; +- (void)getWeeklySchedule:(uint8_t)daysToReturn + modeToReturn:(uint8_t)modeToReturn + completionHandler:(ResponseHandler)completionHandler; +- (void)setWeeklySchedule:(uint8_t)numberOfTransitionsForSequence + dayOfWeekForSequence:(uint8_t)dayOfWeekForSequence + modeForSequence:(uint8_t)modeForSequence + payload:(uint8_t)payload + completionHandler:(ResponseHandler)completionHandler; +- (void)setpointRaiseLower:(uint8_t)mode amount:(int8_t)amount completionHandler:(ResponseHandler)completionHandler; + +- (void)readAttributeLocalTemperature:(ResponseHandler)completionHandler; +- (void)configureAttributeLocalTemperature:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + change:(int16_t)change + completionHandler:(ResponseHandler)completionHandler; +- (void)reportAttributeLocalTemperature:(ResponseHandler)reportHandler; +- (void)readAttributeOccupiedCoolingSetpoint:(ResponseHandler)completionHandler; +- (void)writeAttributeOccupiedCoolingSetpoint:(int16_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeOccupiedHeatingSetpoint:(ResponseHandler)completionHandler; +- (void)writeAttributeOccupiedHeatingSetpoint:(int16_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeControlSequenceOfOperation:(ResponseHandler)completionHandler; +- (void)writeAttributeControlSequenceOfOperation:(uint8_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeSystemMode:(ResponseHandler)completionHandler; +- (void)writeAttributeSystemMode:(uint8_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler; + +@end + NS_ASSUME_NONNULL_END #endif /* CHIP_CLUSTERS_H */ diff --git a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm index e154f67b15699b..0c7b0627ad31b6 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm @@ -1110,6 +1110,39 @@ static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText) dispatch_queue_t mQueue; }; +class CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallbackBridge + : public Callback::Callback { +public: + CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallbackBridge() {}; + + static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText) + { + CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { + @"errorCode" : [NSNumber numberWithUnsignedChar:errorCode], + @"debugText" : [NSString stringWithFormat:@"%s", debugText], + }); + callback->Cancel(); + delete callback; + }); + } + }; + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + class CHIPGeneralCommissioningClusterSetRegulatoryConfigResponseCallbackBridge : public Callback::Callback { public: @@ -6068,6 +6101,29 @@ - (void)armFailSafe:(uint16_t)expiryLengthSeconds completionHandler([CHIPError errorForCHIPErrorCode:err], nil); } } +- (void)commissioningComplete:(ResponseHandler)completionHandler +{ + CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallbackBridge * onSuccess + = new CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.CommissioningComplete(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} - (void)setRegulatoryConfig:(uint8_t)location countryCode:(NSString *)countryCode breadcrumb:(uint64_t)breadcrumb @@ -7543,28 +7599,20 @@ - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler @end -@interface CHIPScenes () -@property (readonly) Controller::ScenesCluster cppCluster; +@interface CHIPPumpConfigurationAndControl () +@property (readonly) Controller::PumpConfigurationAndControlCluster cppCluster; @end -@implementation CHIPScenes +@implementation CHIPPumpConfigurationAndControl - (Controller::ClusterBase *)getCluster { return &_cppCluster; } -- (void)addScene:(uint16_t)groupId - sceneId:(uint8_t)sceneId - transitionTime:(uint16_t)transitionTime - sceneName:(NSString *)sceneName - clusterId:(uint16_t)clusterId - length:(uint8_t)length - value:(uint8_t)value - completionHandler:(ResponseHandler)completionHandler +- (void)readAttributeMaxPressure:(ResponseHandler)completionHandler { - CHIPScenesClusterAddSceneResponseCallbackBridge * onSuccess - = new CHIPScenesClusterAddSceneResponseCallbackBridge(completionHandler, [self callbackQueue]); + CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -7577,20 +7625,17 @@ - (void)addScene:(uint16_t)groupId return; } - CHIP_ERROR err = self.cppCluster.AddScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId, transitionTime, - chip::ByteSpan((const uint8_t *) [sceneName dataUsingEncoding:NSUTF8StringEncoding].bytes, - [sceneName lengthOfBytesUsingEncoding:NSUTF8StringEncoding]), - clusterId, length, value); + CHIP_ERROR err = self.cppCluster.ReadAttributeMaxPressure(onSuccess->Cancel(), onFailure->Cancel()); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; completionHandler([CHIPError errorForCHIPErrorCode:err], nil); } } -- (void)getSceneMembership:(uint16_t)groupId completionHandler:(ResponseHandler)completionHandler + +- (void)readAttributeMaxSpeed:(ResponseHandler)completionHandler { - CHIPScenesClusterGetSceneMembershipResponseCallbackBridge * onSuccess - = new CHIPScenesClusterGetSceneMembershipResponseCallbackBridge(completionHandler, [self callbackQueue]); + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -7603,19 +7648,17 @@ - (void)getSceneMembership:(uint16_t)groupId completionHandler:(ResponseHandler) return; } - CHIP_ERROR err = self.cppCluster.GetSceneMembership(onSuccess->Cancel(), onFailure->Cancel(), groupId); + CHIP_ERROR err = self.cppCluster.ReadAttributeMaxSpeed(onSuccess->Cancel(), onFailure->Cancel()); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; completionHandler([CHIPError errorForCHIPErrorCode:err], nil); } } -- (void)recallScene:(uint16_t)groupId - sceneId:(uint8_t)sceneId - transitionTime:(uint16_t)transitionTime - completionHandler:(ResponseHandler)completionHandler + +- (void)readAttributeMaxFlow:(ResponseHandler)completionHandler { - CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -7628,17 +7671,17 @@ - (void)recallScene:(uint16_t)groupId return; } - CHIP_ERROR err = self.cppCluster.RecallScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId, transitionTime); + CHIP_ERROR err = self.cppCluster.ReadAttributeMaxFlow(onSuccess->Cancel(), onFailure->Cancel()); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; completionHandler([CHIPError errorForCHIPErrorCode:err], nil); } } -- (void)removeAllScenes:(uint16_t)groupId completionHandler:(ResponseHandler)completionHandler + +- (void)readAttributeEffectiveOperationMode:(ResponseHandler)completionHandler { - CHIPScenesClusterRemoveAllScenesResponseCallbackBridge * onSuccess - = new CHIPScenesClusterRemoveAllScenesResponseCallbackBridge(completionHandler, [self callbackQueue]); + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -7651,17 +7694,17 @@ - (void)removeAllScenes:(uint16_t)groupId completionHandler:(ResponseHandler)com return; } - CHIP_ERROR err = self.cppCluster.RemoveAllScenes(onSuccess->Cancel(), onFailure->Cancel(), groupId); + CHIP_ERROR err = self.cppCluster.ReadAttributeEffectiveOperationMode(onSuccess->Cancel(), onFailure->Cancel()); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; completionHandler([CHIPError errorForCHIPErrorCode:err], nil); } } -- (void)removeScene:(uint16_t)groupId sceneId:(uint8_t)sceneId completionHandler:(ResponseHandler)completionHandler + +- (void)readAttributeEffectiveControlMode:(ResponseHandler)completionHandler { - CHIPScenesClusterRemoveSceneResponseCallbackBridge * onSuccess - = new CHIPScenesClusterRemoveSceneResponseCallbackBridge(completionHandler, [self callbackQueue]); + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -7674,17 +7717,17 @@ - (void)removeScene:(uint16_t)groupId sceneId:(uint8_t)sceneId completionHandler return; } - CHIP_ERROR err = self.cppCluster.RemoveScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId); + CHIP_ERROR err = self.cppCluster.ReadAttributeEffectiveControlMode(onSuccess->Cancel(), onFailure->Cancel()); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; completionHandler([CHIPError errorForCHIPErrorCode:err], nil); } } -- (void)storeScene:(uint16_t)groupId sceneId:(uint8_t)sceneId completionHandler:(ResponseHandler)completionHandler + +- (void)readAttributeCapacity:(ResponseHandler)completionHandler { - CHIPScenesClusterStoreSceneResponseCallbackBridge * onSuccess - = new CHIPScenesClusterStoreSceneResponseCallbackBridge(completionHandler, [self callbackQueue]); + CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -7697,17 +7740,20 @@ - (void)storeScene:(uint16_t)groupId sceneId:(uint8_t)sceneId completionHandler: return; } - CHIP_ERROR err = self.cppCluster.StoreScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId); + CHIP_ERROR err = self.cppCluster.ReadAttributeCapacity(onSuccess->Cancel(), onFailure->Cancel()); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; completionHandler([CHIPError errorForCHIPErrorCode:err], nil); } } -- (void)viewScene:(uint16_t)groupId sceneId:(uint8_t)sceneId completionHandler:(ResponseHandler)completionHandler + +- (void)configureAttributeCapacity:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + change:(int16_t)change + completionHandler:(ResponseHandler)completionHandler { - CHIPScenesClusterViewSceneResponseCallbackBridge * onSuccess - = new CHIPScenesClusterViewSceneResponseCallbackBridge(completionHandler, [self callbackQueue]); + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -7720,7 +7766,8 @@ - (void)viewScene:(uint16_t)groupId sceneId:(uint8_t)sceneId completionHandler:( return; } - CHIP_ERROR err = self.cppCluster.ViewScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId); + CHIP_ERROR err + = self.cppCluster.ConfigureAttributeCapacity(onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; @@ -7728,7 +7775,22 @@ - (void)viewScene:(uint16_t)groupId sceneId:(uint8_t)sceneId completionHandler:( } } -- (void)readAttributeSceneCount:(ResponseHandler)completionHandler +- (void)reportAttributeCapacity:(ResponseHandler)reportHandler +{ + CHIPInt16sAttributeCallbackBridge * onReport = new CHIPInt16sAttributeCallbackBridge(reportHandler, [self callbackQueue], true); + if (!onReport) { + reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReportAttributeCapacity(onReport->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onReport; + reportHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeOperationMode:(ResponseHandler)completionHandler { CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { @@ -7743,7 +7805,7 @@ - (void)readAttributeSceneCount:(ResponseHandler)completionHandler return; } - CHIP_ERROR err = self.cppCluster.ReadAttributeSceneCount(onSuccess->Cancel(), onFailure->Cancel()); + CHIP_ERROR err = self.cppCluster.ReadAttributeOperationMode(onSuccess->Cancel(), onFailure->Cancel()); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; @@ -7751,9 +7813,9 @@ - (void)readAttributeSceneCount:(ResponseHandler)completionHandler } } -- (void)readAttributeCurrentScene:(ResponseHandler)completionHandler +- (void)writeAttributeOperationMode:(uint8_t)value completionHandler:(ResponseHandler)completionHandler { - CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -7766,7 +7828,7 @@ - (void)readAttributeCurrentScene:(ResponseHandler)completionHandler return; } - CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentScene(onSuccess->Cancel(), onFailure->Cancel()); + CHIP_ERROR err = self.cppCluster.WriteAttributeOperationMode(onSuccess->Cancel(), onFailure->Cancel(), value); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; @@ -7774,7 +7836,7 @@ - (void)readAttributeCurrentScene:(ResponseHandler)completionHandler } } -- (void)readAttributeCurrentGroup:(ResponseHandler)completionHandler +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler { CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { @@ -7789,7 +7851,7 @@ - (void)readAttributeCurrentGroup:(ResponseHandler)completionHandler return; } - CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentGroup(onSuccess->Cancel(), onFailure->Cancel()); + CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel()); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; @@ -7797,10 +7859,30 @@ - (void)readAttributeCurrentGroup:(ResponseHandler)completionHandler } } -- (void)readAttributeSceneValid:(ResponseHandler)completionHandler +@end + +@interface CHIPScenes () +@property (readonly) Controller::ScenesCluster cppCluster; +@end + +@implementation CHIPScenes + +- (Controller::ClusterBase *)getCluster { - CHIPBooleanAttributeCallbackBridge * onSuccess - = new CHIPBooleanAttributeCallbackBridge(completionHandler, [self callbackQueue]); + return &_cppCluster; +} + +- (void)addScene:(uint16_t)groupId + sceneId:(uint8_t)sceneId + transitionTime:(uint16_t)transitionTime + sceneName:(NSString *)sceneName + clusterId:(uint16_t)clusterId + length:(uint8_t)length + value:(uint8_t)value + completionHandler:(ResponseHandler)completionHandler +{ + CHIPScenesClusterAddSceneResponseCallbackBridge * onSuccess + = new CHIPScenesClusterAddSceneResponseCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -7813,17 +7895,20 @@ - (void)readAttributeSceneValid:(ResponseHandler)completionHandler return; } - CHIP_ERROR err = self.cppCluster.ReadAttributeSceneValid(onSuccess->Cancel(), onFailure->Cancel()); + CHIP_ERROR err = self.cppCluster.AddScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId, transitionTime, + chip::ByteSpan((const uint8_t *) [sceneName dataUsingEncoding:NSUTF8StringEncoding].bytes, + [sceneName lengthOfBytesUsingEncoding:NSUTF8StringEncoding]), + clusterId, length, value); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; completionHandler([CHIPError errorForCHIPErrorCode:err], nil); } } - -- (void)readAttributeNameSupport:(ResponseHandler)completionHandler +- (void)getSceneMembership:(uint16_t)groupId completionHandler:(ResponseHandler)completionHandler { - CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + CHIPScenesClusterGetSceneMembershipResponseCallbackBridge * onSuccess + = new CHIPScenesClusterGetSceneMembershipResponseCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -7836,17 +7921,19 @@ - (void)readAttributeNameSupport:(ResponseHandler)completionHandler return; } - CHIP_ERROR err = self.cppCluster.ReadAttributeNameSupport(onSuccess->Cancel(), onFailure->Cancel()); + CHIP_ERROR err = self.cppCluster.GetSceneMembership(onSuccess->Cancel(), onFailure->Cancel(), groupId); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; completionHandler([CHIPError errorForCHIPErrorCode:err], nil); } } - -- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler +- (void)recallScene:(uint16_t)groupId + sceneId:(uint8_t)sceneId + transitionTime:(uint16_t)transitionTime + completionHandler:(ResponseHandler)completionHandler { - CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -7859,30 +7946,17 @@ - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler return; } - CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel()); + CHIP_ERROR err = self.cppCluster.RecallScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId, transitionTime); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; completionHandler([CHIPError errorForCHIPErrorCode:err], nil); } } - -@end - -@interface CHIPTemperatureMeasurement () -@property (readonly) Controller::TemperatureMeasurementCluster cppCluster; -@end - -@implementation CHIPTemperatureMeasurement - -- (Controller::ClusterBase *)getCluster -{ - return &_cppCluster; -} - -- (void)readAttributeMeasuredValue:(ResponseHandler)completionHandler +- (void)removeAllScenes:(uint16_t)groupId completionHandler:(ResponseHandler)completionHandler { - CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + CHIPScenesClusterRemoveAllScenesResponseCallbackBridge * onSuccess + = new CHIPScenesClusterRemoveAllScenesResponseCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -7895,20 +7969,17 @@ - (void)readAttributeMeasuredValue:(ResponseHandler)completionHandler return; } - CHIP_ERROR err = self.cppCluster.ReadAttributeMeasuredValue(onSuccess->Cancel(), onFailure->Cancel()); + CHIP_ERROR err = self.cppCluster.RemoveAllScenes(onSuccess->Cancel(), onFailure->Cancel(), groupId); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; completionHandler([CHIPError errorForCHIPErrorCode:err], nil); } } - -- (void)configureAttributeMeasuredValue:(uint16_t)minInterval - maxInterval:(uint16_t)maxInterval - change:(int16_t)change - completionHandler:(ResponseHandler)completionHandler +- (void)removeScene:(uint16_t)groupId sceneId:(uint8_t)sceneId completionHandler:(ResponseHandler)completionHandler { - CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + CHIPScenesClusterRemoveSceneResponseCallbackBridge * onSuccess + = new CHIPScenesClusterRemoveSceneResponseCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -7921,33 +7992,40 @@ - (void)configureAttributeMeasuredValue:(uint16_t)minInterval return; } - CHIP_ERROR err = self.cppCluster.ConfigureAttributeMeasuredValue( - onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change); + CHIP_ERROR err = self.cppCluster.RemoveScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; completionHandler([CHIPError errorForCHIPErrorCode:err], nil); } } - -- (void)reportAttributeMeasuredValue:(ResponseHandler)reportHandler +- (void)storeScene:(uint16_t)groupId sceneId:(uint8_t)sceneId completionHandler:(ResponseHandler)completionHandler { - CHIPInt16sAttributeCallbackBridge * onReport = new CHIPInt16sAttributeCallbackBridge(reportHandler, [self callbackQueue], true); - if (!onReport) { - reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + CHIPScenesClusterStoreSceneResponseCallbackBridge * onSuccess + = new CHIPScenesClusterStoreSceneResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; } - CHIP_ERROR err = self.cppCluster.ReportAttributeMeasuredValue(onReport->Cancel()); + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.StoreScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId); if (err != CHIP_NO_ERROR) { - delete onReport; - reportHandler([CHIPError errorForCHIPErrorCode:err], nil); + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); } } - -- (void)readAttributeMinMeasuredValue:(ResponseHandler)completionHandler +- (void)viewScene:(uint16_t)groupId sceneId:(uint8_t)sceneId completionHandler:(ResponseHandler)completionHandler { - CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + CHIPScenesClusterViewSceneResponseCallbackBridge * onSuccess + = new CHIPScenesClusterViewSceneResponseCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -7960,7 +8038,7 @@ - (void)readAttributeMinMeasuredValue:(ResponseHandler)completionHandler return; } - CHIP_ERROR err = self.cppCluster.ReadAttributeMinMeasuredValue(onSuccess->Cancel(), onFailure->Cancel()); + CHIP_ERROR err = self.cppCluster.ViewScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; @@ -7968,9 +8046,9 @@ - (void)readAttributeMinMeasuredValue:(ResponseHandler)completionHandler } } -- (void)readAttributeMaxMeasuredValue:(ResponseHandler)completionHandler +- (void)readAttributeSceneCount:(ResponseHandler)completionHandler { - CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); if (!onSuccess) { completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -7983,7 +8061,774 @@ - (void)readAttributeMaxMeasuredValue:(ResponseHandler)completionHandler return; } - CHIP_ERROR err = self.cppCluster.ReadAttributeMaxMeasuredValue(onSuccess->Cancel(), onFailure->Cancel()); + CHIP_ERROR err = self.cppCluster.ReadAttributeSceneCount(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeCurrentScene:(ResponseHandler)completionHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentScene(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeCurrentGroup:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentGroup(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeSceneValid:(ResponseHandler)completionHandler +{ + CHIPBooleanAttributeCallbackBridge * onSuccess + = new CHIPBooleanAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeSceneValid(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeNameSupport:(ResponseHandler)completionHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeNameSupport(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +@end + +@interface CHIPSwitch () +@property (readonly) Controller::SwitchCluster cppCluster; +@end + +@implementation CHIPSwitch + +- (Controller::ClusterBase *)getCluster +{ + return &_cppCluster; +} + +- (void)readAttributeNumberOfPositions:(ResponseHandler)completionHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeNumberOfPositions(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeCurrentPosition:(ResponseHandler)completionHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentPosition(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)configureAttributeCurrentPosition:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + change:(uint8_t)change + completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ConfigureAttributeCurrentPosition( + onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)reportAttributeCurrentPosition:(ResponseHandler)reportHandler +{ + CHIPInt8uAttributeCallbackBridge * onReport = new CHIPInt8uAttributeCallbackBridge(reportHandler, [self callbackQueue], true); + if (!onReport) { + reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReportAttributeCurrentPosition(onReport->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onReport; + reportHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +@end + +@interface CHIPTemperatureMeasurement () +@property (readonly) Controller::TemperatureMeasurementCluster cppCluster; +@end + +@implementation CHIPTemperatureMeasurement + +- (Controller::ClusterBase *)getCluster +{ + return &_cppCluster; +} + +- (void)readAttributeMeasuredValue:(ResponseHandler)completionHandler +{ + CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeMeasuredValue(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)configureAttributeMeasuredValue:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + change:(int16_t)change + completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ConfigureAttributeMeasuredValue( + onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)reportAttributeMeasuredValue:(ResponseHandler)reportHandler +{ + CHIPInt16sAttributeCallbackBridge * onReport = new CHIPInt16sAttributeCallbackBridge(reportHandler, [self callbackQueue], true); + if (!onReport) { + reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReportAttributeMeasuredValue(onReport->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onReport; + reportHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeMinMeasuredValue:(ResponseHandler)completionHandler +{ + CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeMinMeasuredValue(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeMaxMeasuredValue:(ResponseHandler)completionHandler +{ + CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeMaxMeasuredValue(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +@end + +@interface CHIPThermostat () +@property (readonly) Controller::ThermostatCluster cppCluster; +@end + +@implementation CHIPThermostat + +- (Controller::ClusterBase *)getCluster +{ + return &_cppCluster; +} + +- (void)clearWeeklySchedule:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ClearWeeklySchedule(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)getRelayStatusLog:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.GetRelayStatusLog(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)getWeeklySchedule:(uint8_t)daysToReturn + modeToReturn:(uint8_t)modeToReturn + completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.GetWeeklySchedule(onSuccess->Cancel(), onFailure->Cancel(), daysToReturn, modeToReturn); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)setWeeklySchedule:(uint8_t)numberOfTransitionsForSequence + dayOfWeekForSequence:(uint8_t)dayOfWeekForSequence + modeForSequence:(uint8_t)modeForSequence + payload:(uint8_t)payload + completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.SetWeeklySchedule( + onSuccess->Cancel(), onFailure->Cancel(), numberOfTransitionsForSequence, dayOfWeekForSequence, modeForSequence, payload); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)setpointRaiseLower:(uint8_t)mode amount:(int8_t)amount completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.SetpointRaiseLower(onSuccess->Cancel(), onFailure->Cancel(), mode, amount); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeLocalTemperature:(ResponseHandler)completionHandler +{ + CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeLocalTemperature(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)configureAttributeLocalTemperature:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + change:(int16_t)change + completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ConfigureAttributeLocalTemperature( + onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)reportAttributeLocalTemperature:(ResponseHandler)reportHandler +{ + CHIPInt16sAttributeCallbackBridge * onReport = new CHIPInt16sAttributeCallbackBridge(reportHandler, [self callbackQueue], true); + if (!onReport) { + reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReportAttributeLocalTemperature(onReport->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onReport; + reportHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeOccupiedCoolingSetpoint:(ResponseHandler)completionHandler +{ + CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeOccupiedCoolingSetpoint(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeOccupiedCoolingSetpoint:(int16_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.WriteAttributeOccupiedCoolingSetpoint(onSuccess->Cancel(), onFailure->Cancel(), value); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeOccupiedHeatingSetpoint:(ResponseHandler)completionHandler +{ + CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeOccupiedHeatingSetpoint(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeOccupiedHeatingSetpoint:(int16_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.WriteAttributeOccupiedHeatingSetpoint(onSuccess->Cancel(), onFailure->Cancel(), value); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeControlSequenceOfOperation:(ResponseHandler)completionHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeControlSequenceOfOperation(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeControlSequenceOfOperation:(uint8_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.WriteAttributeControlSequenceOfOperation(onSuccess->Cancel(), onFailure->Cancel(), value); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeSystemMode:(ResponseHandler)completionHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeSystemMode(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeSystemMode:(uint8_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.WriteAttributeSystemMode(onSuccess->Cancel(), onFailure->Cancel(), value); if (err != CHIP_NO_ERROR) { delete onSuccess; delete onFailure; diff --git a/src/darwin/Framework/CHIP/gen/IMClusterCommandHandler.cpp b/src/darwin/Framework/CHIP/gen/IMClusterCommandHandler.cpp index 03625546bab415..934fb34f6b2abf 100644 --- a/src/darwin/Framework/CHIP/gen/IMClusterCommandHandler.cpp +++ b/src/darwin/Framework/CHIP/gen/IMClusterCommandHandler.cpp @@ -2149,6 +2149,91 @@ void DispatchClientCommand(app::Command * apCommandObj, CommandId aCommandId, En } break; } + case ZCL_COMMISSIONING_COMPLETE_RESPONSE_COMMAND_ID: { + // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV + // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. + // Any error value TLVUnpackError means we have received an illegal value. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t errorCode; + bool errorCodeExists = false; + const uint8_t * debugText; + bool debugTextExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(aDataTlv.GetTag())) + { + case 0: + if (errorCodeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(errorCode); + if (CHIP_NO_ERROR == TLVUnpackError) + { + errorCodeExists = true; + validArgumentCount++; + } + break; + case 1: + if (debugTextExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = aDataTlv.GetDataPtr(debugText); + if (CHIP_NO_ERROR == TLVUnpackError) + { + debugTextExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(aDataTlv.GetTag()), TLVUnpackError); + break; + } + } + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfGeneralCommissioningClusterCommissioningCompleteResponseCallback(apCommandObj, errorCode, + const_cast(debugText)); + } + else + { + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kBadRequest, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogProgress( + Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, + 2, validArgumentCount, TLVError, TLVUnpackError); + } + break; + } case ZCL_SET_REGULATORY_CONFIG_RESPONSE_COMMAND_ID: { // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. diff --git a/src/darwin/Framework/CHIP/gen/attribute-id.h b/src/darwin/Framework/CHIP/gen/attribute-id.h index 43d108726fe431..229d4014f4b1ba 100644 --- a/src/darwin/Framework/CHIP/gen/attribute-id.h +++ b/src/darwin/Framework/CHIP/gen/attribute-id.h @@ -421,6 +421,15 @@ // Server attributes +// Attribute ids for cluster: Switch + +// Client attributes + +// Server attributes +#define ZCL_NUMBER_OF_POSITIONS_ATTRIBUTE_ID (0x0000) +#define ZCL_CURRENT_POSITION_ATTRIBUTE_ID (0x0001) +#define ZCL_MULTI_PRESS_MAX_ATTRIBUTE_ID (0x0002) + // Attribute ids for cluster: Operational Credentials // Client attributes diff --git a/src/darwin/Framework/CHIP/gen/call-command-handler.cpp b/src/darwin/Framework/CHIP/gen/call-command-handler.cpp index ceba010edb5eaa..8a2ac614c4bc67 100644 --- a/src/darwin/Framework/CHIP/gen/call-command-handler.cpp +++ b/src/darwin/Framework/CHIP/gen/call-command-handler.cpp @@ -44,8 +44,11 @@ EmberAfStatus emberAfLowPowerClusterClientCommandParse(EmberAfClusterCommand * c EmberAfStatus emberAfNetworkCommissioningClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfOnOffClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfOperationalCredentialsClusterClientCommandParse(EmberAfClusterCommand * cmd); +EmberAfStatus emberAfPumpConfigurationAndControlClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfScenesClusterClientCommandParse(EmberAfClusterCommand * cmd); +EmberAfStatus emberAfSwitchClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfTemperatureMeasurementClusterClientCommandParse(EmberAfClusterCommand * cmd); +EmberAfStatus emberAfThermostatClusterClientCommandParse(EmberAfClusterCommand * cmd); static EmberAfStatus status(bool wasHandled, bool clusterExists, bool mfgSpecific) { @@ -134,13 +137,25 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd) case ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID: result = emberAfOperationalCredentialsClusterClientCommandParse(cmd); break; + case ZCL_PUMP_CONFIG_CONTROL_CLUSTER_ID: + // No commands are enabled for cluster Pump Configuration and Control + result = status(false, true, cmd->mfgSpecific); + break; case ZCL_SCENES_CLUSTER_ID: result = emberAfScenesClusterClientCommandParse(cmd); break; + case ZCL_SWITCH_CLUSTER_ID: + // No commands are enabled for cluster Switch + result = status(false, true, cmd->mfgSpecific); + break; case ZCL_TEMP_MEASUREMENT_CLUSTER_ID: // No commands are enabled for cluster Temperature Measurement result = status(false, true, cmd->mfgSpecific); break; + case ZCL_THERMOSTAT_CLUSTER_ID: + // No commands are enabled for cluster Thermostat + result = status(false, true, cmd->mfgSpecific); + break; default: // Unrecognized cluster ID, error status will apply. break; @@ -704,6 +719,26 @@ EmberAfStatus emberAfGeneralCommissioningClusterClientCommandParse(EmberAfCluste wasHandled = emberAfGeneralCommissioningClusterArmFailSafeResponseCallback(nullptr, errorCode, debugText); break; } + case ZCL_COMMISSIONING_COMPLETE_RESPONSE_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t errorCode; + uint8_t * debugText; + + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + errorCode = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1u) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + debugText = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfGeneralCommissioningClusterCommissioningCompleteResponseCallback(nullptr, errorCode, debugText); + break; + } case ZCL_SET_REGULATORY_CONFIG_RESPONSE_COMMAND_ID: { uint16_t payloadOffset = cmd->payloadStartIndex; uint8_t errorCode; diff --git a/src/darwin/Framework/CHIP/gen/callback-stub.cpp b/src/darwin/Framework/CHIP/gen/callback-stub.cpp index 1782c064950af4..33666ecc7a520a 100644 --- a/src/darwin/Framework/CHIP/gen/callback-stub.cpp +++ b/src/darwin/Framework/CHIP/gen/callback-stub.cpp @@ -77,12 +77,21 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID: emberAfOperationalCredentialsClusterInitCallback(endpoint); break; + case ZCL_PUMP_CONFIG_CONTROL_CLUSTER_ID: + emberAfPumpConfigurationAndControlClusterInitCallback(endpoint); + break; case ZCL_SCENES_CLUSTER_ID: emberAfScenesClusterInitCallback(endpoint); break; + case ZCL_SWITCH_CLUSTER_ID: + emberAfSwitchClusterInitCallback(endpoint); + break; case ZCL_TEMP_MEASUREMENT_CLUSTER_ID: emberAfTemperatureMeasurementClusterInitCallback(endpoint); break; + case ZCL_THERMOSTAT_CLUSTER_ID: + emberAfThermostatClusterInitCallback(endpoint); + break; default: // Unrecognized cluster ID break; @@ -169,16 +178,31 @@ void __attribute__((weak)) emberAfOperationalCredentialsClusterInitCallback(Endp // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfPumpConfigurationAndControlClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfScenesClusterInitCallback(EndpointId endpoint) { // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfSwitchClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfTemperatureMeasurementClusterInitCallback(EndpointId endpoint) { // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfThermostatClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} // // Non-Cluster Related Callbacks diff --git a/src/darwin/Framework/CHIP/gen/callback.h b/src/darwin/Framework/CHIP/gen/callback.h index 1ac38902657f28..6045ed41af6075 100644 --- a/src/darwin/Framework/CHIP/gen/callback.h +++ b/src/darwin/Framework/CHIP/gen/callback.h @@ -168,6 +168,14 @@ void emberAfOnOffClusterInitCallback(chip::EndpointId endpoint); */ void emberAfOperationalCredentialsClusterInitCallback(chip::EndpointId endpoint); +/** @brief Pump Configuration and Control Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfPumpConfigurationAndControlClusterInitCallback(chip::EndpointId endpoint); + /** @brief Scenes Cluster Init * * Cluster Init @@ -176,6 +184,14 @@ void emberAfOperationalCredentialsClusterInitCallback(chip::EndpointId endpoint) */ void emberAfScenesClusterInitCallback(chip::EndpointId endpoint); +/** @brief Switch Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfSwitchClusterInitCallback(chip::EndpointId endpoint); + /** @brief Temperature Measurement Cluster Init * * Cluster Init @@ -184,6 +200,14 @@ void emberAfScenesClusterInitCallback(chip::EndpointId endpoint); */ void emberAfTemperatureMeasurementClusterInitCallback(chip::EndpointId endpoint); +/** @brief Thermostat Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfThermostatClusterInitCallback(chip::EndpointId endpoint); + // Cluster Server/Client Init Functions // @@ -1308,6 +1332,78 @@ EmberAfStatus emberAfOperationalCredentialsClusterClientPreAttributeChangedCallb */ void emberAfOperationalCredentialsClusterClientTickCallback(chip::EndpointId endpoint); +// +// Pump Configuration and Control Cluster client +// + +/** @brief Pump Configuration and Control Cluster Client Init + * + * Client Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfPumpConfigurationAndControlClusterClientInitCallback(chip::EndpointId endpoint); + +/** @brief Pump Configuration and Control Cluster Client Attribute Changed + * + * Client Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + */ +void emberAfPumpConfigurationAndControlClusterClientAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId); + +/** @brief Pump Configuration and Control Cluster Client Manufacturer Specific Attribute Changed + * + * Client Manufacturer Specific Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + * @param manufacturerCode Manufacturer Code of the attribute that changed + */ +void emberAfPumpConfigurationAndControlClusterClientManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + uint16_t manufacturerCode); + +/** @brief Pump Configuration and Control Cluster Client Message Sent + * + * Client Message Sent + * + * @param type The type of message sent + * @param indexOrDestination The destination or address to which the message was sent + * @param apsFrame The APS frame for the message + * @param msgLen The length of the message + * @param message The message that was sent + * @param status The status of the sent message + */ +void emberAfPumpConfigurationAndControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, + EmberApsFrame * apsFrame, uint16_t msgLen, + uint8_t * message, EmberStatus status); + +/** @brief Pump Configuration and Control Cluster Client Pre Attribute Changed + * + * client Pre Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +EmberAfStatus emberAfPumpConfigurationAndControlClusterClientPreAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + EmberAfAttributeType attributeType, + uint8_t size, uint8_t * value); + +/** @brief Pump Configuration and Control Cluster Client Tick + * + * client Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfPumpConfigurationAndControlClusterClientTickCallback(chip::EndpointId endpoint); + // // Scenes Cluster client // @@ -1378,6 +1474,76 @@ EmberAfStatus emberAfScenesClusterClientPreAttributeChangedCallback(chip::Endpoi */ void emberAfScenesClusterClientTickCallback(chip::EndpointId endpoint); +// +// Switch Cluster client +// + +/** @brief Switch Cluster Client Init + * + * Client Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfSwitchClusterClientInitCallback(chip::EndpointId endpoint); + +/** @brief Switch Cluster Client Attribute Changed + * + * Client Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + */ +void emberAfSwitchClusterClientAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); + +/** @brief Switch Cluster Client Manufacturer Specific Attribute Changed + * + * Client Manufacturer Specific Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + * @param manufacturerCode Manufacturer Code of the attribute that changed + */ +void emberAfSwitchClusterClientManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + uint16_t manufacturerCode); + +/** @brief Switch Cluster Client Message Sent + * + * Client Message Sent + * + * @param type The type of message sent + * @param indexOrDestination The destination or address to which the message was sent + * @param apsFrame The APS frame for the message + * @param msgLen The length of the message + * @param message The message that was sent + * @param status The status of the sent message + */ +void emberAfSwitchClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, + EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, + EmberStatus status); + +/** @brief Switch Cluster Client Pre Attribute Changed + * + * client Pre Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +EmberAfStatus emberAfSwitchClusterClientPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, + EmberAfAttributeType attributeType, uint8_t size, + uint8_t * value); + +/** @brief Switch Cluster Client Tick + * + * client Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfSwitchClusterClientTickCallback(chip::EndpointId endpoint); + // // Temperature Measurement Cluster client // @@ -1449,6 +1615,76 @@ EmberAfStatus emberAfTemperatureMeasurementClusterClientPreAttributeChangedCallb */ void emberAfTemperatureMeasurementClusterClientTickCallback(chip::EndpointId endpoint); +// +// Thermostat Cluster client +// + +/** @brief Thermostat Cluster Client Init + * + * Client Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfThermostatClusterClientInitCallback(chip::EndpointId endpoint); + +/** @brief Thermostat Cluster Client Attribute Changed + * + * Client Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + */ +void emberAfThermostatClusterClientAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); + +/** @brief Thermostat Cluster Client Manufacturer Specific Attribute Changed + * + * Client Manufacturer Specific Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + * @param manufacturerCode Manufacturer Code of the attribute that changed + */ +void emberAfThermostatClusterClientManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + uint16_t manufacturerCode); + +/** @brief Thermostat Cluster Client Message Sent + * + * Client Message Sent + * + * @param type The type of message sent + * @param indexOrDestination The destination or address to which the message was sent + * @param apsFrame The APS frame for the message + * @param msgLen The length of the message + * @param message The message that was sent + * @param status The status of the sent message + */ +void emberAfThermostatClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, + EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, + EmberStatus status); + +/** @brief Thermostat Cluster Client Pre Attribute Changed + * + * client Pre Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +EmberAfStatus emberAfThermostatClusterClientPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, + EmberAfAttributeType attributeType, uint8_t size, + uint8_t * value); + +/** @brief Thermostat Cluster Client Tick + * + * client Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfThermostatClusterClientTickCallback(chip::EndpointId endpoint); + // Cluster Commands Callback /** @@ -1658,6 +1894,15 @@ bool emberAfDoorLockClusterUnlockWithTimeoutResponseCallback(chip::app::Command bool emberAfGeneralCommissioningClusterArmFailSafeResponseCallback(chip::app::Command * commandObj, uint8_t errorCode, uint8_t * debugText); +/** + * @brief General Commissioning Cluster CommissioningCompleteResponse Command callback + * @param errorCode + * @param debugText + */ + +bool emberAfGeneralCommissioningClusterCommissioningCompleteResponseCallback(chip::app::Command * commandObj, uint8_t errorCode, + uint8_t * debugText); + /** * @brief General Commissioning Cluster SetRegulatoryConfigResponse Command callback * @param errorCode diff --git a/src/darwin/Framework/CHIP/gen/cluster-id.h b/src/darwin/Framework/CHIP/gen/cluster-id.h index 3aea880546f261..b8d9a9f7ed09bf 100644 --- a/src/darwin/Framework/CHIP/gen/cluster-id.h +++ b/src/darwin/Framework/CHIP/gen/cluster-id.h @@ -98,6 +98,9 @@ // Definitions for cluster: Network Commissioning #define ZCL_NETWORK_COMMISSIONING_CLUSTER_ID (0x0031) +// Definitions for cluster: Switch +#define ZCL_SWITCH_CLUSTER_ID (0x003B) + // Definitions for cluster: Operational Credentials #define ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID (0x003E) diff --git a/src/darwin/Framework/CHIP/gen/endpoint_config.h b/src/darwin/Framework/CHIP/gen/endpoint_config.h index eb29a75dc3e897..5d7aa618a861c8 100644 --- a/src/darwin/Framework/CHIP/gen/endpoint_config.h +++ b/src/darwin/Framework/CHIP/gen/endpoint_config.h @@ -63,7 +63,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 18 +#define GENERATED_ATTRIBUTE_COUNT 21 #define GENERATED_ATTRIBUTES \ { \ \ @@ -93,6 +93,9 @@ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ /* Endpoint: 1, Cluster: Network Commissioning (client) */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ + \ + /* Endpoint: 1, Cluster: Switch (client) */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ /* Endpoint: 1, Cluster: Operational Credentials (client) */ \ @@ -104,6 +107,12 @@ /* Endpoint: 1, Cluster: Barrier Control (client) */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ + /* Endpoint: 1, Cluster: Pump Configuration and Control (client) */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ + \ + /* Endpoint: 1, Cluster: Thermostat (client) */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(3) }, /* cluster revision */ \ + \ /* Endpoint: 1, Cluster: Color Control (client) */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(3) }, /* cluster revision */ \ \ @@ -130,7 +139,7 @@ #define GENERATED_FUNCTION_ARRAYS #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask -#define GENERATED_CLUSTER_COUNT 18 +#define GENERATED_CLUSTER_COUNT 21 #define GENERATED_CLUSTERS \ { \ { 0x0003, ZAP_ATTRIBUTE_INDEX(0), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Identify (client) */ \ @@ -150,32 +159,39 @@ { \ 0x0031, ZAP_ATTRIBUTE_INDEX(8), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Network Commissioning (client) */ \ + { 0x003B, ZAP_ATTRIBUTE_INDEX(9), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Switch (client) */ \ { \ - 0x003E, ZAP_ATTRIBUTE_INDEX(9), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x003E, ZAP_ATTRIBUTE_INDEX(10), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Operational Credentials (client) */ \ { \ - 0x0101, ZAP_ATTRIBUTE_INDEX(10), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0101, ZAP_ATTRIBUTE_INDEX(11), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Door Lock (client) */ \ { \ - 0x0103, ZAP_ATTRIBUTE_INDEX(11), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0103, ZAP_ATTRIBUTE_INDEX(12), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Barrier Control (client) */ \ { \ - 0x0300, ZAP_ATTRIBUTE_INDEX(12), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0200, ZAP_ATTRIBUTE_INDEX(13), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + }, /* Endpoint: 1, Cluster: Pump Configuration and Control (client) */ \ + { \ + 0x0201, ZAP_ATTRIBUTE_INDEX(14), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + }, /* Endpoint: 1, Cluster: Thermostat (client) */ \ + { \ + 0x0300, ZAP_ATTRIBUTE_INDEX(15), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Color Control (client) */ \ { \ - 0x0402, ZAP_ATTRIBUTE_INDEX(13), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0402, ZAP_ATTRIBUTE_INDEX(16), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Temperature Measurement (client) */ \ { \ - 0x0508, ZAP_ATTRIBUTE_INDEX(14), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0508, ZAP_ATTRIBUTE_INDEX(17), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Low Power (client) */ \ { \ - 0x050D, ZAP_ATTRIBUTE_INDEX(15), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x050D, ZAP_ATTRIBUTE_INDEX(18), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Application Basic (client) */ \ { \ - 0xF000, ZAP_ATTRIBUTE_INDEX(16), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0xF000, ZAP_ATTRIBUTE_INDEX(19), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Binding (client) */ \ { \ - 0xF004, ZAP_ATTRIBUTE_INDEX(17), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0xF004, ZAP_ATTRIBUTE_INDEX(20), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Group Key Management (client) */ \ } @@ -184,7 +200,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 18, 36 }, \ + { ZAP_CLUSTER_INDEX(0), 21, 42 }, \ } // Largest attribute size is needed for various buffers @@ -194,7 +210,7 @@ #define ATTRIBUTE_SINGLETONS_SIZE (2) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (36) +#define ATTRIBUTE_MAX_SIZE (42) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (1) @@ -238,7 +254,7 @@ // Array of EmberAfCommandMetadata structs. #define ZAP_COMMAND_MASK(mask) COMMAND_MASK_##mask -#define EMBER_AF_GENERATED_COMMAND_COUNT (133) +#define EMBER_AF_GENERATED_COMMAND_COUNT (142) #define GENERATED_COMMANDS \ { \ \ @@ -301,6 +317,8 @@ { 0x0030, 0x02, ZAP_COMMAND_MASK(INCOMING_CLIENT) | ZAP_COMMAND_MASK(OUTGOING_CLIENT) }, /* SetRegulatoryConfig */ \ { 0x0030, 0x03, \ ZAP_COMMAND_MASK(INCOMING_CLIENT) | ZAP_COMMAND_MASK(OUTGOING_CLIENT) }, /* SetRegulatoryConfigResponse */ \ + { 0x0030, 0x04, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* CommissioningComplete */ \ + { 0x0030, 0x05, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* CommissioningCompleteResponse */ \ \ /* Endpoint: 1, Cluster: Network Commissioning (client) */ \ { 0x0031, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* ScanNetworks */ \ @@ -391,6 +409,15 @@ { 0x0103, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* BarrierControlGoToPercent */ \ { 0x0103, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* BarrierControlStop */ \ \ + /* Endpoint: 1, Cluster: Thermostat (client) */ \ + { 0x0201, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* SetpointRaiseLower */ \ + { 0x0201, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* CurrentWeeklySchedule */ \ + { 0x0201, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* SetWeeklySchedule */ \ + { 0x0201, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* RelayStatusLog */ \ + { 0x0201, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* GetWeeklySchedule */ \ + { 0x0201, 0x03, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* ClearWeeklySchedule */ \ + { 0x0201, 0x04, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* GetRelayStatusLog */ \ + \ /* Endpoint: 1, Cluster: Color Control (client) */ \ { 0x0300, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) | ZAP_COMMAND_MASK(OUTGOING_CLIENT) }, /* MoveToHue */ \ { 0x0300, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) | ZAP_COMMAND_MASK(OUTGOING_CLIENT) }, /* MoveHue */ \ diff --git a/src/darwin/Framework/CHIP/gen/gen_config.h b/src/darwin/Framework/CHIP/gen/gen_config.h index 2f96c3dca919c9..e0854ebb074057 100644 --- a/src/darwin/Framework/CHIP/gen/gen_config.h +++ b/src/darwin/Framework/CHIP/gen/gen_config.h @@ -45,8 +45,11 @@ #define EMBER_AF_NETWORK_COMMISSIONING_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_ON_OFF_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_OPERATIONAL_CREDENTIALS_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_PUMP_CONFIG_CONTROL_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_SCENES_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_SWITCH_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_TEMP_MEASUREMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_THERMOSTAT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) /**** Cluster Plugins ****/ @@ -114,10 +117,22 @@ #define ZCL_USING_OPERATIONAL_CREDENTIALS_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_OPERATIONAL_CREDENTIALS_CLIENT +// Use this macro to check if the client side of the Pump Configuration and Control cluster is included +#define ZCL_USING_PUMP_CONFIG_CONTROL_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_PUMP_CONFIGURATION_AND_CONTROL_CLIENT + // Use this macro to check if the client side of the Scenes cluster is included #define ZCL_USING_SCENES_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_SCENES_CLIENT +// Use this macro to check if the client side of the Switch cluster is included +#define ZCL_USING_SWITCH_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_SWITCH_CLIENT + // Use this macro to check if the client side of the Temperature Measurement cluster is included #define ZCL_USING_TEMP_MEASUREMENT_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_TEMPERATURE_MEASUREMENT_CLIENT + +// Use this macro to check if the client side of the Thermostat cluster is included +#define ZCL_USING_THERMOSTAT_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_THERMOSTAT_CLIENT diff --git a/src/darwin/Framework/CHIP/gen/print-cluster.h b/src/darwin/Framework/CHIP/gen/print-cluster.h index 68d3e99e109b2b..9c879d94a9390d 100644 --- a/src/darwin/Framework/CHIP/gen/print-cluster.h +++ b/src/darwin/Framework/CHIP/gen/print-cluster.h @@ -180,6 +180,12 @@ #define CHIP_PRINTCLUSTER_NETWORK_COMMISSIONING_CLUSTER #endif +#if defined(ZCL_USING_SWITCH_CLUSTER_SERVER) || defined(ZCL_USING_SWITCH_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_SWITCH_CLUSTER { ZCL_SWITCH_CLUSTER_ID, 59, "Switch" }, +#else +#define CHIP_PRINTCLUSTER_SWITCH_CLUSTER +#endif + #if defined(ZCL_USING_OPERATIONAL_CREDENTIALS_CLUSTER_SERVER) || defined(ZCL_USING_OPERATIONAL_CREDENTIALS_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_OPERATIONAL_CREDENTIALS_CLUSTER { ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID, 62, "Operational Credentials" }, #else @@ -894,6 +900,7 @@ CHIP_PRINTCLUSTER_OTA_CLIENT_CLUSTER \ CHIP_PRINTCLUSTER_GENERAL_COMMISSIONING_CLUSTER \ CHIP_PRINTCLUSTER_NETWORK_COMMISSIONING_CLUSTER \ + CHIP_PRINTCLUSTER_SWITCH_CLUSTER \ CHIP_PRINTCLUSTER_OPERATIONAL_CREDENTIALS_CLUSTER \ CHIP_PRINTCLUSTER_SHADE_CONFIG_CLUSTER \ CHIP_PRINTCLUSTER_DOOR_LOCK_CLUSTER \