From e08afe72d29065aa8f5fe8cc20a1b4a98ea59dc9 Mon Sep 17 00:00:00 2001 From: eve-cxrp <80681009+eve-cxrp@users.noreply.github.com> Date: Sat, 29 May 2021 00:33:51 +0200 Subject: [PATCH] Part 2: feature/relative humidity measurement cluster (#7028) * format endpointClusterWithInit for easier pull requests * add support for emberAfRelativeHumidityMeasurementClusterServerInitCallback * add server side relative humidity measurement cluster impl. * add relative humidity measurement cluster to controller-clusters.zap * Add new clusters to zap_cluster_list.py * Restyled by clang-format * apply fixes - replace emberAfReadAttribute with emberAfReadServerAttribute - replace emberAfWriteAttribute with emberAfWriteServerAttribute - add emberAfRelativeHumidityMeasurementClusterPrintln - let the caller do the logging * remove emberAfRelativeHumidityMeasurementClusterServerInitCallback impl. The default values are populated by the attribute storage. * fix year in copyright * remove unrelated clusters in zap_cluster_list.py * add relative humidity measurement to all-cluster-app.zap * fix relative humidity measurement includes * temptive fix for esp32/all-cluster-app * another try to fix all-cluster-app/esp32 * regen all * Remove unnecessary init callback from Relative Humidity Measurement cluster * Add Relative Humidity Measurement cluster on endpoint 1 also in all-clusters-app * Regenerate generated files Co-authored-by: Vivien Nicolas Co-authored-by: Restyled.io Co-authored-by: Boris Zbarsky --- .../all-clusters-common/all-clusters-app.zap | 224 ++++++++++++++++ .../gen/call-command-handler.cpp | 5 + .../all-clusters-common/gen/callback-stub.cpp | 8 + .../all-clusters-common/gen/callback.h | 81 ++++++ .../all-clusters-common/gen/endpoint_config.h | 120 +++++---- .../all-clusters-common/gen/gen_config.h | 6 + .../esp32/main/CMakeLists.txt | 1 + .../all-clusters-app/esp32/main/component.mk | 1 + .../chip-tool/commands/clusters/Commands.h | 244 ++++++++++++++++++ .../chip-tool/commands/reporting/Commands.h | 5 + .../relative-humidity-measurement-server.cpp | 76 ++++++ .../relative-humidity-measurement-server.h | 30 +++ src/app/zap_cluster_list.py | 2 + .../data_model/controller-clusters.zap | 112 ++++++++ .../data_model/gen/CHIPClusters.cpp | 61 +++++ src/controller/data_model/gen/CHIPClusters.h | 18 ++ .../data_model/gen/call-command-handler.cpp | 5 + .../data_model/gen/callback-stub.cpp | 8 + src/controller/data_model/gen/callback.h | 81 ++++++ .../data_model/gen/chip-zcl-zpro-codec-api.h | 60 +++++ src/controller/data_model/gen/encoder.cpp | 84 ++++++ .../data_model/gen/endpoint_config.h | 44 ++-- src/controller/data_model/gen/gen_config.h | 5 + .../python/chip/clusters/CHIPClusters.cpp | 54 ++++ .../python/chip/clusters/CHIPClusters.py | 34 +++ .../Framework/CHIP/gen/CHIPClustersObjc.h | 18 ++ .../Framework/CHIP/gen/CHIPClustersObjc.mm | 171 ++++++++++++ .../Framework/CHIPTests/CHIPClustersTests.m | 84 ++++++ 28 files changed, 1577 insertions(+), 65 deletions(-) create mode 100644 src/app/clusters/relative-humidity-measurement-server/relative-humidity-measurement-server.cpp create mode 100644 src/app/clusters/relative-humidity-measurement-server/relative-humidity-measurement-server.h 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 fa52cbbcffe260..9f3de610c34da6 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 @@ -4994,6 +4994,118 @@ } ] }, + { + "name": "Relative Humidity Measurement", + "code": 1029, + "mfgCode": null, + "define": "RELATIVE_HUMIDITY_MEASUREMENT_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": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Relative Humidity Measurement", + "code": 1029, + "mfgCode": null, + "define": "RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "measured value", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "min measured value", + "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 measured value", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "tolerance", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "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": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, { "name": "IAS Zone", "code": 1280, @@ -10118,6 +10230,118 @@ } ] }, + { + "name": "Relative Humidity Measurement", + "code": 1029, + "mfgCode": null, + "define": "RELATIVE_HUMIDITY_MEASUREMENT_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": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Relative Humidity Measurement", + "code": 1029, + "mfgCode": null, + "define": "RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "measured value", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "min measured value", + "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 measured value", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "tolerance", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "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": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, { "name": "IAS Zone", "code": 1280, 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 06fd16ee04c924..8d8f4ab7b8daa7 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 @@ -60,6 +60,7 @@ EmberAfStatus emberAfOccupancySensingClusterServerCommandParse(EmberAfClusterCom EmberAfStatus emberAfOnOffClusterServerCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfOperationalCredentialsClusterServerCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfPumpConfigurationAndControlClusterServerCommandParse(EmberAfClusterCommand * cmd); +EmberAfStatus emberAfRelativeHumidityMeasurementClusterServerCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfScenesClusterServerCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfSoftwareDiagnosticsClusterServerCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfSwitchClusterServerCommandParse(EmberAfClusterCommand * cmd); @@ -226,6 +227,10 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd) // No commands are enabled for cluster Pump Configuration and Control result = status(false, true, cmd->mfgSpecific); break; + case ZCL_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_ID: + // No commands are enabled for cluster Relative Humidity Measurement + result = status(false, true, cmd->mfgSpecific); + break; case ZCL_SCENES_CLUSTER_ID: result = emberAfScenesClusterServerCommandParse(cmd); break; 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 1b669d0870bb3c..f5bbc99d4912ac 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 @@ -125,6 +125,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case ZCL_PUMP_CONFIG_CONTROL_CLUSTER_ID: emberAfPumpConfigurationAndControlClusterInitCallback(endpoint); break; + case ZCL_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_ID: + emberAfRelativeHumidityMeasurementClusterInitCallback(endpoint); + break; case ZCL_SCENES_CLUSTER_ID: emberAfScenesClusterInitCallback(endpoint); break; @@ -330,6 +333,11 @@ void __attribute__((weak)) emberAfPumpConfigurationAndControlClusterInitCallback // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfRelativeHumidityMeasurementClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfScenesClusterInitCallback(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 d80660c8745ff1..9ea9b7aee14b1f 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/callback.h +++ b/examples/all-clusters-app/all-clusters-common/gen/callback.h @@ -296,6 +296,14 @@ void emberAfOperationalCredentialsClusterInitCallback(chip::EndpointId endpoint) */ void emberAfPumpConfigurationAndControlClusterInitCallback(chip::EndpointId endpoint); +/** @brief Relative Humidity Measurement Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfRelativeHumidityMeasurementClusterInitCallback(chip::EndpointId endpoint); + /** @brief Scenes Cluster Init * * Cluster Init @@ -2659,6 +2667,79 @@ EmberAfStatus emberAfPumpConfigurationAndControlClusterServerPreAttributeChanged */ void emberAfPumpConfigurationAndControlClusterServerTickCallback(chip::EndpointId endpoint); +// +// Relative Humidity Measurement Cluster server +// + +/** @brief Relative Humidity Measurement Cluster Server Init + * + * Server Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfRelativeHumidityMeasurementClusterServerInitCallback(chip::EndpointId endpoint); + +/** @brief Relative Humidity Measurement Cluster Server Attribute Changed + * + * Server Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + */ +void emberAfRelativeHumidityMeasurementClusterServerAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId); + +/** @brief Relative Humidity Measurement 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 emberAfRelativeHumidityMeasurementClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + uint16_t manufacturerCode); + +/** @brief Relative Humidity Measurement Cluster Server Message Sent + * + * Server Message Sent + * + * @param type The type of message sent + * @param destination The destination 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 emberAfRelativeHumidityMeasurementClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, + EmberApsFrame * apsFrame, uint16_t msgLen, + uint8_t * message, EmberStatus status); + +/** @brief Relative Humidity Measurement 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 emberAfRelativeHumidityMeasurementClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + EmberAfAttributeType attributeType, + uint16_t size, uint8_t * value); + +/** @brief Relative Humidity Measurement Cluster Server Tick + * + * server Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfRelativeHumidityMeasurementClusterServerTickCallback(chip::EndpointId endpoint); + // // Scenes Cluster server // 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 a45d6f2cf1c6cf..8d06b294e3a6e6 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 @@ -1649,7 +1649,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 303 +#define GENERATED_ATTRIBUTE_COUNT 311 #define GENERATED_ATTRIBUTES \ { \ \ @@ -1791,6 +1791,12 @@ /* Endpoint: 0, Cluster: Trusted Root Certificates (server) */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ + /* Endpoint: 0, Cluster: Relative Humidity Measurement (server) */ \ + { 0x0000, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* measured value */ \ + { 0x0001, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* min measured value */ \ + { 0x0002, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* max measured value */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* cluster revision */ \ + \ /* Endpoint: 0, Cluster: Binding (server) */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ @@ -1974,6 +1980,12 @@ { 0x0002, ZAP_TYPE(INT16S), 2, 0, ZAP_SIMPLE_DEFAULT(0x8000) }, /* max measured value */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* cluster revision */ \ \ + /* Endpoint: 1, Cluster: Relative Humidity Measurement (server) */ \ + { 0x0000, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* measured value */ \ + { 0x0001, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* min measured value */ \ + { 0x0002, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* max measured value */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* cluster revision */ \ + \ /* Endpoint: 1, Cluster: IAS Zone (server) */ \ { 0x0000, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* zone state */ \ { 0x0001, ZAP_TYPE(ENUM16), 2, 0, ZAP_EMPTY_DEFAULT() }, /* zone type */ \ @@ -2113,7 +2125,7 @@ }; #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask -#define GENERATED_CLUSTER_COUNT 48 +#define GENERATED_CLUSTER_COUNT 50 #define GENERATED_CLUSTERS \ { \ { \ @@ -2153,143 +2165,149 @@ 0x003F, ZAP_ATTRIBUTE_INDEX(107), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: Trusted Root Certificates (server) */ \ { \ - 0xF000, ZAP_ATTRIBUTE_INDEX(108), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0405, ZAP_ATTRIBUTE_INDEX(108), 4, 8, ZAP_CLUSTER_MASK(SERVER), NULL \ + }, /* Endpoint: 0, Cluster: Relative Humidity Measurement (server) */ \ + { \ + 0xF000, ZAP_ATTRIBUTE_INDEX(112), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: Binding (server) */ \ { \ - 0xF004, ZAP_ATTRIBUTE_INDEX(109), 3, 510, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0xF004, ZAP_ATTRIBUTE_INDEX(113), 3, 510, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: Group Key Management (server) */ \ { 0x0003, \ - ZAP_ATTRIBUTE_INDEX(112), \ + ZAP_ATTRIBUTE_INDEX(116), \ 2, \ 4, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ chipFuncArrayIdentifyServer }, /* Endpoint: 1, Cluster: Identify (server) */ \ { 0x0004, \ - ZAP_ATTRIBUTE_INDEX(114), \ + ZAP_ATTRIBUTE_INDEX(118), \ 2, \ 3, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayGroupsServer }, /* Endpoint: 1, Cluster: Groups (server) */ \ { 0x0005, \ - ZAP_ATTRIBUTE_INDEX(116), \ + ZAP_ATTRIBUTE_INDEX(120), \ 6, \ 8, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayScenesServer }, /* Endpoint: 1, Cluster: Scenes (server) */ \ { 0x0006, \ - ZAP_ATTRIBUTE_INDEX(122), \ + ZAP_ATTRIBUTE_INDEX(126), \ 2, \ 3, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayOnOffServer }, /* Endpoint: 1, Cluster: On/off (server) */ \ { 0x0008, \ - ZAP_ATTRIBUTE_INDEX(124), \ + ZAP_ATTRIBUTE_INDEX(128), \ 2, \ 3, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayLevelControlServer }, /* Endpoint: 1, Cluster: Level Control (server) */ \ { \ - 0x001D, ZAP_ATTRIBUTE_INDEX(126), 5, 1018, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x001D, ZAP_ATTRIBUTE_INDEX(130), 5, 1018, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Descriptor (server) */ \ { \ - 0x0029, ZAP_ATTRIBUTE_INDEX(131), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0029, ZAP_ATTRIBUTE_INDEX(135), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: OTA Software Update Server (server) */ \ { \ - 0x002A, ZAP_ATTRIBUTE_INDEX(132), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x002A, ZAP_ATTRIBUTE_INDEX(136), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: OTA Software Update Client (server) */ \ { \ - 0x0039, ZAP_ATTRIBUTE_INDEX(133), 15, 855, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0039, ZAP_ATTRIBUTE_INDEX(137), 15, 855, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Bridged Device Basic (server) */ \ { \ - 0x003B, ZAP_ATTRIBUTE_INDEX(148), 3, 4, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x003B, ZAP_ATTRIBUTE_INDEX(152), 3, 4, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Switch (server) */ \ { \ - 0x0040, ZAP_ATTRIBUTE_INDEX(151), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0040, ZAP_ATTRIBUTE_INDEX(155), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Fixed Label (server) */ \ { 0x0101, \ - ZAP_ATTRIBUTE_INDEX(153), \ + ZAP_ATTRIBUTE_INDEX(157), \ 4, \ 5, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ chipFuncArrayDoorLockServer }, /* Endpoint: 1, Cluster: Door Lock (server) */ \ { \ - 0x0102, ZAP_ATTRIBUTE_INDEX(157), 10, 17, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0102, ZAP_ATTRIBUTE_INDEX(161), 10, 17, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Window Covering (server) */ \ { \ - 0x0103, ZAP_ATTRIBUTE_INDEX(167), 5, 7, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0103, ZAP_ATTRIBUTE_INDEX(171), 5, 7, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Barrier Control (server) */ \ { \ - 0x0200, ZAP_ATTRIBUTE_INDEX(172), 8, 13, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0200, ZAP_ATTRIBUTE_INDEX(176), 8, 13, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Pump Configuration and Control (server) */ \ { \ - 0x0201, ZAP_ATTRIBUTE_INDEX(180), 6, 10, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0201, ZAP_ATTRIBUTE_INDEX(184), 6, 10, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Thermostat (server) */ \ { 0x0300, \ - ZAP_ATTRIBUTE_INDEX(186), \ + ZAP_ATTRIBUTE_INDEX(190), \ 51, \ 336, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayColorControlServer }, /* Endpoint: 1, Cluster: Color Control (server) */ \ { \ - 0x0402, ZAP_ATTRIBUTE_INDEX(237), 4, 8, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0402, ZAP_ATTRIBUTE_INDEX(241), 4, 8, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Temperature Measurement (server) */ \ + { \ + 0x0405, ZAP_ATTRIBUTE_INDEX(245), 4, 8, ZAP_CLUSTER_MASK(SERVER), NULL \ + }, /* Endpoint: 1, Cluster: Relative Humidity Measurement (server) */ \ { 0x0500, \ - ZAP_ATTRIBUTE_INDEX(241), \ + ZAP_ATTRIBUTE_INDEX(249), \ 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) */ \ { \ - 0x0503, ZAP_ATTRIBUTE_INDEX(247), 2, 34, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0503, ZAP_ATTRIBUTE_INDEX(255), 2, 34, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Wake on LAN (server) */ \ { \ - 0x0504, ZAP_ATTRIBUTE_INDEX(249), 4, 320, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0504, ZAP_ATTRIBUTE_INDEX(257), 4, 320, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: TV Channel (server) */ \ { \ - 0x0505, ZAP_ATTRIBUTE_INDEX(253), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0505, ZAP_ATTRIBUTE_INDEX(261), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Target Navigator (server) */ \ { \ - 0x0506, ZAP_ATTRIBUTE_INDEX(255), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0506, ZAP_ATTRIBUTE_INDEX(263), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Media Playback (server) */ \ { \ - 0x0507, ZAP_ATTRIBUTE_INDEX(256), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0507, ZAP_ATTRIBUTE_INDEX(264), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Media Input (server) */ \ { \ - 0x0508, ZAP_ATTRIBUTE_INDEX(258), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0508, ZAP_ATTRIBUTE_INDEX(266), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Low Power (server) */ \ { \ - 0x0509, ZAP_ATTRIBUTE_INDEX(259), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0509, ZAP_ATTRIBUTE_INDEX(267), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Keypad Input (server) */ \ { \ - 0x050A, ZAP_ATTRIBUTE_INDEX(260), 3, 510, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050A, ZAP_ATTRIBUTE_INDEX(268), 3, 510, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Content Launch (server) */ \ { \ - 0x050B, ZAP_ATTRIBUTE_INDEX(263), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050B, ZAP_ATTRIBUTE_INDEX(271), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Audio Output (server) */ \ { \ - 0x050C, ZAP_ATTRIBUTE_INDEX(265), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050C, ZAP_ATTRIBUTE_INDEX(273), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Application Launcher (server) */ \ { \ - 0x050D, ZAP_ATTRIBUTE_INDEX(267), 8, 105, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050D, ZAP_ATTRIBUTE_INDEX(275), 8, 105, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Application Basic (server) */ \ { \ - 0x050E, ZAP_ATTRIBUTE_INDEX(275), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050E, ZAP_ATTRIBUTE_INDEX(283), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Account Login (server) */ \ { \ - 0x050F, ZAP_ATTRIBUTE_INDEX(276), 20, 579, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050F, ZAP_ATTRIBUTE_INDEX(284), 20, 579, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Test Cluster (server) */ \ { \ - 0xF000, ZAP_ATTRIBUTE_INDEX(296), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0xF000, ZAP_ATTRIBUTE_INDEX(304), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Binding (server) */ \ { 0x0006, \ - ZAP_ATTRIBUTE_INDEX(297), \ + ZAP_ATTRIBUTE_INDEX(305), \ 2, \ 3, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayOnOffServer }, /* Endpoint: 2, Cluster: On/off (server) */ \ { 0x0406, \ - ZAP_ATTRIBUTE_INDEX(299), \ + ZAP_ATTRIBUTE_INDEX(307), \ 4, \ 5, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -2301,7 +2319,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 13, 3736 }, { ZAP_CLUSTER_INDEX(13), 33, 5152 }, { ZAP_CLUSTER_INDEX(46), 2, 8 }, \ + { ZAP_CLUSTER_INDEX(0), 14, 3744 }, { ZAP_CLUSTER_INDEX(14), 34, 5160 }, { ZAP_CLUSTER_INDEX(48), 2, 8 }, \ } // Largest attribute size is needed for various buffers @@ -2311,7 +2329,7 @@ #define ATTRIBUTE_SINGLETONS_SIZE (1730) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (8896) +#define ATTRIBUTE_MAX_SIZE (8912) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (3) @@ -2658,17 +2676,22 @@ #define ZAP_REPORT_DIRECTION(x) ZRD(x) // User options for plugin Reporting -#define EMBER_AF_PLUGIN_REPORTING_TABLE_SIZE (14) +#define EMBER_AF_PLUGIN_REPORTING_TABLE_SIZE (16) #define EMBER_AF_PLUGIN_REPORTING_ENABLE_GROUP_BOUND_REPORTS -#define EMBER_AF_GENERATED_REPORTING_CONFIG_DEFAULTS_TABLE_SIZE (14) +#define EMBER_AF_GENERATED_REPORTING_CONFIG_DEFAULTS_TABLE_SIZE (16) #define EMBER_AF_GENERATED_REPORTING_CONFIG_DEFAULTS \ { \ \ - /* Endpoint: 1, Cluster: On/off (server) */ \ + /* Endpoint: 0, Cluster: Relative Humidity Measurement (server) */ \ { \ - ZAP_REPORT_DIRECTION(REPORTED), 0x0001, 0x0006, 0x0000, ZAP_CLUSTER_MASK(SERVER), 0x0000, { { 0, 65344, 0 } } \ - }, /* on/off */ \ + ZAP_REPORT_DIRECTION(REPORTED), 0x0000, 0x0405, 0x0000, ZAP_CLUSTER_MASK(SERVER), 0x0000, { { 0, 65344, 0 } } \ + }, /* measured value */ \ + \ + /* Endpoint: 1, Cluster: On/off (server) */ \ + { \ + ZAP_REPORT_DIRECTION(REPORTED), 0x0001, 0x0006, 0x0000, ZAP_CLUSTER_MASK(SERVER), 0x0000, { { 0, 65344, 0 } } \ + }, /* on/off */ \ \ /* Endpoint: 1, Cluster: Level Control (server) */ \ { \ @@ -2717,6 +2740,11 @@ ZAP_REPORT_DIRECTION(REPORTED), 0x0001, 0x0402, 0x0000, ZAP_CLUSTER_MASK(SERVER), 0x0000, { { 0, 65344, 0 } } \ }, /* measured value */ \ \ + /* Endpoint: 1, Cluster: Relative Humidity Measurement (server) */ \ + { \ + ZAP_REPORT_DIRECTION(REPORTED), 0x0001, 0x0405, 0x0000, ZAP_CLUSTER_MASK(SERVER), 0x0000, { { 0, 65344, 0 } } \ + }, /* measured value */ \ + \ /* Endpoint: 2, Cluster: On/off (server) */ \ { \ ZAP_REPORT_DIRECTION(REPORTED), 0x0002, 0x0006, 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 bc61d015d9bff1..5a0dd41e1db78c 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 @@ -61,6 +61,7 @@ #define EMBER_AF_ON_OFF_CLUSTER_SERVER_ENDPOINT_COUNT (2) #define EMBER_AF_OPERATIONAL_CREDENTIALS_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_PUMP_CONFIG_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_SERVER_ENDPOINT_COUNT (2) #define EMBER_AF_SCENES_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_SOFTWARE_DIAGNOSTICS_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_SWITCH_CLUSTER_SERVER_ENDPOINT_COUNT (1) @@ -247,6 +248,11 @@ #define EMBER_AF_PLUGIN_PUMP_CONFIGURATION_AND_CONTROL_SERVER #define EMBER_AF_PLUGIN_PUMP_CONFIGURATION_AND_CONTROL +// Use this macro to check if the server side of the Relative Humidity Measurement cluster is included +#define ZCL_USING_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_RELATIVE_HUMIDITY_MEASUREMENT_SERVER +#define EMBER_AF_PLUGIN_RELATIVE_HUMIDITY_MEASUREMENT + // Use this macro to check if the server side of the Scenes cluster is included #define ZCL_USING_SCENES_CLUSTER_SERVER #define EMBER_AF_PLUGIN_SCENES_SERVER diff --git a/examples/all-clusters-app/esp32/main/CMakeLists.txt b/examples/all-clusters-app/esp32/main/CMakeLists.txt index 6cee6647f4e8e2..847b61bf2be92e 100644 --- a/examples/all-clusters-app/esp32/main/CMakeLists.txt +++ b/examples/all-clusters-app/esp32/main/CMakeLists.txt @@ -51,6 +51,7 @@ idf_component_register(PRIV_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/door-lock-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/occupancy-sensor-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ias-zone-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/relative-humidity-measurement-server" #${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ias-zone-client PRIV_REQUIRES chip QRCode tft spidriver bt screen-framework) diff --git a/examples/all-clusters-app/esp32/main/component.mk b/examples/all-clusters-app/esp32/main/component.mk index bacfb33784819b..2224513b02b4f7 100644 --- a/examples/all-clusters-app/esp32/main/component.mk +++ b/examples/all-clusters-app/esp32/main/component.mk @@ -58,6 +58,7 @@ COMPONENT_SRCDIRS := ../third_party/connectedhomeip/src/app/clusters/door-lock-server \ ../third_party/connectedhomeip/src/app/clusters/occupancy-sensor-server \ ../third_party/connectedhomeip/src/app/clusters/ias-zone-server \ + ../third_party/connectedhomeip/src/app/clusters/relative-humidity-measurement-server \ # ../third_party/connectedhomeip/src/app/clusters/ias-zone-client \ diff --git a/examples/chip-tool/commands/clusters/Commands.h b/examples/chip-tool/commands/clusters/Commands.h index cbb53ce6cb5419..b8dc4a87255e5d 100644 --- a/examples/chip-tool/commands/clusters/Commands.h +++ b/examples/chip-tool/commands/clusters/Commands.h @@ -991,6 +991,7 @@ static void OnTestClusterListStructOctetStringListAttributeResponse(void * conte | OnOff | 0x0006 | | OperationalCredentials | 0x003E | | PumpConfigurationAndControl | 0x0200 | +| RelativeHumidityMeasurement | 0x0405 | | Scenes | 0x0005 | | SoftwareDiagnostics | 0x0034 | | Switch | 0x003B | @@ -1032,6 +1033,7 @@ constexpr chip::ClusterId kNetworkCommissioningClusterId = 0x0031; constexpr chip::ClusterId kOnOffClusterId = 0x0006; constexpr chip::ClusterId kOperationalCredentialsClusterId = 0x003E; constexpr chip::ClusterId kPumpConfigurationAndControlClusterId = 0x0200; +constexpr chip::ClusterId kRelativeHumidityMeasurementClusterId = 0x0405; constexpr chip::ClusterId kScenesClusterId = 0x0005; constexpr chip::ClusterId kSoftwareDiagnosticsClusterId = 0x0034; constexpr chip::ClusterId kSwitchClusterId = 0x003B; @@ -12558,6 +12560,232 @@ class ReadPumpConfigurationAndControlClusterRevision : public ModelCommand new chip::Callback::Callback(OnDefaultFailureResponse, this); }; +/*----------------------------------------------------------------------------*\ +| Cluster RelativeHumidityMeasurement | 0x0405 | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * MeasuredValue | 0x0000 | +| * MinMeasuredValue | 0x0001 | +| * MaxMeasuredValue | 0x0002 | +| * ClusterRevision | 0xFFFD | +\*----------------------------------------------------------------------------*/ + +/* + * Discover Attributes + */ +class DiscoverRelativeHumidityMeasurementAttributes : public ModelCommand +{ +public: + DiscoverRelativeHumidityMeasurementAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); } + + ~DiscoverRelativeHumidityMeasurementAttributes() + { + 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::RelativeHumidityMeasurementCluster 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 MeasuredValue + */ +class ReadRelativeHumidityMeasurementMeasuredValue : public ModelCommand +{ +public: + ReadRelativeHumidityMeasurementMeasuredValue() : ModelCommand("read") + { + AddArgument("attr-name", "measured-value"); + ModelCommand::AddArguments(); + } + + ~ReadRelativeHumidityMeasurementMeasuredValue() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0405) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::RelativeHumidityMeasurementCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributeMeasuredValue(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); +}; + +class ReportRelativeHumidityMeasurementMeasuredValue : public ModelCommand +{ +public: + ReportRelativeHumidityMeasurementMeasuredValue() : ModelCommand("report") + { + AddArgument("attr-name", "measured-value"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("change", 0, UINT16_MAX, &mChange); + ModelCommand::AddArguments(); + } + + ~ReportRelativeHumidityMeasurementMeasuredValue() + { + delete onSuccessCallback; + delete onFailureCallback; + delete onReportCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0405) command (0x06) on endpoint %" PRIu16, endpointId); + + chip::Controller::RelativeHumidityMeasurementCluster cluster; + cluster.Associate(device, endpointId); + + CHIP_ERROR err = cluster.ReportAttributeMeasuredValue(onReportCallback->Cancel()); + if (err != CHIP_NO_ERROR) + { + return err; + } + + return cluster.ConfigureAttributeMeasuredValue(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(OnInt16uAttributeResponse, this); + uint16_t mMinInterval; + uint16_t mMaxInterval; + uint16_t mChange; +}; + +/* + * Attribute MinMeasuredValue + */ +class ReadRelativeHumidityMeasurementMinMeasuredValue : public ModelCommand +{ +public: + ReadRelativeHumidityMeasurementMinMeasuredValue() : ModelCommand("read") + { + AddArgument("attr-name", "min-measured-value"); + ModelCommand::AddArguments(); + } + + ~ReadRelativeHumidityMeasurementMinMeasuredValue() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0405) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::RelativeHumidityMeasurementCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributeMinMeasuredValue(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); +}; + +/* + * Attribute MaxMeasuredValue + */ +class ReadRelativeHumidityMeasurementMaxMeasuredValue : public ModelCommand +{ +public: + ReadRelativeHumidityMeasurementMaxMeasuredValue() : ModelCommand("read") + { + AddArgument("attr-name", "max-measured-value"); + ModelCommand::AddArguments(); + } + + ~ReadRelativeHumidityMeasurementMaxMeasuredValue() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0405) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::RelativeHumidityMeasurementCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributeMaxMeasuredValue(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); +}; + +/* + * Attribute ClusterRevision + */ +class ReadRelativeHumidityMeasurementClusterRevision : public ModelCommand +{ +public: + ReadRelativeHumidityMeasurementClusterRevision() : ModelCommand("read") + { + AddArgument("attr-name", "cluster-revision"); + ModelCommand::AddArguments(); + } + + ~ReadRelativeHumidityMeasurementClusterRevision() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0405) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::RelativeHumidityMeasurementCluster 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 Scenes | 0x0005 | |------------------------------------------------------------------------------| @@ -17653,6 +17881,21 @@ void registerClusterPumpConfigurationAndControl(Commands & commands) commands.Register(clusterName, clusterCommands); } +void registerClusterRelativeHumidityMeasurement(Commands & commands) +{ + const char * clusterName = "RelativeHumidityMeasurement"; + + commands_list clusterCommands = { + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + }; + + commands.Register(clusterName, clusterCommands); +} void registerClusterScenes(Commands & commands) { const char * clusterName = "Scenes"; @@ -17893,6 +18136,7 @@ void registerClusters(Commands & commands) registerClusterOnOff(commands); registerClusterOperationalCredentials(commands); registerClusterPumpConfigurationAndControl(commands); + registerClusterRelativeHumidityMeasurement(commands); registerClusterScenes(commands); registerClusterSoftwareDiagnostics(commands); registerClusterSwitch(commands); diff --git a/examples/chip-tool/commands/reporting/Commands.h b/examples/chip-tool/commands/reporting/Commands.h index bcbe0171e4e0eb..d6d83763c31551 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 onReportRelativeHumidityMeasurementMeasuredValueCallback; delete onReportSwitchCurrentPositionCallback; delete onReportTemperatureMeasurementMeasuredValueCallback; delete onReportThermostatLocalTemperatureCallback; @@ -68,6 +69,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, 0x0405, 0x0000, + onReportRelativeHumidityMeasurementMeasuredValueCallback->Cancel()); callbacksMgr.AddReportCallback(chip::kTestDeviceNodeId, endpointId, 0x003B, 0x0001, onReportSwitchCurrentPositionCallback->Cancel()); callbacksMgr.AddReportCallback(chip::kTestDeviceNodeId, endpointId, 0x0402, 0x0000, @@ -135,6 +138,8 @@ class Listen : public ReportingCommand new chip::Callback::Callback(OnBooleanAttributeResponse, this); chip::Callback::Callback * onReportPumpConfigurationAndControlCapacityCallback = new chip::Callback::Callback(OnInt16sAttributeResponse, this); + chip::Callback::Callback * onReportRelativeHumidityMeasurementMeasuredValueCallback = + new chip::Callback::Callback(OnInt16uAttributeResponse, this); chip::Callback::Callback * onReportSwitchCurrentPositionCallback = new chip::Callback::Callback(OnInt8uAttributeResponse, this); chip::Callback::Callback * onReportTemperatureMeasurementMeasuredValueCallback = diff --git a/src/app/clusters/relative-humidity-measurement-server/relative-humidity-measurement-server.cpp b/src/app/clusters/relative-humidity-measurement-server/relative-humidity-measurement-server.cpp new file mode 100644 index 00000000000000..847b6787ce7e4a --- /dev/null +++ b/src/app/clusters/relative-humidity-measurement-server/relative-humidity-measurement-server.cpp @@ -0,0 +1,76 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "relative-humidity-measurement-server.h" + +#include + +#include +#include +#include +#include +#include + +#include + +#ifndef emberAfRelativeHumidityMeasurementClusterPrintln +#define emberAfRelativeHumidityMeasurementClusterPrintln(...) ChipLogProgress(Zcl, __VA_ARGS__); +#endif + +EmberAfStatus emberAfRelativeHumidityMeasurementClusterGetMeasuredValue(chip::EndpointId endpoint, uint16_t * measuredValue) +{ + return emberAfReadServerAttribute(endpoint, ZCL_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_ID, + ZCL_RELATIVE_HUMIDITY_MEASURED_VALUE_ATTRIBUTE_ID, (uint8_t *) measuredValue, + sizeof(*measuredValue)); +} + +EmberAfStatus emberAfRelativeHumidityMeasurementClusterGetMinMeasuredValue(chip::EndpointId endpoint, uint16_t * minMeasuredValue) +{ + return emberAfReadServerAttribute(endpoint, ZCL_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_ID, + ZCL_RELATIVE_HUMIDITY_MIN_MEASURED_VALUE_ATTRIBUTE_ID, (uint8_t *) minMeasuredValue, + sizeof(*minMeasuredValue)); +} + +EmberAfStatus emberAfRelativeHumidityMeasurementClusterGetMaxMeasuredValue(chip::EndpointId endpoint, uint16_t * maxMeasuredValue) +{ + return emberAfReadServerAttribute(endpoint, ZCL_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_ID, + ZCL_RELATIVE_HUMIDITY_MAX_MEASURED_VALUE_ATTRIBUTE_ID, (uint8_t *) maxMeasuredValue, + sizeof(*maxMeasuredValue)); +} + +EmberAfStatus emberAfRelativeHumidityMeasurementClusterSetMeasuredValueCallback(chip::EndpointId endpoint, uint16_t measuredValue) +{ + return emberAfWriteServerAttribute(endpoint, ZCL_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_ID, + ZCL_RELATIVE_HUMIDITY_MEASURED_VALUE_ATTRIBUTE_ID, (uint8_t *) &measuredValue, + ZCL_INT16U_ATTRIBUTE_TYPE); +} + +EmberAfStatus emberAfRelativeHumidityMeasurementClusterSetMinMeasuredValueCallback(chip::EndpointId endpoint, + uint16_t minMeasuredValue) +{ + return emberAfWriteServerAttribute(endpoint, ZCL_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_ID, + ZCL_RELATIVE_HUMIDITY_MIN_MEASURED_VALUE_ATTRIBUTE_ID, (uint8_t *) &minMeasuredValue, + ZCL_INT16U_ATTRIBUTE_TYPE); +} + +EmberAfStatus emberAfRelativeHumidityMeasurementClusterSetMaxMeasuredValueCallback(chip::EndpointId endpoint, + uint16_t maxMeasuredValue) +{ + return emberAfWriteServerAttribute(endpoint, ZCL_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_ID, + ZCL_RELATIVE_HUMIDITY_MAX_MEASURED_VALUE_ATTRIBUTE_ID, (uint8_t *) &maxMeasuredValue, + ZCL_INT16U_ATTRIBUTE_TYPE); +} diff --git a/src/app/clusters/relative-humidity-measurement-server/relative-humidity-measurement-server.h b/src/app/clusters/relative-humidity-measurement-server/relative-humidity-measurement-server.h new file mode 100644 index 00000000000000..057ddeb7de4189 --- /dev/null +++ b/src/app/clusters/relative-humidity-measurement-server/relative-humidity-measurement-server.h @@ -0,0 +1,30 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +EmberAfStatus emberAfRelativeHumidityMeasurementClusterSetMeasuredValueCallback(chip::EndpointId endpoint, uint16_t measuredValue); +EmberAfStatus emberAfRelativeHumidityMeasurementClusterSetMinMeasuredValueCallback(chip::EndpointId endpoint, + uint16_t minMeasuredValue); +EmberAfStatus emberAfRelativeHumidityMeasurementClusterSetMaxMeasuredValueCallback(chip::EndpointId endpoint, + uint16_t maxMeasuredValue); + +EmberAfStatus emberAfRelativeHumidityMeasurementClusterGetMeasuredValue(chip::EndpointId endpoint, uint16_t * measuredValue); +EmberAfStatus emberAfRelativeHumidityMeasurementClusterGetMinMeasuredValue(chip::EndpointId endpoint, uint16_t * minMeasuredValue); +EmberAfStatus emberAfRelativeHumidityMeasurementClusterGetMaxMeasuredValue(chip::EndpointId endpoint, uint16_t * maxMeasuredValue); diff --git a/src/app/zap_cluster_list.py b/src/app/zap_cluster_list.py index 612cffa022b266..dc2ce3a5439031 100755 --- a/src/app/zap_cluster_list.py +++ b/src/app/zap_cluster_list.py @@ -46,6 +46,7 @@ 'OTA_CLIENT_CLUSTER': [], 'POWER_CONFIG_CLUSTER': [], 'PUMP_CONFIG_CONTROL_CLUSTER': ['pump-configuration-and-control-server'], + 'RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER': ['relative-humidity-measurement-server'], 'SCENES_CLUSTER': ['scenes'], 'SOFTWARE_DIAGNOSTICS_CLUSTER': [], 'SWITCH_CLUSTER': [], @@ -101,6 +102,7 @@ 'OTA_CLIENT_CLUSTER': [], 'POWER_CONFIG_CLUSTER': [], 'PUMP_CONFIG_CONTROL_CLUSTER': ['pump-configuration-and-control-client'], + 'RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER': [], 'SCENES_CLUSTER': [], 'SOFTWARE_DIAGNOSTICS_CLUSTER': [], 'SWITCH_CLUSTER': [], diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap index ff0bf81a248349..5fb4d5af9d2991 100644 --- a/src/controller/data_model/controller-clusters.zap +++ b/src/controller/data_model/controller-clusters.zap @@ -5118,6 +5118,118 @@ } ] }, + { + "name": "Relative Humidity Measurement", + "code": 1029, + "mfgCode": null, + "define": "RELATIVE_HUMIDITY_MEASUREMENT_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": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Relative Humidity Measurement", + "code": 1029, + "mfgCode": null, + "define": "RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "measured value", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "min measured value", + "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 measured value", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "tolerance", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "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": "2", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, { "name": "IAS Zone", "code": 1280, diff --git a/src/controller/data_model/gen/CHIPClusters.cpp b/src/controller/data_model/gen/CHIPClusters.cpp index 4687935a8aaf4f..e98f78e4cbfc2f 100644 --- a/src/controller/data_model/gen/CHIPClusters.cpp +++ b/src/controller/data_model/gen/CHIPClusters.cpp @@ -6326,6 +6326,67 @@ CHIP_ERROR PumpConfigurationAndControlCluster::ReadAttributeClusterRevision(Call return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); } +// RelativeHumidityMeasurement Cluster Commands +// RelativeHumidityMeasurement Cluster Attributes +CHIP_ERROR RelativeHumidityMeasurementCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeRelativeHumidityMeasurementClusterDiscoverAttributes(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} +CHIP_ERROR RelativeHumidityMeasurementCluster::ReadAttributeMeasuredValue(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodeRelativeHumidityMeasurementClusterReadMeasuredValueAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR RelativeHumidityMeasurementCluster::ConfigureAttributeMeasuredValue(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, + uint16_t minInterval, uint16_t maxInterval, + uint16_t change) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeRelativeHumidityMeasurementClusterConfigureMeasuredValueAttribute( + seqNum, mEndpoint, minInterval, maxInterval, change); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR RelativeHumidityMeasurementCluster::ReportAttributeMeasuredValue(Callback::Cancelable * onReportCallback) +{ + return RequestAttributeReporting(0x0000, onReportCallback); +} + +CHIP_ERROR RelativeHumidityMeasurementCluster::ReadAttributeMinMeasuredValue(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodeRelativeHumidityMeasurementClusterReadMinMeasuredValueAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR RelativeHumidityMeasurementCluster::ReadAttributeMaxMeasuredValue(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodeRelativeHumidityMeasurementClusterReadMaxMeasuredValueAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR RelativeHumidityMeasurementCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = + encodeRelativeHumidityMeasurementClusterReadClusterRevisionAttribute(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, diff --git a/src/controller/data_model/gen/CHIPClusters.h b/src/controller/data_model/gen/CHIPClusters.h index ada2620ded7b2c..4e817983958556 100644 --- a/src/controller/data_model/gen/CHIPClusters.h +++ b/src/controller/data_model/gen/CHIPClusters.h @@ -55,6 +55,7 @@ constexpr ClusterId kNetworkCommissioningClusterId = 0x0031; constexpr ClusterId kOnOffClusterId = 0x0006; constexpr ClusterId kOperationalCredentialsClusterId = 0x003E; constexpr ClusterId kPumpConfigurationAndControlClusterId = 0x0200; +constexpr ClusterId kRelativeHumidityMeasurementClusterId = 0x0405; constexpr ClusterId kScenesClusterId = 0x0005; constexpr ClusterId kSoftwareDiagnosticsClusterId = 0x0034; constexpr ClusterId kSwitchClusterId = 0x003B; @@ -951,6 +952,23 @@ class DLL_EXPORT PumpConfigurationAndControlCluster : public ClusterBase CHIP_ERROR ReportAttributeCapacity(Callback::Cancelable * onReportCallback); }; +class DLL_EXPORT RelativeHumidityMeasurementCluster : public ClusterBase +{ +public: + RelativeHumidityMeasurementCluster() : ClusterBase(kRelativeHumidityMeasurementClusterId) {} + ~RelativeHumidityMeasurementCluster() {} + + // Cluster Attributes + CHIP_ERROR DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeMeasuredValue(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeMinMeasuredValue(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeMaxMeasuredValue(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ConfigureAttributeMeasuredValue(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t minInterval, uint16_t maxInterval, uint16_t change); + CHIP_ERROR ReportAttributeMeasuredValue(Callback::Cancelable * onReportCallback); +}; + class DLL_EXPORT ScenesCluster : public ClusterBase { public: diff --git a/src/controller/data_model/gen/call-command-handler.cpp b/src/controller/data_model/gen/call-command-handler.cpp index adbb2685e8ab19..2a18b911128bd3 100644 --- a/src/controller/data_model/gen/call-command-handler.cpp +++ b/src/controller/data_model/gen/call-command-handler.cpp @@ -56,6 +56,7 @@ EmberAfStatus emberAfNetworkCommissioningClusterClientCommandParse(EmberAfCluste EmberAfStatus emberAfOnOffClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfOperationalCredentialsClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfPumpConfigurationAndControlClusterClientCommandParse(EmberAfClusterCommand * cmd); +EmberAfStatus emberAfRelativeHumidityMeasurementClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfScenesClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfSoftwareDiagnosticsClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfSwitchClusterClientCommandParse(EmberAfClusterCommand * cmd); @@ -198,6 +199,10 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd) // No commands are enabled for cluster Pump Configuration and Control result = status(false, true, cmd->mfgSpecific); break; + case ZCL_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_ID: + // No commands are enabled for cluster Relative Humidity Measurement + result = status(false, true, cmd->mfgSpecific); + break; case ZCL_SCENES_CLUSTER_ID: result = emberAfScenesClusterClientCommandParse(cmd); break; diff --git a/src/controller/data_model/gen/callback-stub.cpp b/src/controller/data_model/gen/callback-stub.cpp index 58d58c62d107d3..5380678e5dbe18 100644 --- a/src/controller/data_model/gen/callback-stub.cpp +++ b/src/controller/data_model/gen/callback-stub.cpp @@ -113,6 +113,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case ZCL_PUMP_CONFIG_CONTROL_CLUSTER_ID: emberAfPumpConfigurationAndControlClusterInitCallback(endpoint); break; + case ZCL_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_ID: + emberAfRelativeHumidityMeasurementClusterInitCallback(endpoint); + break; case ZCL_SCENES_CLUSTER_ID: emberAfScenesClusterInitCallback(endpoint); break; @@ -292,6 +295,11 @@ void __attribute__((weak)) emberAfPumpConfigurationAndControlClusterInitCallback // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfRelativeHumidityMeasurementClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfScenesClusterInitCallback(EndpointId endpoint) { // To prevent warning diff --git a/src/controller/data_model/gen/callback.h b/src/controller/data_model/gen/callback.h index bf6b91512cdd0e..d5b955d625e531 100644 --- a/src/controller/data_model/gen/callback.h +++ b/src/controller/data_model/gen/callback.h @@ -264,6 +264,14 @@ void emberAfOperationalCredentialsClusterInitCallback(chip::EndpointId endpoint) */ void emberAfPumpConfigurationAndControlClusterInitCallback(chip::EndpointId endpoint); +/** @brief Relative Humidity Measurement Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfRelativeHumidityMeasurementClusterInitCallback(chip::EndpointId endpoint); + /** @brief Scenes Cluster Init * * Cluster Init @@ -2326,6 +2334,79 @@ EmberAfStatus emberAfPumpConfigurationAndControlClusterClientPreAttributeChanged */ void emberAfPumpConfigurationAndControlClusterClientTickCallback(chip::EndpointId endpoint); +// +// Relative Humidity Measurement Cluster client +// + +/** @brief Relative Humidity Measurement Cluster Client Init + * + * Client Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfRelativeHumidityMeasurementClusterClientInitCallback(chip::EndpointId endpoint); + +/** @brief Relative Humidity Measurement Cluster Client Attribute Changed + * + * Client Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + */ +void emberAfRelativeHumidityMeasurementClusterClientAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId); + +/** @brief Relative Humidity Measurement 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 emberAfRelativeHumidityMeasurementClusterClientManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + uint16_t manufacturerCode); + +/** @brief Relative Humidity Measurement Cluster Client Message Sent + * + * Client Message Sent + * + * @param type The type of message sent + * @param destination The destination 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 emberAfRelativeHumidityMeasurementClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, + EmberApsFrame * apsFrame, uint16_t msgLen, + uint8_t * message, EmberStatus status); + +/** @brief Relative Humidity Measurement 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 emberAfRelativeHumidityMeasurementClusterClientPreAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + EmberAfAttributeType attributeType, + uint16_t size, uint8_t * value); + +/** @brief Relative Humidity Measurement Cluster Client Tick + * + * client Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfRelativeHumidityMeasurementClusterClientTickCallback(chip::EndpointId endpoint); + // // Scenes Cluster client // diff --git a/src/controller/data_model/gen/chip-zcl-zpro-codec-api.h b/src/controller/data_model/gen/chip-zcl-zpro-codec-api.h index 536ed8e712e9ca..9a598fbbe12543 100644 --- a/src/controller/data_model/gen/chip-zcl-zpro-codec-api.h +++ b/src/controller/data_model/gen/chip-zcl-zpro-codec-api.h @@ -56,6 +56,7 @@ | OnOff | 0x0006 | | OperationalCredentials | 0x003E | | PumpConfigurationAndControl | 0x0200 | +| RelativeHumidityMeasurement | 0x0405 | | Scenes | 0x0005 | | SoftwareDiagnostics | 0x0034 | | Switch | 0x003B | @@ -2048,6 +2049,65 @@ encodePumpConfigurationAndControlClusterWriteOperationModeAttribute(uint8_t seqN chip::System::PacketBufferHandle encodePumpConfigurationAndControlClusterReadClusterRevisionAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); +/*----------------------------------------------------------------------------*\ +| Cluster RelativeHumidityMeasurement | 0x0405 | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * MeasuredValue | 0x0000 | +| * MinMeasuredValue | 0x0001 | +| * MaxMeasuredValue | 0x0002 | +| * ClusterRevision | 0xFFFD | +\*----------------------------------------------------------------------------*/ + +/** + * @brief + * Encode a Relative Humidity Measurement server discover command into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeRelativeHumidityMeasurementClusterDiscoverAttributes(uint8_t seqNum, + chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Relative Humidity Measurement server read command for the measured value attribute into buffer including the APS + * frame + */ +chip::System::PacketBufferHandle +encodeRelativeHumidityMeasurementClusterReadMeasuredValueAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Relative Humidity Measurement server configure report command for the measured value attribute into buffer including + * the APS frame + */ +chip::System::PacketBufferHandle encodeRelativeHumidityMeasurementClusterConfigureMeasuredValueAttribute( + uint8_t seqNum, chip::EndpointId destinationEndpoint, uint16_t minInterval, uint16_t maxInterval, uint16_t change); + +/** + * @brief + * Encode a Relative Humidity Measurement server read command for the min measured value attribute into buffer including the APS + * frame + */ +chip::System::PacketBufferHandle +encodeRelativeHumidityMeasurementClusterReadMinMeasuredValueAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Relative Humidity Measurement server read command for the max measured value attribute into buffer including the APS + * frame + */ +chip::System::PacketBufferHandle +encodeRelativeHumidityMeasurementClusterReadMaxMeasuredValueAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Relative Humidity Measurement server read command for the cluster revision attribute into buffer including the APS + * frame + */ +chip::System::PacketBufferHandle +encodeRelativeHumidityMeasurementClusterReadClusterRevisionAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); + /*----------------------------------------------------------------------------*\ | Cluster Scenes | 0x0005 | |------------------------------------------------------------------------------| diff --git a/src/controller/data_model/gen/encoder.cpp b/src/controller/data_model/gen/encoder.cpp index f53e5e506ab982..d10182363451d1 100644 --- a/src/controller/data_model/gen/encoder.cpp +++ b/src/controller/data_model/gen/encoder.cpp @@ -82,6 +82,7 @@ using namespace chip::Encoding::LittleEndian; | OnOff | 0x0006 | | OperationalCredentials | 0x003E | | PumpConfigurationAndControl | 0x0200 | +| RelativeHumidityMeasurement | 0x0405 | | Scenes | 0x0005 | | SoftwareDiagnostics | 0x0034 | | Switch | 0x003B | @@ -281,6 +282,8 @@ using namespace chip::Encoding::LittleEndian; #define PUMP_CONFIG_CONTROL_CLUSTER_ID 0x0200 +#define RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_ID 0x0405 + #define SCENES_CLUSTER_ID 0x0005 #define ZCL_ADD_SCENE_COMMAND_ID (0x00) #define ZCL_GET_SCENE_MEMBERSHIP_COMMAND_ID (0x06) @@ -3025,6 +3028,87 @@ PacketBufferHandle encodePumpConfigurationAndControlClusterReadClusterRevisionAt COMMAND_FOOTER(); } +/*----------------------------------------------------------------------------*\ +| Cluster RelativeHumidityMeasurement | 0x0405 | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * MeasuredValue | 0x0000 | +| * MinMeasuredValue | 0x0001 | +| * MaxMeasuredValue | 0x0002 | +| * ClusterRevision | 0xFFFD | +\*----------------------------------------------------------------------------*/ + +PacketBufferHandle encodeRelativeHumidityMeasurementClusterDiscoverAttributes(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("DiscoverRelativeHumidityMeasurementAttributes", RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_DISCOVER_ATTRIBUTES_COMMAND_ID).Put16(0x0000).Put8(0xFF); + COMMAND_FOOTER(); +} + +/* + * Attribute MeasuredValue + */ +PacketBufferHandle encodeRelativeHumidityMeasurementClusterReadMeasuredValueAttribute(uint8_t seqNum, + EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadRelativeHumidityMeasurementMeasuredValue", RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0000); + COMMAND_FOOTER(); +} + +PacketBufferHandle encodeRelativeHumidityMeasurementClusterConfigureMeasuredValueAttribute(uint8_t seqNum, + EndpointId destinationEndpoint, + uint16_t minInterval, + uint16_t maxInterval, uint16_t change) +{ + COMMAND_HEADER("ReportRelativeHumidityMeasurementMeasuredValue", RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand) + .Put8(seqNum) + .Put8(ZCL_CONFIGURE_REPORTING_COMMAND_ID) + .Put8(EMBER_ZCL_REPORTING_DIRECTION_REPORTED) + .Put16(0x0000) + .Put8(33) + .Put16(minInterval) + .Put16(maxInterval); + buf.Put16(static_cast(change)); + COMMAND_FOOTER(); +} + +/* + * Attribute MinMeasuredValue + */ +PacketBufferHandle encodeRelativeHumidityMeasurementClusterReadMinMeasuredValueAttribute(uint8_t seqNum, + EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadRelativeHumidityMeasurementMinMeasuredValue", RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0001); + COMMAND_FOOTER(); +} + +/* + * Attribute MaxMeasuredValue + */ +PacketBufferHandle encodeRelativeHumidityMeasurementClusterReadMaxMeasuredValueAttribute(uint8_t seqNum, + EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadRelativeHumidityMeasurementMaxMeasuredValue", RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0002); + COMMAND_FOOTER(); +} + +/* + * Attribute ClusterRevision + */ +PacketBufferHandle encodeRelativeHumidityMeasurementClusterReadClusterRevisionAttribute(uint8_t seqNum, + EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadRelativeHumidityMeasurementClusterRevision", RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0xFFFD); + COMMAND_FOOTER(); +} + /*----------------------------------------------------------------------------*\ | Cluster Scenes | 0x0005 | |------------------------------------------------------------------------------| diff --git a/src/controller/data_model/gen/endpoint_config.h b/src/controller/data_model/gen/endpoint_config.h index 3efe5c306d5116..94fae2afea240b 100644 --- a/src/controller/data_model/gen/endpoint_config.h +++ b/src/controller/data_model/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 39 +#define GENERATED_ATTRIBUTE_COUNT 40 #define GENERATED_ATTRIBUTES \ { \ \ @@ -141,6 +141,9 @@ /* Endpoint: 1, Cluster: Temperature Measurement (client) */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(3) }, /* cluster revision */ \ \ + /* Endpoint: 1, Cluster: Relative Humidity Measurement (client) */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(2) }, /* cluster revision */ \ + \ /* Endpoint: 1, Cluster: Wake on LAN (client) */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ @@ -194,7 +197,7 @@ #define GENERATED_FUNCTION_ARRAYS #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask -#define GENERATED_CLUSTER_COUNT 39 +#define GENERATED_CLUSTER_COUNT 40 #define GENERATED_CLUSTERS \ { \ { 0x0003, ZAP_ATTRIBUTE_INDEX(0), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Identify (client) */ \ @@ -258,49 +261,52 @@ 0x0402, ZAP_ATTRIBUTE_INDEX(23), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Temperature Measurement (client) */ \ { \ - 0x0503, ZAP_ATTRIBUTE_INDEX(24), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0405, ZAP_ATTRIBUTE_INDEX(24), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + }, /* Endpoint: 1, Cluster: Relative Humidity Measurement (client) */ \ + { \ + 0x0503, ZAP_ATTRIBUTE_INDEX(25), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Wake on LAN (client) */ \ { \ - 0x0504, ZAP_ATTRIBUTE_INDEX(25), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0504, ZAP_ATTRIBUTE_INDEX(26), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: TV Channel (client) */ \ { \ - 0x0505, ZAP_ATTRIBUTE_INDEX(26), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0505, ZAP_ATTRIBUTE_INDEX(27), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Target Navigator (client) */ \ { \ - 0x0506, ZAP_ATTRIBUTE_INDEX(27), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0506, ZAP_ATTRIBUTE_INDEX(28), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Media Playback (client) */ \ { \ - 0x0507, ZAP_ATTRIBUTE_INDEX(28), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0507, ZAP_ATTRIBUTE_INDEX(29), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Media Input (client) */ \ { \ - 0x0508, ZAP_ATTRIBUTE_INDEX(29), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0508, ZAP_ATTRIBUTE_INDEX(30), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Low Power (client) */ \ { \ - 0x0509, ZAP_ATTRIBUTE_INDEX(30), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0509, ZAP_ATTRIBUTE_INDEX(31), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Keypad Input (client) */ \ { \ - 0x050A, ZAP_ATTRIBUTE_INDEX(31), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x050A, ZAP_ATTRIBUTE_INDEX(32), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Content Launch (client) */ \ { \ - 0x050B, ZAP_ATTRIBUTE_INDEX(32), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x050B, ZAP_ATTRIBUTE_INDEX(33), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Audio Output (client) */ \ { \ - 0x050C, ZAP_ATTRIBUTE_INDEX(33), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x050C, ZAP_ATTRIBUTE_INDEX(34), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Application Launcher (client) */ \ { \ - 0x050D, ZAP_ATTRIBUTE_INDEX(34), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x050D, ZAP_ATTRIBUTE_INDEX(35), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Application Basic (client) */ \ { \ - 0x050E, ZAP_ATTRIBUTE_INDEX(35), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x050E, ZAP_ATTRIBUTE_INDEX(36), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Account Login (client) */ \ { \ - 0x050F, ZAP_ATTRIBUTE_INDEX(36), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x050F, ZAP_ATTRIBUTE_INDEX(37), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Test Cluster (client) */ \ { \ - 0xF000, ZAP_ATTRIBUTE_INDEX(37), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0xF000, ZAP_ATTRIBUTE_INDEX(38), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Binding (client) */ \ { \ - 0xF004, ZAP_ATTRIBUTE_INDEX(38), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0xF004, ZAP_ATTRIBUTE_INDEX(39), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Group Key Management (client) */ \ } @@ -309,7 +315,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 39, 78 }, \ + { ZAP_CLUSTER_INDEX(0), 40, 80 }, \ } // Largest attribute size is needed for various buffers @@ -319,7 +325,7 @@ #define ATTRIBUTE_SINGLETONS_SIZE (4) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (78) +#define ATTRIBUTE_MAX_SIZE (80) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (1) diff --git a/src/controller/data_model/gen/gen_config.h b/src/controller/data_model/gen/gen_config.h index 774b838af597e5..73309031c43ff2 100644 --- a/src/controller/data_model/gen/gen_config.h +++ b/src/controller/data_model/gen/gen_config.h @@ -57,6 +57,7 @@ #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_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_SCENES_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_SOFTWARE_DIAGNOSTICS_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_SWITCH_CLUSTER_CLIENT_ENDPOINT_COUNT (1) @@ -183,6 +184,10 @@ #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 Relative Humidity Measurement cluster is included +#define ZCL_USING_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_RELATIVE_HUMIDITY_MEASUREMENT_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 diff --git a/src/controller/python/chip/clusters/CHIPClusters.cpp b/src/controller/python/chip/clusters/CHIPClusters.cpp index 29106900674306..0b2e85ad54e9a2 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.cpp +++ b/src/controller/python/chip/clusters/CHIPClusters.cpp @@ -2495,6 +2495,60 @@ CHIP_ERROR chip_ime_ReadAttribute_PumpConfigurationAndControl_ClusterRevision(ch } // End of Cluster PumpConfigurationAndControl +// Cluster RelativeHumidityMeasurement + +CHIP_ERROR chip_ime_ReadAttribute_RelativeHumidityMeasurement_MeasuredValue(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::RelativeHumidityMeasurementCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMeasuredValue(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ConfigureAttribute_RelativeHumidityMeasurement_MeasuredValue(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::RelativeHumidityMeasurementCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ConfigureAttributeMeasuredValue(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel(), minInterval, + maxInterval, change); +} +CHIP_ERROR chip_ime_ReadAttribute_RelativeHumidityMeasurement_MinMeasuredValue(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::RelativeHumidityMeasurementCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMinMeasuredValue(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_RelativeHumidityMeasurement_MaxMeasuredValue(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::RelativeHumidityMeasurementCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMaxMeasuredValue(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_RelativeHumidityMeasurement_ClusterRevision(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::RelativeHumidityMeasurementCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +// End of Cluster RelativeHumidityMeasurement // Cluster Scenes CHIP_ERROR chip_ime_AppendCommand_Scenes_AddScene(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index c4f7a5d4f4723d..011ebdd1f53d22 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -517,6 +517,8 @@ def ListClusterCommands(self): }, "PumpConfigurationAndControl": { }, + "RelativeHumidityMeasurement": { + }, "Scenes": { "AddScene": { "groupId": "int", @@ -837,6 +839,12 @@ def ListClusterAttributes(self): "OperationMode", "ClusterRevision", ], + "RelativeHumidityMeasurement": [ + "MeasuredValue", + "MinMeasuredValue", + "MaxMeasuredValue", + "ClusterRevision", + ], "Scenes": [ "SceneCount", "CurrentScene", @@ -1798,6 +1806,16 @@ def ClusterPumpConfigurationAndControl_ReadAttributeOperationMode(self, device: return self._chipLib.chip_ime_ReadAttribute_PumpConfigurationAndControl_OperationMode(device, ZCLendpoint, ZCLgroupid) def ClusterPumpConfigurationAndControl_ReadAttributeClusterRevision(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): return self._chipLib.chip_ime_ReadAttribute_PumpConfigurationAndControl_ClusterRevision(device, ZCLendpoint, ZCLgroupid) + def ClusterRelativeHumidityMeasurement_ReadAttributeMeasuredValue(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_RelativeHumidityMeasurement_MeasuredValue(device, ZCLendpoint, ZCLgroupid) + def ClusterRelativeHumidityMeasurement_ConfigureAttributeMeasuredValue(self, device: ctypes.c_void_p, ZCLendpoint: int, minInterval: int, maxInterval: int, change: int): + return self._chipLib.chip_ime_ConfigureAttribute_RelativeHumidityMeasurement_MeasuredValue(device, ZCLendpoint, minInterval, maxInterval, change) + def ClusterRelativeHumidityMeasurement_ReadAttributeMinMeasuredValue(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_RelativeHumidityMeasurement_MinMeasuredValue(device, ZCLendpoint, ZCLgroupid) + def ClusterRelativeHumidityMeasurement_ReadAttributeMaxMeasuredValue(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_RelativeHumidityMeasurement_MaxMeasuredValue(device, ZCLendpoint, ZCLgroupid) + def ClusterRelativeHumidityMeasurement_ReadAttributeClusterRevision(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_RelativeHumidityMeasurement_ClusterRevision(device, ZCLendpoint, ZCLgroupid) def ClusterScenes_ReadAttributeSceneCount(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): return self._chipLib.chip_ime_ReadAttribute_Scenes_SceneCount(device, ZCLendpoint, ZCLgroupid) def ClusterScenes_ReadAttributeCurrentScene(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): @@ -2725,6 +2743,22 @@ def InitLib(self, chipLib): # Cluster PumpConfigurationAndControl ReadAttribute ClusterRevision self._chipLib.chip_ime_ReadAttribute_PumpConfigurationAndControl_ClusterRevision.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] self._chipLib.chip_ime_ReadAttribute_PumpConfigurationAndControl_ClusterRevision.restype = ctypes.c_uint32 + # Cluster RelativeHumidityMeasurement + # Cluster RelativeHumidityMeasurement ReadAttribute MeasuredValue + self._chipLib.chip_ime_ReadAttribute_RelativeHumidityMeasurement_MeasuredValue.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_RelativeHumidityMeasurement_MeasuredValue.restype = ctypes.c_uint32 + # Cluster RelativeHumidityMeasurement ConfigureAttribute MeasuredValue + self._chipLib.chip_ime_ConfigureAttribute_RelativeHumidityMeasurement_MeasuredValue.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint16, ctypes.c_uint16] + self._chipLib.chip_ime_ConfigureAttribute_RelativeHumidityMeasurement_MeasuredValue.restype = ctypes.c_uint32 + # Cluster RelativeHumidityMeasurement ReadAttribute MinMeasuredValue + self._chipLib.chip_ime_ReadAttribute_RelativeHumidityMeasurement_MinMeasuredValue.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_RelativeHumidityMeasurement_MinMeasuredValue.restype = ctypes.c_uint32 + # Cluster RelativeHumidityMeasurement ReadAttribute MaxMeasuredValue + self._chipLib.chip_ime_ReadAttribute_RelativeHumidityMeasurement_MaxMeasuredValue.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_RelativeHumidityMeasurement_MaxMeasuredValue.restype = ctypes.c_uint32 + # Cluster RelativeHumidityMeasurement ReadAttribute ClusterRevision + self._chipLib.chip_ime_ReadAttribute_RelativeHumidityMeasurement_ClusterRevision.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_RelativeHumidityMeasurement_ClusterRevision.restype = ctypes.c_uint32 # Cluster Scenes # Cluster Scenes Command AddScene self._chipLib.chip_ime_AppendCommand_Scenes_AddScene.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint16, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_char_p, ctypes.c_uint32, ctypes.c_uint16, ctypes.c_uint8, ctypes.c_uint8] diff --git a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h index 1c10e99c8189fa..7c2c2a1776fa0d 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h +++ b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h @@ -794,6 +794,24 @@ NS_ASSUME_NONNULL_BEGIN @end +/** + * Cluster Relative Humidity Measurement + * + */ +@interface CHIPRelativeHumidityMeasurement : CHIPCluster + +- (void)readAttributeMeasuredValueWithResponseHandler:(ResponseHandler)responseHandler; +- (void)configureAttributeMeasuredValueWithMinInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + change:(uint16_t)change + responseHandler:(ResponseHandler)responseHandler; +- (void)reportAttributeMeasuredValueWithResponseHandler:(ResponseHandler)responseHandler; +- (void)readAttributeMinMeasuredValueWithResponseHandler:(ResponseHandler)responseHandler; +- (void)readAttributeMaxMeasuredValueWithResponseHandler:(ResponseHandler)responseHandler; +- (void)readAttributeClusterRevisionWithResponseHandler:(ResponseHandler)responseHandler; + +@end + /** * Cluster Scenes * diff --git a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm index 97dc5d3a2737b5..664040caa7d0db 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm @@ -11960,6 +11960,177 @@ - (void)readAttributeClusterRevisionWithResponseHandler:(ResponseHandler)respons @end +@interface CHIPRelativeHumidityMeasurement () +@property (readonly) Controller::RelativeHumidityMeasurementCluster cppCluster; +@end + +@implementation CHIPRelativeHumidityMeasurement + +- (Controller::ClusterBase *)getCluster +{ + return &_cppCluster; +} + +- (void)readAttributeMeasuredValueWithResponseHandler:(ResponseHandler)responseHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(responseHandler, [self callbackQueue]); + if (!onSuccess) { + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(responseHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeMeasuredValue(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + responseHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)configureAttributeMeasuredValueWithMinInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + change:(uint16_t)change + responseHandler:(ResponseHandler)responseHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(responseHandler, [self callbackQueue]); + if (!onSuccess) { + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(responseHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ConfigureAttributeMeasuredValue( + onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + responseHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)reportAttributeMeasuredValueWithResponseHandler:(ResponseHandler)reportHandler +{ + CHIPInt16uAttributeCallbackBridge * onReport = new CHIPInt16uAttributeCallbackBridge(reportHandler, [self callbackQueue], true); + if (!onReport) { + reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReportAttributeMeasuredValue(onReport->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onReport; + reportHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeMinMeasuredValueWithResponseHandler:(ResponseHandler)responseHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(responseHandler, [self callbackQueue]); + if (!onSuccess) { + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(responseHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeMinMeasuredValue(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + responseHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeMaxMeasuredValueWithResponseHandler:(ResponseHandler)responseHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(responseHandler, [self callbackQueue]); + if (!onSuccess) { + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(responseHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeMaxMeasuredValue(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + responseHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeClusterRevisionWithResponseHandler:(ResponseHandler)responseHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(responseHandler, [self callbackQueue]); + if (!onSuccess) { + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(responseHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + responseHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +@end + @interface CHIPScenes () @property (readonly) Controller::ScenesCluster cppCluster; @end diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index debaa29befb766..dcba4914bd5689 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -3524,6 +3524,90 @@ - (void)testSendClusterPumpConfigurationAndControlReadAttributeClusterRevisionWi [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterRelativeHumidityMeasurementReadAttributeMeasuredValueWithResponseHandler +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"RelativeHumidityMeasurementReadAttributeMeasuredValueWithResponseHandler"]; + + CHIPDevice * device = GetPairedDevice(kDeviceId); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPRelativeHumidityMeasurement * cluster = [[CHIPRelativeHumidityMeasurement alloc] initWithDevice:device + endpoint:1 + queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"RelativeHumidityMeasurement MeasuredValue Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterRelativeHumidityMeasurementReadAttributeMinMeasuredValueWithResponseHandler +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"RelativeHumidityMeasurementReadAttributeMinMeasuredValueWithResponseHandler"]; + + CHIPDevice * device = GetPairedDevice(kDeviceId); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPRelativeHumidityMeasurement * cluster = [[CHIPRelativeHumidityMeasurement alloc] initWithDevice:device + endpoint:1 + queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMinMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"RelativeHumidityMeasurement MinMeasuredValue Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterRelativeHumidityMeasurementReadAttributeMaxMeasuredValueWithResponseHandler +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"RelativeHumidityMeasurementReadAttributeMaxMeasuredValueWithResponseHandler"]; + + CHIPDevice * device = GetPairedDevice(kDeviceId); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPRelativeHumidityMeasurement * cluster = [[CHIPRelativeHumidityMeasurement alloc] initWithDevice:device + endpoint:1 + queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMaxMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"RelativeHumidityMeasurement MaxMeasuredValue Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterRelativeHumidityMeasurementReadAttributeClusterRevisionWithResponseHandler +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"RelativeHumidityMeasurementReadAttributeClusterRevisionWithResponseHandler"]; + + CHIPDevice * device = GetPairedDevice(kDeviceId); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPRelativeHumidityMeasurement * cluster = [[CHIPRelativeHumidityMeasurement alloc] initWithDevice:device + endpoint:1 + queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeClusterRevisionWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"RelativeHumidityMeasurement ClusterRevision Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + - (void)testSendClusterScenesReadAttributeSceneCountWithResponseHandler { XCTestExpectation * expectation = [self expectationWithDescription:@"ScenesReadAttributeSceneCountWithResponseHandler"];