From c85d975772b2fe05766f140eb44ee3c226390910 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Sat, 19 Jun 2021 10:40:03 +0200 Subject: [PATCH] [Tests] Add tests to TestCluster.yaml for unsupported attributes, long octet string and lists. (#7741) * Update src/app/util to not use uint8_t for emAfSend and update encoder-src.zapt template to put the right size when writing an attribute * Add LONG_OCTET_STRING to TestCluster and an attribute that is not supported on the server side * Add a test for unsupported attributes and a test for LONG_OCTET_STRING * Update templates and src/app/clusters/test-cluster-server * Add an helper for c++ literal suffix * Update gen/ folders --- .../all-clusters-common/all-clusters-app.zap | 19 +- .../all-clusters-common/gen/endpoint_config.h | 132 ++- .../chip-tool/commands/clusters/Commands.h | 140 +++ examples/chip-tool/commands/tests/Commands.h | 805 +++++++++++++++- .../templates/partials/test_cluster.zapt | 19 +- .../test-cluster-server.cpp | 20 + src/app/common/gen/attribute-id.h | 2 + src/app/tests/suites/TestCluster.yaml | 73 ++ src/app/util/af-main-common.cpp | 6 +- src/app/util/af-main.h | 2 +- .../zap-templates/common/ClustersHelper.js | 2 +- .../templates/app/encoder-src.zapt | 2 +- src/app/zap-templates/templates/app/helper.js | 19 + src/app/zap-templates/zcl/test-cluster.xml | 4 + .../data_model/controller-clusters.zap | 32 +- .../data_model/gen/CHIPClusters.cpp | 32 + src/controller/data_model/gen/CHIPClusters.h | 6 + .../data_model/gen/chip-zcl-zpro-codec-api.h | 31 + src/controller/data_model/gen/encoder.cpp | 56 ++ .../python/chip/clusters/CHIPClusters.cpp | 35 + .../python/chip/clusters/CHIPClusters.py | 30 + .../Framework/CHIP/gen/CHIPClustersObjc.h | 4 + .../Framework/CHIP/gen/CHIPClustersObjc.mm | 110 +++ .../CHIP/templates/clusters-tests.zapt | 2 + .../CHIP/templates/partials/test_cluster.zapt | 13 +- .../Framework/CHIPTests/CHIPClustersTests.m | 884 ++++-------------- 26 files changed, 1719 insertions(+), 761 deletions(-) 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 f7ceee32e79b15..2be22d4d485da0 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 @@ -1,5 +1,5 @@ { - "featureLevel": 35, + "featureLevel": 39, "creator": "zap", "keyValuePairs": [ { @@ -12309,6 +12309,21 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "long_octet_string", + "code": 29, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, { "name": "cluster revision", "code": 65533, @@ -15539,4 +15554,4 @@ } ], "log": [] -} \ No newline at end of file +} 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 091cbf32fe9b95..3cce7197c61b71 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 @@ -830,6 +830,61 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 8604 - long_octet_string, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ } #else // !BIGENDIAN_CPU @@ -1639,11 +1694,66 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 8604 - long_octet_string, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ } #endif // BIGENDIAN_CPU -#define GENERATED_DEFAULTS_COUNT (115) +#define GENERATED_DEFAULTS_COUNT (116) #define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE #define ZAP_LONG_DEFAULTS_INDEX(index) \ @@ -1671,7 +1781,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 318 +#define GENERATED_ATTRIBUTE_COUNT 319 #define GENERATED_ATTRIBUTES \ { \ \ @@ -2096,7 +2206,9 @@ { 0x001A, ZAP_TYPE(ARRAY), 10, 0, ZAP_LONG_DEFAULTS_INDEX(8086) }, /* list_int8u */ \ { 0x001B, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(8096) }, /* list_octet_string */ \ { 0x001C, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(8350) }, /* list_struct_octet_string */ \ - { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ + { 0x001D, ZAP_TYPE(LONG_OCTET_STRING), 1000, ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_LONG_DEFAULTS_INDEX(8604) }, /* long_octet_string */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ /* Endpoint: 1, Cluster: Binding (server) */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ @@ -2328,19 +2440,19 @@ 0x050E, ZAP_ATTRIBUTE_INDEX(290), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Account Login (server) */ \ { \ - 0x050F, ZAP_ATTRIBUTE_INDEX(291), 20, 579, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050F, ZAP_ATTRIBUTE_INDEX(291), 21, 1579, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Test Cluster (server) */ \ { \ - 0xF000, ZAP_ATTRIBUTE_INDEX(311), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0xF000, ZAP_ATTRIBUTE_INDEX(312), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Binding (server) */ \ { 0x0006, \ - ZAP_ATTRIBUTE_INDEX(312), \ + ZAP_ATTRIBUTE_INDEX(313), \ 2, \ 3, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayOnOffServer }, /* Endpoint: 2, Cluster: On/off (server) */ \ { 0x0406, \ - ZAP_ATTRIBUTE_INDEX(314), \ + ZAP_ATTRIBUTE_INDEX(315), \ 4, \ 5, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -2352,17 +2464,17 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 14, 3761 }, { ZAP_CLUSTER_INDEX(14), 33, 5171 }, { ZAP_CLUSTER_INDEX(47), 2, 8 }, \ + { ZAP_CLUSTER_INDEX(0), 14, 3761 }, { ZAP_CLUSTER_INDEX(14), 33, 6171 }, { ZAP_CLUSTER_INDEX(47), 2, 8 }, \ } // Largest attribute size is needed for various buffers -#define ATTRIBUTE_LARGEST (255) +#define ATTRIBUTE_LARGEST (1001) // Total size of singleton attributes #define ATTRIBUTE_SINGLETONS_SIZE (1730) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (8940) +#define ATTRIBUTE_MAX_SIZE (9940) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (3) diff --git a/examples/chip-tool/commands/clusters/Commands.h b/examples/chip-tool/commands/clusters/Commands.h index 1728188699923e..22f0e0103cc916 100644 --- a/examples/chip-tool/commands/clusters/Commands.h +++ b/examples/chip-tool/commands/clusters/Commands.h @@ -15358,6 +15358,8 @@ class ReadTemperatureMeasurementClusterRevision : public ModelCommand | * ListInt8u | 0x001A | | * ListOctetString | 0x001B | | * ListStructOctetString | 0x001C | +| * LongOctetString | 0x001D | +| * Unsupported | 0x00FF | | * ClusterRevision | 0xFFFD | \*----------------------------------------------------------------------------*/ @@ -16684,6 +16686,140 @@ class ReadTestClusterListStructOctetString : public ModelCommand new chip::Callback::Callback(OnDefaultFailureResponse, this); }; +/* + * Attribute LongOctetString + */ +class ReadTestClusterLongOctetString : public ModelCommand +{ +public: + ReadTestClusterLongOctetString() : ModelCommand("read") + { + AddArgument("attr-name", "long-octet-string"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterLongOctetString() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributeLongOctetString(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnStringAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteTestClusterLongOctetString : public ModelCommand +{ +public: + WriteTestClusterLongOctetString() : ModelCommand("write") + { + AddArgument("attr-name", "long-octet-string"); + AddArgument("attr-value", &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterLongOctetString() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x01) on endpoint %" PRIu16, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttributeLongOctetString(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + chip::ByteSpan mValue; +}; + +/* + * Attribute Unsupported + */ +class ReadTestClusterUnsupported : public ModelCommand +{ +public: + ReadTestClusterUnsupported() : ModelCommand("read") + { + AddArgument("attr-name", "unsupported"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterUnsupported() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributeUnsupported(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnBooleanAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteTestClusterUnsupported : public ModelCommand +{ +public: + WriteTestClusterUnsupported() : ModelCommand("write") + { + AddArgument("attr-name", "unsupported"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterUnsupported() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x01) on endpoint %" PRIu16, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttributeUnsupported(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + uint8_t mValue; +}; + /* * Attribute ClusterRevision */ @@ -21178,6 +21314,10 @@ void registerClusterTestCluster(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), make_unique(), }; diff --git a/examples/chip-tool/commands/tests/Commands.h b/examples/chip-tool/commands/tests/Commands.h index 153da49a1b6eec..5fe89ab3b700d0 100644 --- a/examples/chip-tool/commands/tests/Commands.h +++ b/examples/chip-tool/commands/tests/Commands.h @@ -319,6 +319,33 @@ class TestCluster : public TestCommand case 91: err = TestSendClusterTestClusterCommandWriteAttribute_91(); break; + case 92: + err = TestSendClusterTestClusterCommandReadAttribute_92(); + break; + case 93: + err = TestSendClusterTestClusterCommandWriteAttribute_93(); + break; + case 94: + err = TestSendClusterTestClusterCommandReadAttribute_94(); + break; + case 95: + err = TestSendClusterTestClusterCommandWriteAttribute_95(); + break; + case 96: + err = TestSendClusterTestClusterCommandReadAttribute_96(); + break; + case 97: + err = TestSendClusterTestClusterCommandReadAttribute_97(); + break; + case 98: + err = TestSendClusterTestClusterCommandReadAttribute_98(); + break; + case 99: + err = TestSendClusterTestClusterCommandReadAttribute_99(); + break; + case 100: + err = TestSendClusterTestClusterCommandWriteAttribute_100(); + break; } if (CHIP_NO_ERROR != err) @@ -332,7 +359,7 @@ class TestCluster : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 92; + const uint16_t mTestCount = 101; // // Tests methods @@ -1354,7 +1381,7 @@ class TestCluster : public TestCommand return; } - if (bitmap16 != 0) + if (bitmap16 != 0U) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); runner->SetCommandExitStatus(false); @@ -1384,7 +1411,7 @@ class TestCluster : public TestCommand CHIP_ERROR err = CHIP_NO_ERROR; - uint16_t bitmap16Argument = 65535; + uint16_t bitmap16Argument = 65535U; err = cluster.WriteAttributeBitmap16(mOnSuccessCallback_14->Cancel(), mOnFailureCallback_14->Cancel(), bitmap16Argument); if (CHIP_NO_ERROR != err) @@ -1500,7 +1527,7 @@ class TestCluster : public TestCommand return; } - if (bitmap16 != 65535) + if (bitmap16 != 65535U) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "65535"); runner->SetCommandExitStatus(false); @@ -1530,7 +1557,7 @@ class TestCluster : public TestCommand CHIP_ERROR err = CHIP_NO_ERROR; - uint16_t bitmap16Argument = 0; + uint16_t bitmap16Argument = 0U; err = cluster.WriteAttributeBitmap16(mOnSuccessCallback_16->Cancel(), mOnFailureCallback_16->Cancel(), bitmap16Argument); if (CHIP_NO_ERROR != err) @@ -1646,7 +1673,7 @@ class TestCluster : public TestCommand return; } - if (bitmap16 != 0) + if (bitmap16 != 0U) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); runner->SetCommandExitStatus(false); @@ -1722,7 +1749,7 @@ class TestCluster : public TestCommand return; } - if (bitmap32 != 0) + if (bitmap32 != 0UL) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); runner->SetCommandExitStatus(false); @@ -1752,7 +1779,7 @@ class TestCluster : public TestCommand CHIP_ERROR err = CHIP_NO_ERROR; - uint32_t bitmap32Argument = 4294967295; + uint32_t bitmap32Argument = 4294967295UL; err = cluster.WriteAttributeBitmap32(mOnSuccessCallback_19->Cancel(), mOnFailureCallback_19->Cancel(), bitmap32Argument); if (CHIP_NO_ERROR != err) @@ -1868,7 +1895,7 @@ class TestCluster : public TestCommand return; } - if (bitmap32 != 4294967295) + if (bitmap32 != 4294967295UL) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "4294967295"); runner->SetCommandExitStatus(false); @@ -1898,7 +1925,7 @@ class TestCluster : public TestCommand CHIP_ERROR err = CHIP_NO_ERROR; - uint32_t bitmap32Argument = 0; + uint32_t bitmap32Argument = 0UL; err = cluster.WriteAttributeBitmap32(mOnSuccessCallback_21->Cancel(), mOnFailureCallback_21->Cancel(), bitmap32Argument); if (CHIP_NO_ERROR != err) @@ -2014,7 +2041,7 @@ class TestCluster : public TestCommand return; } - if (bitmap32 != 0) + if (bitmap32 != 0UL) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); runner->SetCommandExitStatus(false); @@ -2826,7 +2853,7 @@ class TestCluster : public TestCommand return; } - if (int16u != 0) + if (int16u != 0U) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); runner->SetCommandExitStatus(false); @@ -2856,7 +2883,7 @@ class TestCluster : public TestCommand CHIP_ERROR err = CHIP_NO_ERROR; - uint16_t int16uArgument = 65535; + uint16_t int16uArgument = 65535U; err = cluster.WriteAttributeInt16u(mOnSuccessCallback_34->Cancel(), mOnFailureCallback_34->Cancel(), int16uArgument); if (CHIP_NO_ERROR != err) @@ -2972,7 +2999,7 @@ class TestCluster : public TestCommand return; } - if (int16u != 65535) + if (int16u != 65535U) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "65535"); runner->SetCommandExitStatus(false); @@ -3002,7 +3029,7 @@ class TestCluster : public TestCommand CHIP_ERROR err = CHIP_NO_ERROR; - uint16_t int16uArgument = 0; + uint16_t int16uArgument = 0U; err = cluster.WriteAttributeInt16u(mOnSuccessCallback_36->Cancel(), mOnFailureCallback_36->Cancel(), int16uArgument); if (CHIP_NO_ERROR != err) @@ -3118,7 +3145,7 @@ class TestCluster : public TestCommand return; } - if (int16u != 0) + if (int16u != 0U) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); runner->SetCommandExitStatus(false); @@ -3194,7 +3221,7 @@ class TestCluster : public TestCommand return; } - if (int32u != 0) + if (int32u != 0UL) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); runner->SetCommandExitStatus(false); @@ -3224,7 +3251,7 @@ class TestCluster : public TestCommand CHIP_ERROR err = CHIP_NO_ERROR; - uint32_t int32uArgument = 4294967295; + uint32_t int32uArgument = 4294967295UL; err = cluster.WriteAttributeInt32u(mOnSuccessCallback_39->Cancel(), mOnFailureCallback_39->Cancel(), int32uArgument); if (CHIP_NO_ERROR != err) @@ -3340,7 +3367,7 @@ class TestCluster : public TestCommand return; } - if (int32u != 4294967295) + if (int32u != 4294967295UL) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "4294967295"); runner->SetCommandExitStatus(false); @@ -3370,7 +3397,7 @@ class TestCluster : public TestCommand CHIP_ERROR err = CHIP_NO_ERROR; - uint32_t int32uArgument = 0; + uint32_t int32uArgument = 0UL; err = cluster.WriteAttributeInt32u(mOnSuccessCallback_41->Cancel(), mOnFailureCallback_41->Cancel(), int32uArgument); if (CHIP_NO_ERROR != err) @@ -3486,7 +3513,7 @@ class TestCluster : public TestCommand return; } - if (int32u != 0) + if (int32u != 0UL) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); runner->SetCommandExitStatus(false); @@ -4958,7 +4985,7 @@ class TestCluster : public TestCommand return; } - if (int32s != 0) + if (int32s != 0L) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); runner->SetCommandExitStatus(false); @@ -4988,7 +5015,7 @@ class TestCluster : public TestCommand CHIP_ERROR err = CHIP_NO_ERROR; - int32_t int32sArgument = 2147483647; + int32_t int32sArgument = 2147483647L; err = cluster.WriteAttributeInt32s(mOnSuccessCallback_63->Cancel(), mOnFailureCallback_63->Cancel(), int32sArgument); if (CHIP_NO_ERROR != err) @@ -5104,7 +5131,7 @@ class TestCluster : public TestCommand return; } - if (int32s != 2147483647) + if (int32s != 2147483647L) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "2147483647"); runner->SetCommandExitStatus(false); @@ -5134,7 +5161,7 @@ class TestCluster : public TestCommand CHIP_ERROR err = CHIP_NO_ERROR; - int32_t int32sArgument = -2147483648; + int32_t int32sArgument = -2147483648L; err = cluster.WriteAttributeInt32s(mOnSuccessCallback_65->Cancel(), mOnFailureCallback_65->Cancel(), int32sArgument); if (CHIP_NO_ERROR != err) @@ -5250,7 +5277,7 @@ class TestCluster : public TestCommand return; } - if (int32s != -2147483648) + if (int32s != -2147483648L) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "-2147483648"); runner->SetCommandExitStatus(false); @@ -5280,7 +5307,7 @@ class TestCluster : public TestCommand CHIP_ERROR err = CHIP_NO_ERROR; - int32_t int32sArgument = 0; + int32_t int32sArgument = 0L; err = cluster.WriteAttributeInt32s(mOnSuccessCallback_67->Cancel(), mOnFailureCallback_67->Cancel(), int32sArgument); if (CHIP_NO_ERROR != err) @@ -5396,7 +5423,7 @@ class TestCluster : public TestCommand return; } - if (int32s != 0) + if (int32s != 0L) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); runner->SetCommandExitStatus(false); @@ -6354,7 +6381,7 @@ class TestCluster : public TestCommand return; } - if (enum16 != 0) + if (enum16 != 0U) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); runner->SetCommandExitStatus(false); @@ -6384,7 +6411,7 @@ class TestCluster : public TestCommand CHIP_ERROR err = CHIP_NO_ERROR; - uint16_t enum16Argument = 65535; + uint16_t enum16Argument = 65535U; err = cluster.WriteAttributeEnum16(mOnSuccessCallback_82->Cancel(), mOnFailureCallback_82->Cancel(), enum16Argument); if (CHIP_NO_ERROR != err) @@ -6500,7 +6527,7 @@ class TestCluster : public TestCommand return; } - if (enum16 != 65535) + if (enum16 != 65535U) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "65535"); runner->SetCommandExitStatus(false); @@ -6530,7 +6557,7 @@ class TestCluster : public TestCommand CHIP_ERROR err = CHIP_NO_ERROR; - uint16_t enum16Argument = 0; + uint16_t enum16Argument = 0U; err = cluster.WriteAttributeEnum16(mOnSuccessCallback_84->Cancel(), mOnFailureCallback_84->Cancel(), enum16Argument); if (CHIP_NO_ERROR != err) @@ -6646,7 +6673,7 @@ class TestCluster : public TestCommand return; } - if (enum16 != 0) + if (enum16 != 0U) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); runner->SetCommandExitStatus(false); @@ -7100,6 +7127,698 @@ class TestCluster : public TestCommand runner->NextTest(); } + + // Test Read attribute LONG_OCTET_STRING Default Value + typedef void (*SuccessCallback_92)(void * context, chip::ByteSpan longOctetString); + chip::Callback::Callback * mOnSuccessCallback_92 = nullptr; + chip::Callback::Callback * mOnFailureCallback_92 = nullptr; + bool mIsFailureExpected_92 = 0; + + CHIP_ERROR TestSendClusterTestClusterCommandReadAttribute_92() + { + ChipLogProgress(chipTool, "Test Cluster - Read attribute LONG_OCTET_STRING Default Value: Sending command..."); + + mOnFailureCallback_92 = new chip::Callback::Callback( + OnTestSendClusterTestClusterCommandReadAttribute_92_FailureResponse, this); + mOnSuccessCallback_92 = new chip::Callback::Callback( + OnTestSendClusterTestClusterCommandReadAttribute_92_SuccessResponse, this); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeLongOctetString(mOnSuccessCallback_92->Cancel(), mOnFailureCallback_92->Cancel()); + + if (CHIP_NO_ERROR != err) + { + delete mOnFailureCallback_92; + delete mOnSuccessCallback_92; + } + + return err; + } + + static void OnTestSendClusterTestClusterCommandReadAttribute_92_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Test Cluster - Read attribute LONG_OCTET_STRING Default Value: Failure Response"); + + TestCluster * runner = reinterpret_cast(context); + + delete runner->mOnFailureCallback_92; + delete runner->mOnSuccessCallback_92; + + if (runner->mIsFailureExpected_92 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(false); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterTestClusterCommandReadAttribute_92_SuccessResponse(void * context, chip::ByteSpan longOctetString) + { + ChipLogProgress(chipTool, "Test Cluster - Read attribute LONG_OCTET_STRING Default Value: Success Response"); + + TestCluster * runner = reinterpret_cast(context); + + delete runner->mOnFailureCallback_92; + delete runner->mOnSuccessCallback_92; + + if (runner->mIsFailureExpected_92 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(false); + return; + } + + chip::ByteSpan longOctetStringArgument = chip::ByteSpan(chip::Uint8::from_const_char(""), strlen("")); + if (!longOctetString.data_equal(longOctetStringArgument)) + { + ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", ""); + runner->SetCommandExitStatus(false); + return; + } + + runner->NextTest(); + } + + // Test Write attribute LONG_OCTET_STRING + typedef void (*SuccessCallback_93)(void * context, chip::ByteSpan longOctetString); + chip::Callback::Callback * mOnSuccessCallback_93 = nullptr; + chip::Callback::Callback * mOnFailureCallback_93 = nullptr; + bool mIsFailureExpected_93 = 0; + + CHIP_ERROR TestSendClusterTestClusterCommandWriteAttribute_93() + { + ChipLogProgress(chipTool, "Test Cluster - Write attribute LONG_OCTET_STRING: Sending command..."); + + mOnFailureCallback_93 = new chip::Callback::Callback( + OnTestSendClusterTestClusterCommandWriteAttribute_93_FailureResponse, this); + mOnSuccessCallback_93 = new chip::Callback::Callback( + OnTestSendClusterTestClusterCommandWriteAttribute_93_SuccessResponse, this); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + chip::ByteSpan longOctetStringArgument = chip::ByteSpan( + chip::Uint8::from_const_char( + "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "111111111111111111111111111111111111111111111111111111111111111111111111"), + strlen("111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "111111111111111111111111111111111111111111111111111111111111111111111111111111")); + err = cluster.WriteAttributeLongOctetString(mOnSuccessCallback_93->Cancel(), mOnFailureCallback_93->Cancel(), + longOctetStringArgument); + + if (CHIP_NO_ERROR != err) + { + delete mOnFailureCallback_93; + delete mOnSuccessCallback_93; + } + + return err; + } + + static void OnTestSendClusterTestClusterCommandWriteAttribute_93_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Test Cluster - Write attribute LONG_OCTET_STRING: Failure Response"); + + TestCluster * runner = reinterpret_cast(context); + + delete runner->mOnFailureCallback_93; + delete runner->mOnSuccessCallback_93; + + if (runner->mIsFailureExpected_93 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(false); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterTestClusterCommandWriteAttribute_93_SuccessResponse(void * context, chip::ByteSpan longOctetString) + { + ChipLogProgress(chipTool, "Test Cluster - Write attribute LONG_OCTET_STRING: Success Response"); + + TestCluster * runner = reinterpret_cast(context); + + delete runner->mOnFailureCallback_93; + delete runner->mOnSuccessCallback_93; + + if (runner->mIsFailureExpected_93 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(false); + return; + } + + runner->NextTest(); + } + + // Test Read attribute LONG_OCTET_STRING + typedef void (*SuccessCallback_94)(void * context, chip::ByteSpan longOctetString); + chip::Callback::Callback * mOnSuccessCallback_94 = nullptr; + chip::Callback::Callback * mOnFailureCallback_94 = nullptr; + bool mIsFailureExpected_94 = 0; + + CHIP_ERROR TestSendClusterTestClusterCommandReadAttribute_94() + { + ChipLogProgress(chipTool, "Test Cluster - Read attribute LONG_OCTET_STRING: Sending command..."); + + mOnFailureCallback_94 = new chip::Callback::Callback( + OnTestSendClusterTestClusterCommandReadAttribute_94_FailureResponse, this); + mOnSuccessCallback_94 = new chip::Callback::Callback( + OnTestSendClusterTestClusterCommandReadAttribute_94_SuccessResponse, this); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeLongOctetString(mOnSuccessCallback_94->Cancel(), mOnFailureCallback_94->Cancel()); + + if (CHIP_NO_ERROR != err) + { + delete mOnFailureCallback_94; + delete mOnSuccessCallback_94; + } + + return err; + } + + static void OnTestSendClusterTestClusterCommandReadAttribute_94_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Test Cluster - Read attribute LONG_OCTET_STRING: Failure Response"); + + TestCluster * runner = reinterpret_cast(context); + + delete runner->mOnFailureCallback_94; + delete runner->mOnSuccessCallback_94; + + if (runner->mIsFailureExpected_94 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(false); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterTestClusterCommandReadAttribute_94_SuccessResponse(void * context, chip::ByteSpan longOctetString) + { + ChipLogProgress(chipTool, "Test Cluster - Read attribute LONG_OCTET_STRING: Success Response"); + + TestCluster * runner = reinterpret_cast(context); + + delete runner->mOnFailureCallback_94; + delete runner->mOnSuccessCallback_94; + + if (runner->mIsFailureExpected_94 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(false); + return; + } + + chip::ByteSpan longOctetStringArgument = chip::ByteSpan( + chip::Uint8::from_const_char( + "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "111111111111111111111111111111111111111111111111111111111111111111111111"), + strlen("111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "111111111111111111111111111111111111111111111111111111111111111111111111111111")); + if (!longOctetString.data_equal(longOctetStringArgument)) + { + ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", + "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"); + runner->SetCommandExitStatus(false); + return; + } + + runner->NextTest(); + } + + // Test Write attribute LONG_OCTET_STRING + typedef void (*SuccessCallback_95)(void * context, chip::ByteSpan longOctetString); + chip::Callback::Callback * mOnSuccessCallback_95 = nullptr; + chip::Callback::Callback * mOnFailureCallback_95 = nullptr; + bool mIsFailureExpected_95 = 0; + + CHIP_ERROR TestSendClusterTestClusterCommandWriteAttribute_95() + { + ChipLogProgress(chipTool, "Test Cluster - Write attribute LONG_OCTET_STRING: Sending command..."); + + mOnFailureCallback_95 = new chip::Callback::Callback( + OnTestSendClusterTestClusterCommandWriteAttribute_95_FailureResponse, this); + mOnSuccessCallback_95 = new chip::Callback::Callback( + OnTestSendClusterTestClusterCommandWriteAttribute_95_SuccessResponse, this); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + chip::ByteSpan longOctetStringArgument = chip::ByteSpan(chip::Uint8::from_const_char(""), strlen("")); + err = cluster.WriteAttributeLongOctetString(mOnSuccessCallback_95->Cancel(), mOnFailureCallback_95->Cancel(), + longOctetStringArgument); + + if (CHIP_NO_ERROR != err) + { + delete mOnFailureCallback_95; + delete mOnSuccessCallback_95; + } + + return err; + } + + static void OnTestSendClusterTestClusterCommandWriteAttribute_95_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Test Cluster - Write attribute LONG_OCTET_STRING: Failure Response"); + + TestCluster * runner = reinterpret_cast(context); + + delete runner->mOnFailureCallback_95; + delete runner->mOnSuccessCallback_95; + + if (runner->mIsFailureExpected_95 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(false); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterTestClusterCommandWriteAttribute_95_SuccessResponse(void * context, chip::ByteSpan longOctetString) + { + ChipLogProgress(chipTool, "Test Cluster - Write attribute LONG_OCTET_STRING: Success Response"); + + TestCluster * runner = reinterpret_cast(context); + + delete runner->mOnFailureCallback_95; + delete runner->mOnSuccessCallback_95; + + if (runner->mIsFailureExpected_95 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(false); + return; + } + + runner->NextTest(); + } + + // Test Read attribute LIST + typedef void (*SuccessCallback_96)(void * context, uint16_t count, uint8_t * listInt8u); + chip::Callback::Callback * mOnSuccessCallback_96 = nullptr; + chip::Callback::Callback * mOnFailureCallback_96 = nullptr; + bool mIsFailureExpected_96 = 0; + + CHIP_ERROR TestSendClusterTestClusterCommandReadAttribute_96() + { + ChipLogProgress(chipTool, "Test Cluster - Read attribute LIST: Sending command..."); + + mOnFailureCallback_96 = new chip::Callback::Callback( + OnTestSendClusterTestClusterCommandReadAttribute_96_FailureResponse, this); + mOnSuccessCallback_96 = new chip::Callback::Callback( + OnTestSendClusterTestClusterCommandReadAttribute_96_SuccessResponse, this); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeListInt8u(mOnSuccessCallback_96->Cancel(), mOnFailureCallback_96->Cancel()); + + if (CHIP_NO_ERROR != err) + { + delete mOnFailureCallback_96; + delete mOnSuccessCallback_96; + } + + return err; + } + + static void OnTestSendClusterTestClusterCommandReadAttribute_96_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Test Cluster - Read attribute LIST: Failure Response"); + + TestCluster * runner = reinterpret_cast(context); + + delete runner->mOnFailureCallback_96; + delete runner->mOnSuccessCallback_96; + + if (runner->mIsFailureExpected_96 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(false); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterTestClusterCommandReadAttribute_96_SuccessResponse(void * context, uint16_t count, + uint8_t * listInt8u) + { + ChipLogProgress(chipTool, "Test Cluster - Read attribute LIST: Success Response"); + + TestCluster * runner = reinterpret_cast(context); + + delete runner->mOnFailureCallback_96; + delete runner->mOnSuccessCallback_96; + + if (runner->mIsFailureExpected_96 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(false); + return; + } + + if (count != 4) + { + ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "1,2,3,4"); + runner->SetCommandExitStatus(false); + return; + } + + runner->NextTest(); + } + + // Test Read attribute LIST_OCTET_STRING + typedef void (*SuccessCallback_97)(void * context, uint16_t count, chip::ByteSpan * listOctetString); + chip::Callback::Callback * mOnSuccessCallback_97 = nullptr; + chip::Callback::Callback * mOnFailureCallback_97 = nullptr; + bool mIsFailureExpected_97 = 0; + + CHIP_ERROR TestSendClusterTestClusterCommandReadAttribute_97() + { + ChipLogProgress(chipTool, "Test Cluster - Read attribute LIST_OCTET_STRING: Sending command..."); + + mOnFailureCallback_97 = new chip::Callback::Callback( + OnTestSendClusterTestClusterCommandReadAttribute_97_FailureResponse, this); + mOnSuccessCallback_97 = new chip::Callback::Callback( + OnTestSendClusterTestClusterCommandReadAttribute_97_SuccessResponse, this); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeListOctetString(mOnSuccessCallback_97->Cancel(), mOnFailureCallback_97->Cancel()); + + if (CHIP_NO_ERROR != err) + { + delete mOnFailureCallback_97; + delete mOnSuccessCallback_97; + } + + return err; + } + + static void OnTestSendClusterTestClusterCommandReadAttribute_97_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Test Cluster - Read attribute LIST_OCTET_STRING: Failure Response"); + + TestCluster * runner = reinterpret_cast(context); + + delete runner->mOnFailureCallback_97; + delete runner->mOnSuccessCallback_97; + + if (runner->mIsFailureExpected_97 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(false); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterTestClusterCommandReadAttribute_97_SuccessResponse(void * context, uint16_t count, + chip::ByteSpan * listOctetString) + { + ChipLogProgress(chipTool, "Test Cluster - Read attribute LIST_OCTET_STRING: Success Response"); + + TestCluster * runner = reinterpret_cast(context); + + delete runner->mOnFailureCallback_97; + delete runner->mOnSuccessCallback_97; + + if (runner->mIsFailureExpected_97 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(false); + return; + } + + if (count != 4) + { + ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "Test0,Test1,Test2,Test3"); + runner->SetCommandExitStatus(false); + return; + } + + runner->NextTest(); + } + + // Test Read attribute LIST_STRUCT_OCTET_STRING + typedef void (*SuccessCallback_98)(void * context, uint16_t count, _TestListStructOctet * listStructOctetString); + chip::Callback::Callback * mOnSuccessCallback_98 = nullptr; + chip::Callback::Callback * mOnFailureCallback_98 = nullptr; + bool mIsFailureExpected_98 = 0; + + CHIP_ERROR TestSendClusterTestClusterCommandReadAttribute_98() + { + ChipLogProgress(chipTool, "Test Cluster - Read attribute LIST_STRUCT_OCTET_STRING: Sending command..."); + + mOnFailureCallback_98 = new chip::Callback::Callback( + OnTestSendClusterTestClusterCommandReadAttribute_98_FailureResponse, this); + mOnSuccessCallback_98 = new chip::Callback::Callback( + OnTestSendClusterTestClusterCommandReadAttribute_98_SuccessResponse, this); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeListStructOctetString(mOnSuccessCallback_98->Cancel(), mOnFailureCallback_98->Cancel()); + + if (CHIP_NO_ERROR != err) + { + delete mOnFailureCallback_98; + delete mOnSuccessCallback_98; + } + + return err; + } + + static void OnTestSendClusterTestClusterCommandReadAttribute_98_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Test Cluster - Read attribute LIST_STRUCT_OCTET_STRING: Failure Response"); + + TestCluster * runner = reinterpret_cast(context); + + delete runner->mOnFailureCallback_98; + delete runner->mOnSuccessCallback_98; + + if (runner->mIsFailureExpected_98 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(false); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterTestClusterCommandReadAttribute_98_SuccessResponse(void * context, uint16_t count, + _TestListStructOctet * listStructOctetString) + { + ChipLogProgress(chipTool, "Test Cluster - Read attribute LIST_STRUCT_OCTET_STRING: Success Response"); + + TestCluster * runner = reinterpret_cast(context); + + delete runner->mOnFailureCallback_98; + delete runner->mOnSuccessCallback_98; + + if (runner->mIsFailureExpected_98 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(false); + return; + } + + if (count != 4) + { + ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", + "[object Object],[object Object],[object Object],[object Object]"); + runner->SetCommandExitStatus(false); + return; + } + + runner->NextTest(); + } + + // Test Read attribute UNSUPPORTED + typedef void (*SuccessCallback_99)(void * context, uint8_t unsupported); + chip::Callback::Callback * mOnSuccessCallback_99 = nullptr; + chip::Callback::Callback * mOnFailureCallback_99 = nullptr; + bool mIsFailureExpected_99 = 1; + + CHIP_ERROR TestSendClusterTestClusterCommandReadAttribute_99() + { + ChipLogProgress(chipTool, "Test Cluster - Read attribute UNSUPPORTED: Sending command..."); + + mOnFailureCallback_99 = new chip::Callback::Callback( + OnTestSendClusterTestClusterCommandReadAttribute_99_FailureResponse, this); + mOnSuccessCallback_99 = new chip::Callback::Callback( + OnTestSendClusterTestClusterCommandReadAttribute_99_SuccessResponse, this); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeUnsupported(mOnSuccessCallback_99->Cancel(), mOnFailureCallback_99->Cancel()); + + if (CHIP_NO_ERROR != err) + { + delete mOnFailureCallback_99; + delete mOnSuccessCallback_99; + } + + return err; + } + + static void OnTestSendClusterTestClusterCommandReadAttribute_99_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Test Cluster - Read attribute UNSUPPORTED: Failure Response"); + + TestCluster * runner = reinterpret_cast(context); + + delete runner->mOnFailureCallback_99; + delete runner->mOnSuccessCallback_99; + + if (runner->mIsFailureExpected_99 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(false); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterTestClusterCommandReadAttribute_99_SuccessResponse(void * context, uint8_t unsupported) + { + ChipLogProgress(chipTool, "Test Cluster - Read attribute UNSUPPORTED: Success Response"); + + TestCluster * runner = reinterpret_cast(context); + + delete runner->mOnFailureCallback_99; + delete runner->mOnSuccessCallback_99; + + if (runner->mIsFailureExpected_99 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(false); + return; + } + + if (unsupported != 0) + { + ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); + runner->SetCommandExitStatus(false); + return; + } + + runner->NextTest(); + } + + // Test Writeattribute UNSUPPORTED + typedef void (*SuccessCallback_100)(void * context, uint8_t unsupported); + chip::Callback::Callback * mOnSuccessCallback_100 = nullptr; + chip::Callback::Callback * mOnFailureCallback_100 = nullptr; + bool mIsFailureExpected_100 = 1; + + CHIP_ERROR TestSendClusterTestClusterCommandWriteAttribute_100() + { + ChipLogProgress(chipTool, "Test Cluster - Writeattribute UNSUPPORTED: Sending command..."); + + mOnFailureCallback_100 = new chip::Callback::Callback( + OnTestSendClusterTestClusterCommandWriteAttribute_100_FailureResponse, this); + mOnSuccessCallback_100 = new chip::Callback::Callback( + OnTestSendClusterTestClusterCommandWriteAttribute_100_SuccessResponse, this); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint8_t unsupportedArgument = 0; + err = cluster.WriteAttributeUnsupported(mOnSuccessCallback_100->Cancel(), mOnFailureCallback_100->Cancel(), + unsupportedArgument); + + if (CHIP_NO_ERROR != err) + { + delete mOnFailureCallback_100; + delete mOnSuccessCallback_100; + } + + return err; + } + + static void OnTestSendClusterTestClusterCommandWriteAttribute_100_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Test Cluster - Writeattribute UNSUPPORTED: Failure Response"); + + TestCluster * runner = reinterpret_cast(context); + + delete runner->mOnFailureCallback_100; + delete runner->mOnSuccessCallback_100; + + if (runner->mIsFailureExpected_100 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(false); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterTestClusterCommandWriteAttribute_100_SuccessResponse(void * context, uint8_t unsupported) + { + ChipLogProgress(chipTool, "Test Cluster - Writeattribute UNSUPPORTED: Success Response"); + + TestCluster * runner = reinterpret_cast(context); + + delete runner->mOnFailureCallback_100; + delete runner->mOnSuccessCallback_100; + + if (runner->mIsFailureExpected_100 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(false); + return; + } + + runner->NextTest(); + } }; class Test_3_1_1 : public TestCommand @@ -7221,7 +7940,7 @@ class Test_3_1_1 : public TestCommand return; } - if (clusterRevision != 2) + if (clusterRevision != 2U) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "2"); runner->SetCommandExitStatus(false); @@ -7297,7 +8016,7 @@ class Test_3_1_1 : public TestCommand return; } - if (clusterRevision != 2) + if (clusterRevision != 2U) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "2"); runner->SetCommandExitStatus(false); @@ -7373,7 +8092,7 @@ class Test_3_1_1 : public TestCommand return; } - if (featureMap != 0) + if (featureMap != 0UL) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); runner->SetCommandExitStatus(false); @@ -7449,7 +8168,7 @@ class Test_3_1_1 : public TestCommand return; } - if (featureMap != 0) + if (featureMap != 0UL) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); runner->SetCommandExitStatus(false); @@ -7831,7 +8550,7 @@ class Test_3_2_1 : public TestCommand return; } - if (onTime != 0) + if (onTime != 0U) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); runner->SetCommandExitStatus(false); @@ -7907,7 +8626,7 @@ class Test_3_2_1 : public TestCommand return; } - if (offWaitTime != 0) + if (offWaitTime != 0U) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); runner->SetCommandExitStatus(false); @@ -8013,7 +8732,7 @@ class Test_3_2_1 : public TestCommand CHIP_ERROR err = CHIP_NO_ERROR; - uint16_t onTimeArgument = 0; + uint16_t onTimeArgument = 0U; err = cluster.WriteAttributeOnTime(mOnSuccessCallback_6->Cancel(), mOnFailureCallback_6->Cancel(), onTimeArgument); if (CHIP_NO_ERROR != err) @@ -8083,7 +8802,7 @@ class Test_3_2_1 : public TestCommand CHIP_ERROR err = CHIP_NO_ERROR; - uint16_t offWaitTimeArgument = 0; + uint16_t offWaitTimeArgument = 0U; err = cluster.WriteAttributeOffWaitTime(mOnSuccessCallback_7->Cancel(), mOnFailureCallback_7->Cancel(), offWaitTimeArgument); @@ -8271,7 +8990,7 @@ class Test_3_2_1 : public TestCommand return; } - if (onTime != 0) + if (onTime != 0U) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); runner->SetCommandExitStatus(false); @@ -8347,7 +9066,7 @@ class Test_3_2_1 : public TestCommand return; } - if (offWaitTime != 0) + if (offWaitTime != 0U) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); runner->SetCommandExitStatus(false); diff --git a/examples/chip-tool/templates/partials/test_cluster.zapt b/examples/chip-tool/templates/partials/test_cluster.zapt index 47b7e0e00b512e..6eedda1d50bf1b 100644 --- a/examples/chip-tool/templates/partials/test_cluster.zapt +++ b/examples/chip-tool/templates/partials/test_cluster.zapt @@ -48,7 +48,7 @@ class {{filename}}: public TestCommand {{#chip_tests_items}} // Test {{label}} - typedef void (*SuccessCallback_{{index}})(void * context{{#chip_tests_item_response_parameters}}, {{chipType}} {{asCamelCased name true}}{{/chip_tests_item_response_parameters}}); + typedef void (*SuccessCallback_{{index}})(void * context{{#chip_tests_item_response_parameters}}, {{#if isList}}uint16_t count, {{/if}}{{chipType}} {{#if isList}}* {{/if}}{{asCamelCased name true}}{{/chip_tests_item_response_parameters}}); chip::Callback::Callback * mOnSuccessCallback_{{index}} = nullptr; chip::Callback::Callback * mOnFailureCallback_{{index}} = nullptr; bool mIsFailureExpected_{{index}} = {{response.error}}; @@ -70,7 +70,7 @@ class {{filename}}: public TestCommand {{#if (isString type)}} {{chipType}} {{asCamelCased name true}}Argument = chip::ByteSpan(chip::Uint8::from_const_char("{{definedValue}}"), strlen("{{definedValue}}")); {{else}} - {{chipType}} {{asCamelCased name true}}Argument = {{definedValue}}{{#if (isStrEqual chipType "int64_t")}}LL{{else if (isStrEqual chipType "uint64_t")}}ULL{{/if}}; + {{chipType}} {{asCamelCased name true}}Argument = {{definedValue}}{{asTypeLiteralSuffix chipType}}; {{/if}} {{/chip_tests_item_parameters}} err = cluster.{{asCamelCased command false}}(mOnSuccessCallback_{{index}}->Cancel(), mOnFailureCallback_{{index}}->Cancel(){{#chip_tests_item_parameters}}, {{asCamelCased name true}}Argument{{/chip_tests_item_parameters}}); @@ -81,7 +81,7 @@ class {{filename}}: public TestCommand {{#if (isString type)}} {{chipType}} {{asCamelCased name true}}Argument = chip::ByteSpan(chip::Uint8::from_const_char("{{definedValue}}"), strlen("{{definedValue}}")); {{else}} - {{chipType}} {{asCamelCased name true}}Argument = {{definedValue}}{{#if (isStrEqual chipType "int64_t")}}LL{{else if (isStrEqual chipType "uint64_t")}}ULL{{/if}}; + {{chipType}} {{asCamelCased name true}}Argument = {{definedValue}}{{asTypeLiteralSuffix chipType}}; {{/if}} {{/chip_tests_item_parameters}} err = cluster.WriteAttribute{{asCamelCased attribute false}}(mOnSuccessCallback_{{index}}->Cancel(), mOnFailureCallback_{{index}}->Cancel(), {{#chip_tests_item_parameters}}{{asCamelCased name true}}Argument{{/chip_tests_item_parameters}}); @@ -116,7 +116,7 @@ class {{filename}}: public TestCommand runner->NextTest(); } - static void OnTestSendCluster{{asCamelCased cluster false}}Command{{asCamelCased command false}}_{{index}}_SuccessResponse(void * context {{#chip_tests_item_response_parameters}}, {{chipType}} {{asCamelCased name true}}{{/chip_tests_item_response_parameters}}) + static void OnTestSendCluster{{asCamelCased cluster false}}Command{{asCamelCased command false}}_{{index}}_SuccessResponse(void * context {{#chip_tests_item_response_parameters}}, {{#if isList}}uint16_t count, {{/if}}{{chipType}} {{#if isList}}* {{/if}}{{asCamelCased name true}}{{/chip_tests_item_response_parameters}}) { ChipLogProgress(chipTool, "{{cluster}} - {{label}}: Success Response"); @@ -134,11 +134,19 @@ class {{filename}}: public TestCommand {{#chip_tests_item_response_parameters}} {{#if hasExpectedValue}} + {{#if isList}} + if (count != {{expectedValue.length}}) + { + ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "{{expectedValue}}"); + runner->SetCommandExitStatus(false); + return; + } + {{else}} {{#if (isString type)}} {{chipType}} {{asCamelCased name true}}Argument = chip::ByteSpan(chip::Uint8::from_const_char("{{expectedValue}}"), strlen("{{expectedValue}}")); if (!{{asCamelCased name true}}.data_equal({{asCamelCased name true}}Argument)) {{else}} - if ({{asCamelCased name true}} != {{expectedValue}}{{#if (isStrEqual chipType "int64_t")}}LL{{else if (isStrEqual chipType "uint64_t")}}ULL{{/if}}) + if ({{asCamelCased name true}} != {{expectedValue}}{{asTypeLiteralSuffix chipType}}) {{/if}} { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "{{expectedValue}}"); @@ -146,6 +154,7 @@ class {{filename}}: public TestCommand return; } {{/if}} + {{/if}} {{/chip_tests_item_response_parameters}} runner->NextTest(); diff --git a/src/app/clusters/test-cluster-server/test-cluster-server.cpp b/src/app/clusters/test-cluster-server/test-cluster-server.cpp index fbb83056228ad1..fb2d023045109a 100644 --- a/src/app/clusters/test-cluster-server/test-cluster-server.cpp +++ b/src/app/clusters/test-cluster-server/test-cluster-server.cpp @@ -57,6 +57,23 @@ EmberAfStatus writeAttribute(uint8_t endpoint, AttributeId attributeId, uint8_t return emAfReadOrWriteAttribute(&record, NULL, buffer, 0, true, index + 1); } +EmberAfStatus writeTestListInt8uAttribute(uint8_t endpoint) +{ + EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + AttributeId attributeId = ZCL_LIST_ATTRIBUTE_ID; + + uint16_t attributeCount = 4; + for (uint8_t index = 0; index < attributeCount; index++) + { + status = writeAttribute(endpoint, attributeId, (uint8_t *) &index, index); + VerifyOrReturnError(status == EMBER_ZCL_STATUS_SUCCESS, status); + } + + status = writeAttribute(endpoint, attributeId, (uint8_t *) &attributeCount); + VerifyOrReturnError(status == EMBER_ZCL_STATUS_SUCCESS, status); + return status; +} + EmberAfStatus writeTestListOctetAttribute(uint8_t endpoint) { EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; @@ -118,6 +135,9 @@ void emberAfPluginTestClusterServerInitCallback(void) continue; } + status = writeTestListInt8uAttribute(endpoint); + VerifyOrReturn(status == EMBER_ZCL_STATUS_SUCCESS, ChipLogError(Zcl, kErrorStr, endpoint, "test list int8u", status)); + status = writeTestListOctetAttribute(endpoint); VerifyOrReturn(status == EMBER_ZCL_STATUS_SUCCESS, ChipLogError(Zcl, kErrorStr, endpoint, "test list octet", status)); diff --git a/src/app/common/gen/attribute-id.h b/src/app/common/gen/attribute-id.h index 6e820f97c1fd63..5cf3f9f1a98aa7 100644 --- a/src/app/common/gen/attribute-id.h +++ b/src/app/common/gen/attribute-id.h @@ -1418,6 +1418,8 @@ #define ZCL_LIST_ATTRIBUTE_ID (0x001A) #define ZCL_LIST_OCTET_STRING_ATTRIBUTE_ID (0x001B) #define ZCL_LIST_STRUCT_OCTET_STRING_ATTRIBUTE_ID (0x001C) +#define ZCL_LONG_OCTET_STRING_ATTRIBUTE_ID (0x001D) +#define ZCL_UNSUPPORTED_ATTRIBUTE_ID (0x00FF) // Attribute ids for cluster: Generic Tunnel diff --git a/src/app/tests/suites/TestCluster.yaml b/src/app/tests/suites/TestCluster.yaml index c10c01a45410e7..ae529781a3ad75 100644 --- a/src/app/tests/suites/TestCluster.yaml +++ b/src/app/tests/suites/TestCluster.yaml @@ -599,3 +599,76 @@ tests: attribute: "octet_string" arguments: value: "" + + # Tests for Long Octet String attribute + + - label: "Read attribute LONG_OCTET_STRING Default Value" + command: "readAttribute" + attribute: "long_octet_string" + response: + value: "" + + - label: "Write attribute LONG_OCTET_STRING" + command: "writeAttribute" + attribute: "long_octet_string" + arguments: + value: "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + + - label: "Read attribute LONG_OCTET_STRING" + command: "readAttribute" + attribute: "long_octet_string" + response: + value: "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + + - label: "Write attribute LONG_OCTET_STRING" + command: "writeAttribute" + attribute: "long_octet_string" + arguments: + value: "" + + # Tests for List attribute + + - label: "Read attribute LIST" + command: "readAttribute" + attribute: "list_int8u" + response: + value: [1, 2, 3, 4] + + # Tests for List Octet String attribute + + - label: "Read attribute LIST_OCTET_STRING" + command: "readAttribute" + attribute: "list_octet_string" + response: + value: ["Test0", "Test1", "Test2", "Test3"] + + # Tests for List Struct Octet String attribute + + - label: "Read attribute LIST_STRUCT_OCTET_STRING" + command: "readAttribute" + attribute: "list_struct_octet_string" + response: + value: + [ + { fabricIndex: 0, operationalCert: "Test0" }, + { fabricIndex: 1, operationalCert: "Test1" }, + { fabricIndex: 2, operationalCert: "Test2" }, + { fabricIndex: 3, operationalCert: "Test3" }, + ] + + # Tests for Unsupported attribute + + - label: "Read attribute UNSUPPORTED" + command: "readAttribute" + attribute: "unsupported" + response: + value: 0 + error: 1 + + - label: "Writeattribute UNSUPPORTED" + command: "writeAttribute" + attribute: "unsupported" + arguments: + value: 0 + response: + error: 1 diff --git a/src/app/util/af-main-common.cpp b/src/app/util/af-main-common.cpp index 5b332086df10f1..0787914becf89a 100644 --- a/src/app/util/af-main-common.cpp +++ b/src/app/util/af-main-common.cpp @@ -284,7 +284,7 @@ static EmberStatus send(const MessageSendDestination & destination, EmberApsFram if (messageLength <= EMBER_AF_MAXIMUM_SEND_PAYLOAD_LENGTH) { - status = emAfSend(destination, apsFrame, (uint8_t) messageLength, message, &messageTag, alias, sequence); + status = emAfSend(destination, apsFrame, messageLength, message, &messageTag, alias, sequence); } else { @@ -612,8 +612,8 @@ void emAfFragmentationMessageSentHandler(const MessageSendDestination & destinat } #endif // EMBER_AF_PLUGIN_FRAGMENTATION -EmberStatus emAfSend(const MessageSendDestination & destination, EmberApsFrame * apsFrame, uint8_t messageLength, uint8_t * message, - uint8_t * messageTag, EmberNodeId alias, uint8_t sequence) +EmberStatus emAfSend(const MessageSendDestination & destination, EmberApsFrame * apsFrame, uint16_t messageLength, + uint8_t * message, uint8_t * messageTag, EmberNodeId alias, uint8_t sequence) { // TODO: There's an impedance mismatch here in a few ways: // 1) The caller expects to get a messageTag out that will identify this diff --git a/src/app/util/af-main.h b/src/app/util/af-main.h index 24a3a01aa373c0..3ab846b5d517d2 100644 --- a/src/app/util/af-main.h +++ b/src/app/util/af-main.h @@ -121,7 +121,7 @@ bool emAfProcessZdo(EmberNodeId sender, EmberApsFrame * apsFrame, uint8_t * mess void emAfIncomingMessageHandler(EmberIncomingMessageType type, EmberApsFrame * apsFrame, uint8_t lastHopLqi, int8_t lastHopRssi, uint16_t messageLength, uint8_t * messageContents); -EmberStatus emAfSend(const chip::MessageSendDestination & destination, EmberApsFrame * apsFrame, uint8_t messageLength, +EmberStatus emAfSend(const chip::MessageSendDestination & destination, EmberApsFrame * apsFrame, uint16_t messageLength, uint8_t * message, uint8_t * messageTag, EmberNodeId alias, uint8_t sequence); void emAfMessageSentHandler(const chip::MessageSendDestination & destination, EmberApsFrame * apsFrame, EmberStatus status, uint16_t messageLength, uint8_t * messageContents, uint8_t messageTag); diff --git a/src/app/zap-templates/common/ClustersHelper.js b/src/app/zap-templates/common/ClustersHelper.js index 1a3a4c183b8b26..01aed0da0d25a4 100644 --- a/src/app/zap-templates/common/ClustersHelper.js +++ b/src/app/zap-templates/common/ClustersHelper.js @@ -370,7 +370,7 @@ function enhancedAttributes(attributes, types) }); attributes.forEach(attribute => { - const argument = { name : attribute.name, chipType : attribute.chipType, type : attribute.type }; + const argument = { isList : attribute.isList, name : attribute.name, chipType : attribute.chipType, type : attribute.type }; attribute.arguments = [ argument ]; attribute.response = { arguments : [ argument ] }; }); diff --git a/src/app/zap-templates/templates/app/encoder-src.zapt b/src/app/zap-templates/templates/app/encoder-src.zapt index 53b82a7c03848c..372672adfe824e 100644 --- a/src/app/zap-templates/templates/app/encoder-src.zapt +++ b/src/app/zap-templates/templates/app/encoder-src.zapt @@ -111,7 +111,7 @@ PacketBufferHandle encode{{asCamelCased parent.name false}}ClusterWrite{{asCamel .Put16({{asHex code 4}}) .Put8({{atomicTypeId}}) {{#if (isString type)}} - .Put(static_cast<{{#if (isShortString type)}}uint8_t{{else}}uint16_t{{/if}}>({{asCamelCased name}}StrLen)) + .Put{{#if (isLongString type)}}16{{/if}}(static_cast<{{#if (isShortString type)}}uint8_t{{else}}uint16_t{{/if}}>({{asCamelCased name}}StrLen)) .Put({{asCamelCased name}}.data(), {{asCamelCased name }}StrLen) {{else}} .Put{{chipTypePutLength}}(static_cast<{{chipTypePutCastType}}>({{asCamelCased name}})) diff --git a/src/app/zap-templates/templates/app/helper.js b/src/app/zap-templates/templates/app/helper.js index c8d15e58f0c91f..1dbcc6cb77cf97 100644 --- a/src/app/zap-templates/templates/app/helper.js +++ b/src/app/zap-templates/templates/app/helper.js @@ -361,6 +361,24 @@ function isStrEndsWith(str, substr) return str.endsWith(substr); } +function asTypeLiteralSuffix(type) +{ + switch (type) { + case 'int32_t': + return 'L'; + case 'int64_t': + return 'LL'; + case 'uint16_t': + return 'U'; + case 'uint32_t': + return 'UL'; + case 'uint64_t': + return 'ULL'; + default: + return ''; + } +} + // // Module exports // @@ -375,3 +393,4 @@ exports.chip_endpoint_generated_functions = chip_endpoint_generated_ exports.chip_endpoint_cluster_list = chip_endpoint_cluster_list exports.isSigned = ChipTypesHelper.isSigned; exports.isStrEndsWith = isStrEndsWith; +exports.asTypeLiteralSuffix = asTypeLiteralSuffix; diff --git a/src/app/zap-templates/zcl/test-cluster.xml b/src/app/zap-templates/zcl/test-cluster.xml index 61241589090e60..ad698167a98d68 100644 --- a/src/app/zap-templates/zcl/test-cluster.xml +++ b/src/app/zap-templates/zcl/test-cluster.xml @@ -53,6 +53,10 @@ limitations under the License. list_octet_string list_struct_octet_string + long_octet_string + + + unsupported diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap index 5081490f57e4bd..76763a441553a7 100644 --- a/src/controller/data_model/controller-clusters.zap +++ b/src/controller/data_model/controller-clusters.zap @@ -8192,6 +8192,36 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "long_octet_string", + "code": 29, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "unsupported", + "code": 255, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, { "name": "cluster revision", "code": 65533, @@ -8375,4 +8405,4 @@ } ], "log": [] -} \ No newline at end of file +} diff --git a/src/controller/data_model/gen/CHIPClusters.cpp b/src/controller/data_model/gen/CHIPClusters.cpp index 9b7042a2670123..462c4326cab39a 100644 --- a/src/controller/data_model/gen/CHIPClusters.cpp +++ b/src/controller/data_model/gen/CHIPClusters.cpp @@ -8034,6 +8034,38 @@ CHIP_ERROR TestClusterCluster::ReadAttributeListStructOctetString(Callback::Canc return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); } +CHIP_ERROR TestClusterCluster::ReadAttributeLongOctetString(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadLongOctetStringAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeLongOctetString(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, chip::ByteSpan value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteLongOctetStringAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeUnsupported(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadUnsupportedAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeUnsupported(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint8_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteUnsupportedAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + CHIP_ERROR TestClusterCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { diff --git a/src/controller/data_model/gen/CHIPClusters.h b/src/controller/data_model/gen/CHIPClusters.h index c70d89e99c48fd..fcdd8e2dc439c0 100644 --- a/src/controller/data_model/gen/CHIPClusters.h +++ b/src/controller/data_model/gen/CHIPClusters.h @@ -1217,6 +1217,8 @@ class DLL_EXPORT TestClusterCluster : public ClusterBase CHIP_ERROR ReadAttributeListOctetString(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); CHIP_ERROR ReadAttributeListStructOctetString(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeLongOctetString(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeUnsupported(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); CHIP_ERROR ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); CHIP_ERROR WriteAttributeBoolean(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t value); @@ -1250,6 +1252,10 @@ class DLL_EXPORT TestClusterCluster : public ClusterBase uint16_t value); CHIP_ERROR WriteAttributeOctetString(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, chip::ByteSpan value); + CHIP_ERROR WriteAttributeLongOctetString(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + chip::ByteSpan value); + CHIP_ERROR WriteAttributeUnsupported(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t value); private: static constexpr CommandId kTestCommandId = 0x00; 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 b40743debf84e2..e1f423bc424ea9 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 @@ -2588,6 +2588,8 @@ encodeTemperatureMeasurementClusterReadClusterRevisionAttribute(uint8_t seqNum, | * ListInt8u | 0x001A | | * ListOctetString | 0x001B | | * ListStructOctetString | 0x001C | +| * LongOctetString | 0x001D | +| * Unsupported | 0x00FF | | * ClusterRevision | 0xFFFD | \*----------------------------------------------------------------------------*/ @@ -2830,6 +2832,35 @@ chip::System::PacketBufferHandle encodeTestClusterClusterReadListOctetStringAttr chip::System::PacketBufferHandle encodeTestClusterClusterReadListStructOctetStringAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); +/** + * @brief + * Encode a Test Cluster server read command for the long_octet_string attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterReadLongOctetStringAttribute(uint8_t seqNum, + chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Test Cluster server write command for the long_octet_string attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterWriteLongOctetStringAttribute(uint8_t seqNum, + chip::EndpointId destinationEndpoint, + chip::ByteSpan longOctetString); + +/** + * @brief + * Encode a Test Cluster server read command for the unsupported attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterReadUnsupportedAttribute(uint8_t seqNum, + chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Test Cluster server write command for the unsupported attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle +encodeTestClusterClusterWriteUnsupportedAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint, uint8_t unsupported); + /** * @brief * Encode a Test Cluster server read command for the cluster revision attribute into buffer including the APS frame diff --git a/src/controller/data_model/gen/encoder.cpp b/src/controller/data_model/gen/encoder.cpp index d8dca4d9984e6a..0d54b07d98b7ae 100644 --- a/src/controller/data_model/gen/encoder.cpp +++ b/src/controller/data_model/gen/encoder.cpp @@ -3757,6 +3757,8 @@ PacketBufferHandle encodeTemperatureMeasurementClusterReadClusterRevisionAttribu | * ListInt8u | 0x001A | | * ListOctetString | 0x001B | | * ListStructOctetString | 0x001C | +| * LongOctetString | 0x001D | +| * Unsupported | 0x00FF | | * ClusterRevision | 0xFFFD | \*----------------------------------------------------------------------------*/ @@ -4158,6 +4160,60 @@ PacketBufferHandle encodeTestClusterClusterReadListStructOctetStringAttribute(ui COMMAND_FOOTER(); } +/* + * Attribute LongOctetString + */ +PacketBufferHandle encodeTestClusterClusterReadLongOctetStringAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadTestClusterLongOctetString", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x001D); + COMMAND_FOOTER(); +} + +PacketBufferHandle encodeTestClusterClusterWriteLongOctetStringAttribute(uint8_t seqNum, EndpointId destinationEndpoint, + chip::ByteSpan longOctetString) +{ + COMMAND_HEADER("WriteTestClusterLongOctetString", TEST_CLUSTER_ID); + size_t longOctetStringStrLen = longOctetString.size(); + if (!CanCastTo(longOctetStringStrLen)) + { + ChipLogError(Zcl, "Error encoding %s command. String too long: %zu", kName, longOctetStringStrLen); + return PacketBufferHandle(); + } + + buf.Put8(kFrameControlGlobalCommand) + .Put8(seqNum) + .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID) + .Put16(0x001D) + .Put8(67) + .Put16(static_cast(longOctetStringStrLen)) + .Put(longOctetString.data(), longOctetStringStrLen); + COMMAND_FOOTER(); +} + +/* + * Attribute Unsupported + */ +PacketBufferHandle encodeTestClusterClusterReadUnsupportedAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadTestClusterUnsupported", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x00FF); + COMMAND_FOOTER(); +} + +PacketBufferHandle encodeTestClusterClusterWriteUnsupportedAttribute(uint8_t seqNum, EndpointId destinationEndpoint, + uint8_t unsupported) +{ + COMMAND_HEADER("WriteTestClusterUnsupported", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand) + .Put8(seqNum) + .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID) + .Put16(0x00FF) + .Put8(16) + .Put8(static_cast(unsupported)); + COMMAND_FOOTER(); +} + /* * Attribute ClusterRevision */ diff --git a/src/controller/python/chip/clusters/CHIPClusters.cpp b/src/controller/python/chip/clusters/CHIPClusters.cpp index 079daa2cb78bf8..c2f744e09c1a19 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.cpp +++ b/src/controller/python/chip/clusters/CHIPClusters.cpp @@ -3957,6 +3957,41 @@ CHIP_ERROR chip_ime_ReadAttribute_TestCluster_ListStructOctetString(chip::Contro gDefaultFailureCallback.Cancel()); } +CHIP_ERROR chip_ime_ReadAttribute_TestCluster_LongOctetString(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeLongOctetString(gStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_WriteAttribute_TestCluster_LongOctetString(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t * value, size_t len) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.WriteAttributeLongOctetString(gStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel(), + chip::ByteSpan(value, len)); +} +CHIP_ERROR chip_ime_ReadAttribute_TestCluster_Unsupported(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeUnsupported(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_WriteAttribute_TestCluster_Unsupported(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t value) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.WriteAttributeUnsupported(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel(), value); +} CHIP_ERROR chip_ime_ReadAttribute_TestCluster_ClusterRevision(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 2e162e9fb92e04..544da39a083466 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -1640,6 +1640,16 @@ def ListClusterAttributes(self): "attributeId": 0x001C, "type": "", }, + "LongOctetString": { + "attributeId": 0x001D, + "type": "bytes", + "writable": True, + }, + "Unsupported": { + "attributeId": 0x00FF, + "type": "int", + "writable": True, + }, "ClusterRevision": { "attributeId": 0xFFFD, "type": "int", @@ -3128,6 +3138,14 @@ def ClusterTestCluster_ReadAttributeListOctetString(self, device: ctypes.c_void_ return self._chipLib.chip_ime_ReadAttribute_TestCluster_ListOctetString(device, ZCLendpoint, ZCLgroupid) def ClusterTestCluster_ReadAttributeListStructOctetString(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): return self._chipLib.chip_ime_ReadAttribute_TestCluster_ListStructOctetString(device, ZCLendpoint, ZCLgroupid) + def ClusterTestCluster_ReadAttributeLongOctetString(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_LongOctetString(device, ZCLendpoint, ZCLgroupid) + def ClusterTestCluster_WriteAttributeLongOctetString(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, value: bytes): + return self._chipLib.chip_ime_WriteAttribute_TestCluster_LongOctetString(device, ZCLendpoint, ZCLgroupid, value, len(value)) + def ClusterTestCluster_ReadAttributeUnsupported(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_Unsupported(device, ZCLendpoint, ZCLgroupid) + def ClusterTestCluster_WriteAttributeUnsupported(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, value: int): + return self._chipLib.chip_ime_WriteAttribute_TestCluster_Unsupported(device, ZCLendpoint, ZCLgroupid, value) def ClusterTestCluster_ReadAttributeClusterRevision(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): return self._chipLib.chip_ime_ReadAttribute_TestCluster_ClusterRevision(device, ZCLendpoint, ZCLgroupid) def ClusterThermostat_ReadAttributeLocalTemperature(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): @@ -4529,6 +4547,18 @@ def InitLib(self, chipLib): # Cluster TestCluster ReadAttribute ListStructOctetString self._chipLib.chip_ime_ReadAttribute_TestCluster_ListStructOctetString.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] self._chipLib.chip_ime_ReadAttribute_TestCluster_ListStructOctetString.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute LongOctetString + self._chipLib.chip_ime_ReadAttribute_TestCluster_LongOctetString.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_LongOctetString.restype = ctypes.c_uint32 + # Cluster TestCluster WriteAttribute LongOctetString + self._chipLib.chip_ime_WriteAttribute_TestCluster_LongOctetString.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_char_p, ctypes.c_uint32] + self._chipLib.chip_ime_WriteAttribute_TestCluster_LongOctetString.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute Unsupported + self._chipLib.chip_ime_ReadAttribute_TestCluster_Unsupported.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_Unsupported.restype = ctypes.c_uint32 + # Cluster TestCluster WriteAttribute Unsupported + self._chipLib.chip_ime_WriteAttribute_TestCluster_Unsupported.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint8] + self._chipLib.chip_ime_WriteAttribute_TestCluster_Unsupported.restype = ctypes.c_uint32 # Cluster TestCluster ReadAttribute ClusterRevision self._chipLib.chip_ime_ReadAttribute_TestCluster_ClusterRevision.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] self._chipLib.chip_ime_ReadAttribute_TestCluster_ClusterRevision.restype = ctypes.c_uint32 diff --git a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h index 6f3e9fb08fe147..9231e3e41fed47 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h +++ b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h @@ -1030,6 +1030,10 @@ NS_ASSUME_NONNULL_BEGIN - (void)readAttributeListInt8uWithResponseHandler:(ResponseHandler)responseHandler; - (void)readAttributeListOctetStringWithResponseHandler:(ResponseHandler)responseHandler; - (void)readAttributeListStructOctetStringWithResponseHandler:(ResponseHandler)responseHandler; +- (void)readAttributeLongOctetStringWithResponseHandler:(ResponseHandler)responseHandler; +- (void)writeAttributeLongOctetStringWithValue:(NSData *)value responseHandler:(ResponseHandler)responseHandler; +- (void)readAttributeUnsupportedWithResponseHandler:(ResponseHandler)responseHandler; +- (void)writeAttributeUnsupportedWithValue:(uint8_t)value responseHandler:(ResponseHandler)responseHandler; - (void)readAttributeClusterRevisionWithResponseHandler:(ResponseHandler)responseHandler; @end diff --git a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm index 89e0641e5d630c..051d4822b39c04 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm @@ -15284,6 +15284,116 @@ - (void)readAttributeListStructOctetStringWithResponseHandler:(ResponseHandler)r } } +- (void)readAttributeLongOctetStringWithResponseHandler:(ResponseHandler)responseHandler +{ + CHIPStringAttributeCallbackBridge * onSuccess + = new CHIPStringAttributeCallbackBridge(responseHandler, [self callbackQueue], true); + 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.ReadAttributeLongOctetString(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + responseHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeLongOctetStringWithValue:(NSData *)value 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.WriteAttributeLongOctetString( + onSuccess->Cancel(), onFailure->Cancel(), chip::ByteSpan((const uint8_t *) value.bytes, value.length)); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + responseHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeUnsupportedWithResponseHandler:(ResponseHandler)responseHandler +{ + CHIPBooleanAttributeCallbackBridge * onSuccess = new CHIPBooleanAttributeCallbackBridge(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.ReadAttributeUnsupported(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + responseHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeUnsupportedWithValue:(uint8_t)value 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.WriteAttributeUnsupported(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + 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]); diff --git a/src/darwin/Framework/CHIP/templates/clusters-tests.zapt b/src/darwin/Framework/CHIP/templates/clusters-tests.zapt index 0ee18952ed9355..bf734b4b9d455c 100644 --- a/src/darwin/Framework/CHIP/templates/clusters-tests.zapt +++ b/src/darwin/Framework/CHIP/templates/clusters-tests.zapt @@ -140,6 +140,7 @@ CHIPDevice * GetPairedDevice(uint64_t deviceId) {{>test_cluster tests="TestCluster, Test_3_1_1, Test_3_2_1, Test_3_2_2"}} {{#chip_client_clusters}} +{{#unless (isStrEqual "Test Cluster" name)}} {{#chip_server_cluster_attributes}} - (void)testSendCluster{{asCamelCased parent.name false}}ReadAttribute{{asCamelCased name false}}WithResponseHandler { @@ -180,6 +181,7 @@ CHIPDevice * GetPairedDevice(uint64_t deviceId) } {{/if}} {{/chip_server_cluster_attributes}} +{{/unless}} {{/chip_client_clusters}} @end diff --git a/src/darwin/Framework/CHIP/templates/partials/test_cluster.zapt b/src/darwin/Framework/CHIP/templates/partials/test_cluster.zapt index b87bbf183ac32a..f194f8111789e1 100644 --- a/src/darwin/Framework/CHIP/templates/partials/test_cluster.zapt +++ b/src/darwin/Framework/CHIP/templates/partials/test_cluster.zapt @@ -22,15 +22,21 @@ NSString * {{asCamelCased name true}}Argument= @"{{definedValue}}"; {{/if}} {{else}} - {{chipType}} {{asCamelCased name true}}Argument = {{definedValue}}{{#if (isStrEqual chipType "int64_t")}}LL{{else if (isStrEqual chipType "uint64_t")}}ULL{{/if}}; + {{chipType}} {{asCamelCased name true}}Argument = {{definedValue}}{{asTypeLiteralSuffix chipType}}; {{/if}} {{/chip_tests_item_parameters}} [cluster writeAttribute{{asCamelCased attribute false}}WithValue:{{#chip_tests_item_parameters}}{{asCamelCased name true}}Argument{{/chip_tests_item_parameters}} responseHandler:^(NSError * err, NSDictionary * values) { {{/if}} NSLog(@"{{label}} Error: %@", err); XCTAssertEqual(err.code, {{response.error}}); + {{#unless (isStrEqual "0" response.error)}} + [expectation fulfill]; + {{else}} {{#chip_tests_item_response_parameters}} {{#if hasExpectedValue}} + {{#if isList}} + XCTAssertEqual([values[@"{{#if parent.isReadAttribute}}value{{else}}{{name}}{{/if}}"] count], {{expectedValue.length}}); + {{else}} {{#if (isString type)}} {{#if (isOctetString type)}} NSString * {{asCamelCased name true}}ArgumentString= @"{{expectedValue}}"; @@ -41,11 +47,14 @@ XCTAssertTrue([values[@"{{#if parent.isReadAttribute}}value{{else}}{{name}}{{/if}}"] isEqualToString:{{asCamelCased name true}}Argument]); {{/if}} {{else}} - XCTAssertEqual([values[@"{{#if parent.isReadAttribute}}value{{else}}{{name}}{{/if}}"] {{asObjectiveCNumberType "" type true}}Value], {{expectedValue}}{{#if (isStrEqual chipType "int64_t")}}LL{{else if (isStrEqual chipType "uint64_t")}}ULL{{/if}}); + XCTAssertEqual([values[@"{{#if parent.isReadAttribute}}value{{else}}{{name}}{{/if}}"] {{asObjectiveCNumberType "" type true}}Value], {{expectedValue}}{{asTypeLiteralSuffix}}); + {{/if}} {{/if}} {{/if}} {{/chip_tests_item_response_parameters}} [expectation fulfill]; + + {{/unless}} }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index bf0fa4859e0171..35e5aa29a8e513 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -403,7 +403,7 @@ - (void)testSendClusterTestCluster_000014_WriteAttribute CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint16_t bitmap16Argument = 65535; + uint16_t bitmap16Argument = 65535U; [cluster writeAttributeBitmap16WithValue:bitmap16Argument responseHandler:^(NSError * err, NSDictionary * values) { NSLog(@"Write attribute BITMAP16 Max Value Error: %@", err); @@ -438,7 +438,7 @@ - (void)testSendClusterTestCluster_000016_WriteAttribute CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint16_t bitmap16Argument = 0; + uint16_t bitmap16Argument = 0U; [cluster writeAttributeBitmap16WithValue:bitmap16Argument responseHandler:^(NSError * err, NSDictionary * values) { NSLog(@"Write attribute BITMAP16 Min Value Error: %@", err); @@ -490,7 +490,7 @@ - (void)testSendClusterTestCluster_000019_WriteAttribute CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint32_t bitmap32Argument = 4294967295; + uint32_t bitmap32Argument = 4294967295UL; [cluster writeAttributeBitmap32WithValue:bitmap32Argument responseHandler:^(NSError * err, NSDictionary * values) { NSLog(@"Write attribute BITMAP32 Max Value Error: %@", err); @@ -525,7 +525,7 @@ - (void)testSendClusterTestCluster_000021_WriteAttribute CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint32_t bitmap32Argument = 0; + uint32_t bitmap32Argument = 0UL; [cluster writeAttributeBitmap32WithValue:bitmap32Argument responseHandler:^(NSError * err, NSDictionary * values) { NSLog(@"Write attribute BITMAP32 Min Value Error: %@", err); @@ -563,7 +563,7 @@ - (void)testSendClusterTestCluster_000023_ReadAttribute [cluster readAttributeBitmap64WithResponseHandler:^(NSError * err, NSDictionary * values) { NSLog(@"Read attribute BITMAP64 Default Value Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedLongLongValue], 0ULL); + XCTAssertEqual([values[@"value"] unsignedLongLongValue], 0); [expectation fulfill]; }]; @@ -598,7 +598,7 @@ - (void)testSendClusterTestCluster_000025_ReadAttribute [cluster readAttributeBitmap64WithResponseHandler:^(NSError * err, NSDictionary * values) { NSLog(@"Read attribute BITMAP64 Max Value Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedLongLongValue], 18446744073709551615ULL); + XCTAssertEqual([values[@"value"] unsignedLongLongValue], 18446744073709551615); [expectation fulfill]; }]; @@ -633,7 +633,7 @@ - (void)testSendClusterTestCluster_000027_ReadAttribute [cluster readAttributeBitmap64WithResponseHandler:^(NSError * err, NSDictionary * values) { NSLog(@"Read attribute BITMAP64 Min Value Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedLongLongValue], 0ULL); + XCTAssertEqual([values[@"value"] unsignedLongLongValue], 0); [expectation fulfill]; }]; @@ -751,7 +751,7 @@ - (void)testSendClusterTestCluster_000034_WriteAttribute CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint16_t int16uArgument = 65535; + uint16_t int16uArgument = 65535U; [cluster writeAttributeInt16uWithValue:int16uArgument responseHandler:^(NSError * err, NSDictionary * values) { NSLog(@"Write attribute INT16U Max Value Error: %@", err); @@ -786,7 +786,7 @@ - (void)testSendClusterTestCluster_000036_WriteAttribute CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint16_t int16uArgument = 0; + uint16_t int16uArgument = 0U; [cluster writeAttributeInt16uWithValue:int16uArgument responseHandler:^(NSError * err, NSDictionary * values) { NSLog(@"Write attribute INT16U Min Value Error: %@", err); @@ -838,7 +838,7 @@ - (void)testSendClusterTestCluster_000039_WriteAttribute CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint32_t int32uArgument = 4294967295; + uint32_t int32uArgument = 4294967295UL; [cluster writeAttributeInt32uWithValue:int32uArgument responseHandler:^(NSError * err, NSDictionary * values) { NSLog(@"Write attribute INT32U Max Value Error: %@", err); @@ -873,7 +873,7 @@ - (void)testSendClusterTestCluster_000041_WriteAttribute CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint32_t int32uArgument = 0; + uint32_t int32uArgument = 0UL; [cluster writeAttributeInt32uWithValue:int32uArgument responseHandler:^(NSError * err, NSDictionary * values) { NSLog(@"Write attribute INT32U Min Value Error: %@", err); @@ -911,7 +911,7 @@ - (void)testSendClusterTestCluster_000043_ReadAttribute [cluster readAttributeInt64uWithResponseHandler:^(NSError * err, NSDictionary * values) { NSLog(@"Read attribute INT64U Default Value Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedLongLongValue], 0ULL); + XCTAssertEqual([values[@"value"] unsignedLongLongValue], 0); [expectation fulfill]; }]; @@ -946,7 +946,7 @@ - (void)testSendClusterTestCluster_000045_ReadAttribute [cluster readAttributeInt64uWithResponseHandler:^(NSError * err, NSDictionary * values) { NSLog(@"Read attribute INT64U Max Value Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedLongLongValue], 18446744073709551615ULL); + XCTAssertEqual([values[@"value"] unsignedLongLongValue], 18446744073709551615); [expectation fulfill]; }]; @@ -981,7 +981,7 @@ - (void)testSendClusterTestCluster_000047_ReadAttribute [cluster readAttributeInt64uWithResponseHandler:^(NSError * err, NSDictionary * values) { NSLog(@"Read attribute INT64U Min Value Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedLongLongValue], 0ULL); + XCTAssertEqual([values[@"value"] unsignedLongLongValue], 0); [expectation fulfill]; }]; @@ -1256,7 +1256,7 @@ - (void)testSendClusterTestCluster_000063_WriteAttribute CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - int32_t int32sArgument = 2147483647; + int32_t int32sArgument = 2147483647L; [cluster writeAttributeInt32sWithValue:int32sArgument responseHandler:^(NSError * err, NSDictionary * values) { NSLog(@"Write attribute INT32S Max Value Error: %@", err); @@ -1291,7 +1291,7 @@ - (void)testSendClusterTestCluster_000065_WriteAttribute CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - int32_t int32sArgument = -2147483648; + int32_t int32sArgument = -2147483648L; [cluster writeAttributeInt32sWithValue:int32sArgument responseHandler:^(NSError * err, NSDictionary * values) { NSLog(@"Write attribute INT32S Min Value Error: %@", err); @@ -1326,7 +1326,7 @@ - (void)testSendClusterTestCluster_000067_WriteAttribute CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - int32_t int32sArgument = 0; + int32_t int32sArgument = 0L; [cluster writeAttributeInt32sWithValue:int32sArgument responseHandler:^(NSError * err, NSDictionary * values) { NSLog(@"Write attribute INT32S Default Value Error: %@", err); @@ -1364,7 +1364,7 @@ - (void)testSendClusterTestCluster_000069_ReadAttribute [cluster readAttributeInt64sWithResponseHandler:^(NSError * err, NSDictionary * values) { NSLog(@"Read attribute INT64S Default Value Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] longLongValue], 0LL); + XCTAssertEqual([values[@"value"] longLongValue], 0); [expectation fulfill]; }]; @@ -1399,7 +1399,7 @@ - (void)testSendClusterTestCluster_000071_ReadAttribute [cluster readAttributeInt64sWithResponseHandler:^(NSError * err, NSDictionary * values) { NSLog(@"Read attribute INT64S Max Value Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] longLongValue], 9223372036854775807LL); + XCTAssertEqual([values[@"value"] longLongValue], 9223372036854775807); [expectation fulfill]; }]; @@ -1434,7 +1434,7 @@ - (void)testSendClusterTestCluster_000073_ReadAttribute [cluster readAttributeInt64sWithResponseHandler:^(NSError * err, NSDictionary * values) { NSLog(@"Read attribute INT64S Min Value Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] longLongValue], -9223372036854775807LL); + XCTAssertEqual([values[@"value"] longLongValue], -9223372036854775807); [expectation fulfill]; }]; @@ -1469,7 +1469,7 @@ - (void)testSendClusterTestCluster_000075_ReadAttribute [cluster readAttributeInt64sWithResponseHandler:^(NSError * err, NSDictionary * values) { NSLog(@"Read attribute INT64S Default Value Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] longLongValue], 0LL); + XCTAssertEqual([values[@"value"] longLongValue], 0); [expectation fulfill]; }]; @@ -1587,7 +1587,7 @@ - (void)testSendClusterTestCluster_000082_WriteAttribute CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint16_t enum16Argument = 65535; + uint16_t enum16Argument = 65535U; [cluster writeAttributeEnum16WithValue:enum16Argument responseHandler:^(NSError * err, NSDictionary * values) { NSLog(@"Write attribute ENUM16 Max Value Error: %@", err); @@ -1622,7 +1622,7 @@ - (void)testSendClusterTestCluster_000084_WriteAttribute CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint16_t enum16Argument = 0; + uint16_t enum16Argument = 0U; [cluster writeAttributeEnum16WithValue:enum16Argument responseHandler:^(NSError * err, NSDictionary * values) { NSLog(@"Write attribute ENUM16 Min Value Error: %@", err); @@ -1763,6 +1763,173 @@ - (void)testSendClusterTestCluster_000091_WriteAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTestCluster_000092_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute LONG_OCTET_STRING Default Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeLongOctetStringWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read attribute LONG_OCTET_STRING Default Value Error: %@", err); + XCTAssertEqual(err.code, 0); + NSString * longOctetStringArgumentString = @""; + NSData * longOctetStringArgument = [longOctetStringArgumentString dataUsingEncoding:NSUTF8StringEncoding]; + XCTAssertTrue([values[@"value"] isEqualToData:longOctetStringArgument]); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestCluster_000093_WriteAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute LONG_OCTET_STRING"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + NSString * longOctetStringArgumentString + = @"11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + @"11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + @"11111111111111111111111111111111111111111111111111111111111111"; + NSData * longOctetStringArgument = [longOctetStringArgumentString dataUsingEncoding:NSUTF8StringEncoding]; + [cluster writeAttributeLongOctetStringWithValue:longOctetStringArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Write attribute LONG_OCTET_STRING Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestCluster_000094_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute LONG_OCTET_STRING"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeLongOctetStringWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read attribute LONG_OCTET_STRING Error: %@", err); + XCTAssertEqual(err.code, 0); + NSString * longOctetStringArgumentString + = @"1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + @"1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + @"1111111111111111111111111111111111111111111111111111111111111111111111"; + NSData * longOctetStringArgument = [longOctetStringArgumentString dataUsingEncoding:NSUTF8StringEncoding]; + XCTAssertTrue([values[@"value"] isEqualToData:longOctetStringArgument]); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestCluster_000095_WriteAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute LONG_OCTET_STRING"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + NSString * longOctetStringArgumentString = @""; + NSData * longOctetStringArgument = [longOctetStringArgumentString dataUsingEncoding:NSUTF8StringEncoding]; + [cluster writeAttributeLongOctetStringWithValue:longOctetStringArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Write attribute LONG_OCTET_STRING Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestCluster_000096_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute LIST"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeListInt8uWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read attribute LIST Error: %@", err); + XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] count], 4); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestCluster_000097_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute LIST_OCTET_STRING"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeListOctetStringWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read attribute LIST_OCTET_STRING Error: %@", err); + XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] count], 4); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestCluster_000098_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute LIST_STRUCT_OCTET_STRING"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeListStructOctetStringWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read attribute LIST_STRUCT_OCTET_STRING Error: %@", err); + XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] count], 4); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestCluster_000099_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute UNSUPPORTED"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeUnsupportedWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read attribute UNSUPPORTED Error: %@", err); + XCTAssertEqual(err.code, 1); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestCluster_000100_WriteAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Writeattribute UNSUPPORTED"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t unsupportedArgument = 0; + [cluster writeAttributeUnsupportedWithValue:unsupportedArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Writeattribute UNSUPPORTED Error: %@", err); + XCTAssertEqual(err.code, 1); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} - (void)testSendClusterTest_3_1_1_000000_ReadAttribute { @@ -1943,7 +2110,7 @@ - (void)testSendClusterTest_3_2_1_000006_WriteAttribute CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint16_t onTimeArgument = 0; + uint16_t onTimeArgument = 0U; [cluster writeAttributeOnTimeWithValue:onTimeArgument responseHandler:^(NSError * err, NSDictionary * values) { NSLog(@"write the default value to LT attribute: OnTime Error: %@", err); @@ -1961,7 +2128,7 @@ - (void)testSendClusterTest_3_2_1_000007_WriteAttribute CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint16_t offWaitTimeArgument = 0; + uint16_t offWaitTimeArgument = 0U; [cluster writeAttributeOffWaitTimeWithValue:offWaitTimeArgument responseHandler:^(NSError * err, NSDictionary * values) { NSLog(@"write the default value to LT attribute: OffWaitTime Error: %@", err); @@ -6342,673 +6509,6 @@ - (void)testSendClusterTemperatureMeasurementReadAttributeClusterRevisionWithRes [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTestClusterReadAttributeBooleanWithResponseHandler -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeBooleanWithResponseHandler"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBooleanWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster Boolean Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestClusterWriteAttributeBooleanWithValue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeBooleanWithValue"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - uint8_t value = 0; - [cluster writeAttributeBooleanWithValue:value - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster Boolean Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestClusterReadAttributeBitmap8WithResponseHandler -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeBitmap8WithResponseHandler"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBitmap8WithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster Bitmap8 Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestClusterWriteAttributeBitmap8WithValue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeBitmap8WithValue"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - uint8_t value = 0; - [cluster writeAttributeBitmap8WithValue:value - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster Bitmap8 Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestClusterReadAttributeBitmap16WithResponseHandler -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeBitmap16WithResponseHandler"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBitmap16WithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster Bitmap16 Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestClusterWriteAttributeBitmap16WithValue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeBitmap16WithValue"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - uint16_t value = 0; - [cluster writeAttributeBitmap16WithValue:value - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster Bitmap16 Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestClusterReadAttributeBitmap32WithResponseHandler -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeBitmap32WithResponseHandler"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBitmap32WithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster Bitmap32 Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestClusterWriteAttributeBitmap32WithValue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeBitmap32WithValue"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - uint32_t value = 0; - [cluster writeAttributeBitmap32WithValue:value - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster Bitmap32 Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestClusterReadAttributeBitmap64WithResponseHandler -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeBitmap64WithResponseHandler"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBitmap64WithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster Bitmap64 Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestClusterWriteAttributeBitmap64WithValue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeBitmap64WithValue"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - uint64_t value = 0; - [cluster writeAttributeBitmap64WithValue:value - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster Bitmap64 Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestClusterReadAttributeInt8uWithResponseHandler -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeInt8uWithResponseHandler"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt8uWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster Int8u Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestClusterWriteAttributeInt8uWithValue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeInt8uWithValue"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - uint8_t value = 0; - [cluster writeAttributeInt8uWithValue:value - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster Int8u Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestClusterReadAttributeInt16uWithResponseHandler -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeInt16uWithResponseHandler"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt16uWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster Int16u Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestClusterWriteAttributeInt16uWithValue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeInt16uWithValue"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - uint16_t value = 0; - [cluster writeAttributeInt16uWithValue:value - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster Int16u Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestClusterReadAttributeInt32uWithResponseHandler -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeInt32uWithResponseHandler"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt32uWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster Int32u Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestClusterWriteAttributeInt32uWithValue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeInt32uWithValue"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - uint32_t value = 0; - [cluster writeAttributeInt32uWithValue:value - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster Int32u Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestClusterReadAttributeInt64uWithResponseHandler -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeInt64uWithResponseHandler"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt64uWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster Int64u Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestClusterWriteAttributeInt64uWithValue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeInt64uWithValue"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - uint64_t value = 0; - [cluster writeAttributeInt64uWithValue:value - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster Int64u Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestClusterReadAttributeInt8sWithResponseHandler -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeInt8sWithResponseHandler"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt8sWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster Int8s Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestClusterWriteAttributeInt8sWithValue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeInt8sWithValue"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - int8_t value = 0; - [cluster writeAttributeInt8sWithValue:value - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster Int8s Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestClusterReadAttributeInt16sWithResponseHandler -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeInt16sWithResponseHandler"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt16sWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster Int16s Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestClusterWriteAttributeInt16sWithValue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeInt16sWithValue"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - int16_t value = 0; - [cluster writeAttributeInt16sWithValue:value - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster Int16s Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestClusterReadAttributeInt32sWithResponseHandler -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeInt32sWithResponseHandler"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt32sWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster Int32s Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestClusterWriteAttributeInt32sWithValue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeInt32sWithValue"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - int32_t value = 0; - [cluster writeAttributeInt32sWithValue:value - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster Int32s Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestClusterReadAttributeInt64sWithResponseHandler -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeInt64sWithResponseHandler"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeInt64sWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster Int64s Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestClusterWriteAttributeInt64sWithValue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeInt64sWithValue"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - int64_t value = 0; - [cluster writeAttributeInt64sWithValue:value - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster Int64s Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestClusterReadAttributeEnum8WithResponseHandler -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeEnum8WithResponseHandler"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnum8WithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster Enum8 Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestClusterWriteAttributeEnum8WithValue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeEnum8WithValue"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - uint8_t value = 0; - [cluster writeAttributeEnum8WithValue:value - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster Enum8 Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestClusterReadAttributeEnum16WithResponseHandler -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeEnum16WithResponseHandler"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnum16WithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster Enum16 Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestClusterWriteAttributeEnum16WithValue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeEnum16WithValue"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - uint16_t value = 0; - [cluster writeAttributeEnum16WithValue:value - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster Enum16 Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestClusterReadAttributeOctetStringWithResponseHandler -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeOctetStringWithResponseHandler"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOctetStringWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster OctetString Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestClusterWriteAttributeOctetStringWithValue -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeOctetStringWithValue"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - NSData * value = [@"Test" dataUsingEncoding:NSUTF8StringEncoding]; - [cluster writeAttributeOctetStringWithValue:value - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster OctetString Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestClusterReadAttributeListInt8uWithResponseHandler -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeListInt8uWithResponseHandler"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeListInt8uWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster ListInt8u Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestClusterReadAttributeListOctetStringWithResponseHandler -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"TestClusterReadAttributeListOctetStringWithResponseHandler"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeListOctetStringWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster ListOctetString Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestClusterReadAttributeListStructOctetStringWithResponseHandler -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"TestClusterReadAttributeListStructOctetStringWithResponseHandler"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeListStructOctetStringWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster ListStructOctetString Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - -- (void)testSendClusterTestClusterReadAttributeClusterRevisionWithResponseHandler -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"TestClusterReadAttributeClusterRevisionWithResponseHandler"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeClusterRevisionWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"TestCluster ClusterRevision Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - - (void)testSendClusterThermostatReadAttributeLocalTemperatureWithResponseHandler { XCTestExpectation * expectation =