From dab17fb378ffc342d94b754a8f03f8d034b9addf Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Tue, 4 May 2021 19:18:41 +0200 Subject: [PATCH] Add a Test Cluster in order to validate the generation/implementation of the Data Model (#6445) * Add a Test Cluster * Activate the Test Cluster server into multiples ZAP configuration * Update Darwin tests to use the Test Cluster * Update gen/ folders --- .../all-clusters-common/all-clusters-app.zap | 1104 ++++++++-- .../gen/IMClusterCommandHandler.cpp | 41 + .../all-clusters-common/gen/attribute-id.h | 23 + .../gen/attribute-size.cpp | 29 + .../gen/call-command-handler.cpp | 32 + .../all-clusters-common/gen/callback-stub.cpp | 8 + .../all-clusters-common/gen/callback.h | 96 + .../gen/client-command-macro.h | 28 + .../all-clusters-common/gen/cluster-id.h | 3 + .../all-clusters-common/gen/command-id.h | 6 + .../all-clusters-common/gen/endpoint_config.h | 285 ++- .../all-clusters-common/gen/gen_config.h | 6 + .../all-clusters-common/gen/print-cluster.h | 7 + .../esp32/main/CMakeLists.txt | 1 + .../all-clusters-app/esp32/main/component.mk | 1 + .../bridge-common/gen/attribute-id.h | 23 + .../bridge-common/gen/client-command-macro.h | 28 + .../bridge-app/bridge-common/gen/cluster-id.h | 3 + .../bridge-app/bridge-common/gen/command-id.h | 6 + .../bridge-common/gen/print-cluster.h | 7 + examples/chip-tool/chip-tool.zap | 349 +++- .../chip-tool/commands/clusters/Commands.h | 1773 +++++++++++++++-- .../chip-tool/gen/CHIPClientCallbacks.cpp | 33 + examples/chip-tool/gen/CHIPClientCallbacks.h | 2 + examples/chip-tool/gen/CHIPClusters.cpp | 356 ++++ examples/chip-tool/gen/CHIPClusters.h | 71 + examples/chip-tool/gen/CHIPClustersObjc.h | 47 + examples/chip-tool/gen/CHIPClustersObjc.mm | 1160 ++++++++++- .../chip-tool/gen/IMClusterCommandHandler.cpp | 87 + examples/chip-tool/gen/attribute-id.h | 23 + .../chip-tool/gen/call-command-handler.cpp | 33 + examples/chip-tool/gen/callback-stub.cpp | 8 + examples/chip-tool/gen/callback.h | 85 + examples/chip-tool/gen/client-command-macro.h | 28 + examples/chip-tool/gen/cluster-id.h | 3 + examples/chip-tool/gen/command-id.h | 6 + examples/chip-tool/gen/endpoint_config.h | 26 +- examples/chip-tool/gen/gen_config.h | 5 + examples/chip-tool/gen/print-cluster.h | 7 + examples/chip-tool/templates/commands.zapt | 24 + .../lighting-common/gen/attribute-id.h | 23 + .../gen/client-command-macro.h | 28 + .../lighting-common/gen/cluster-id.h | 3 + .../lighting-common/gen/command-id.h | 6 + .../lighting-common/gen/print-cluster.h | 7 + .../lock-app/lock-common/gen/attribute-id.h | 23 + .../lock-common/gen/client-command-macro.h | 28 + .../lock-app/lock-common/gen/cluster-id.h | 3 + .../lock-app/lock-common/gen/command-id.h | 6 + .../lock-app/lock-common/gen/print-cluster.h | 7 + .../esp32/main/gen/attribute-id.h | 23 + .../esp32/main/gen/client-command-macro.h | 28 + .../esp32/main/gen/cluster-id.h | 3 + .../esp32/main/gen/command-id.h | 6 + .../esp32/main/gen/print-cluster.h | 7 + examples/tv-app/tv-common/gen/attribute-id.h | 23 + .../tv-common/gen/client-command-macro.h | 28 + examples/tv-app/tv-common/gen/cluster-id.h | 3 + examples/tv-app/tv-common/gen/command-id.h | 6 + examples/tv-app/tv-common/gen/print-cluster.h | 7 + examples/window-app/common/gen/attribute-id.h | 23 + .../common/gen/client-command-macro.h | 28 + examples/window-app/common/gen/cluster-id.h | 3 + examples/window-app/common/gen/command-id.h | 6 + .../window-app/common/gen/print-cluster.h | 7 + src/app/chip-zcl-zpro-codec-api.h | 281 +++ .../test-cluster-server.cpp | 63 + src/app/encoder.cpp | 453 +++++ src/app/util/util.cpp | 6 + .../templates/app/CHIPClustersObjc-src.zapt | 80 +- src/app/zap-templates/zcl/test-cluster.xml | 82 + src/app/zap-templates/zcl/zcl.json | 1 + src/app/zap_cluster_list.py | 2 + src/controller/controller-clusters.zap | 343 +++- .../python/chip/clusters/CHIPClusters.cpp | 180 ++ .../python/chip/clusters/CHIPClusters.py | 134 ++ .../python/gen/CHIPClientCallbacks.cpp | 33 + .../python/gen/CHIPClientCallbacks.h | 2 + src/controller/python/gen/CHIPClusters.cpp | 356 ++++ src/controller/python/gen/CHIPClusters.h | 71 + src/controller/python/gen/CHIPClustersObjc.h | 47 + src/controller/python/gen/CHIPClustersObjc.mm | 1160 ++++++++++- .../python/gen/IMClusterCommandHandler.cpp | 87 + src/controller/python/gen/attribute-id.h | 23 + .../python/gen/call-command-handler.cpp | 33 + src/controller/python/gen/callback-stub.cpp | 8 + src/controller/python/gen/callback.h | 85 + .../python/gen/client-command-macro.h | 28 + src/controller/python/gen/cluster-id.h | 3 + src/controller/python/gen/command-id.h | 6 + src/controller/python/gen/endpoint_config.h | 26 +- src/controller/python/gen/gen_config.h | 5 + src/controller/python/gen/print-cluster.h | 7 + src/controller/python/local-clusters.zap | 343 +++- src/darwin/Framework/CHIP/chip-tool.zap | 353 +++- .../CHIP/gen/CHIPClientCallbacks.cpp | 33 + .../Framework/CHIP/gen/CHIPClientCallbacks.h | 2 + .../Framework/CHIP/gen/CHIPClusters.cpp | 356 ++++ src/darwin/Framework/CHIP/gen/CHIPClusters.h | 71 + .../Framework/CHIP/gen/CHIPClustersObjc.h | 47 + .../Framework/CHIP/gen/CHIPClustersObjc.mm | 1160 ++++++++++- .../CHIP/gen/IMClusterCommandHandler.cpp | 87 + src/darwin/Framework/CHIP/gen/attribute-id.h | 23 + .../CHIP/gen/call-command-handler.cpp | 33 + .../Framework/CHIP/gen/callback-stub.cpp | 8 + src/darwin/Framework/CHIP/gen/callback.h | 85 + .../Framework/CHIP/gen/client-command-macro.h | 28 + src/darwin/Framework/CHIP/gen/cluster-id.h | 3 + src/darwin/Framework/CHIP/gen/command-id.h | 6 + .../Framework/CHIP/gen/endpoint_config.h | 26 +- src/darwin/Framework/CHIP/gen/gen_config.h | 5 + src/darwin/Framework/CHIP/gen/print-cluster.h | 7 + .../CHIP/templates/clusters-tests.zapt | 55 +- src/darwin/Framework/CHIP/templates/helper.js | 40 +- .../Framework/CHIPTests/CHIPClustersTests.m | 861 ++++++-- 115 files changed, 12638 insertions(+), 797 deletions(-) create mode 100644 src/app/clusters/test-cluster-server/test-cluster-server.cpp create mode 100644 src/app/zap-templates/zcl/test-cluster.xml diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index 8c5d88e91d88be..8f3b7d2ba614a7 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 @@ -3691,6 +3691,347 @@ } ] }, + { + "name": "Test Cluster", + "code": 1295, + "mfgCode": null, + "define": "TEST_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "Test", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "TestNotHandled", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "TestSpecific", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Test Cluster", + "code": 1295, + "mfgCode": null, + "define": "TEST_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "TestSpecificResponse", + "code": 0, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "boolean", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "false", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "bitmap8", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "bitmap16", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "bitmap32", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "bitmap64", + "code": 4, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int8u", + "code": 5, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int16u", + "code": 6, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int32u", + "code": 8, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int64u", + "code": 12, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int8s", + "code": 13, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int16s", + "code": 14, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int32s", + "code": 16, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int64s", + "code": 20, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "enum8", + "code": 21, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "enum16", + "code": 22, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "octet_string", + "code": 25, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "list_int8u", + "code": 26, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, { "name": "Binding", "code": 61440, @@ -7237,105 +7578,330 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "primary 6 y", + "code": 41, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "primary 6 intensity", + "code": 42, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "white point x", + "code": 48, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "white point y", + "code": 49, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "color point r x", + "code": 50, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "color point r y", + "code": 51, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "color point r intensity", + "code": 52, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "color point g x", + "code": 54, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "color point g y", + "code": 55, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "color point g intensity", + "code": 56, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "color point b x", + "code": 58, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "color point b y", + "code": 59, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "color point b intensity", + "code": 60, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "enhanced current hue", + "code": 16384, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "enhanced color mode", + "code": 16385, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x01", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "primary 6 y", - "code": 41, + "name": "color loop active", + "code": 16386, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0x00", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "primary 6 intensity", - "code": 42, + "name": "color loop direction", + "code": 16387, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0x00", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "white point x", - "code": 48, + "name": "color loop time", + "code": 16388, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0x0019", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "white point y", - "code": 49, + "name": "color capabilities", + "code": 16394, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0x0000", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "color point r x", - "code": 50, + "name": "color temp physical min", + "code": 16395, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0x0000", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "color point r y", - "code": 51, + "name": "color temp physical max", + "code": 16396, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0xFEFF", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "color point r intensity", - "code": 52, + "name": "couple color temp to level min-mireds", + "code": 16397, "mfgCode": null, "side": "server", "included": 1, @@ -7349,8 +7915,8 @@ "reportableChange": 0 }, { - "name": "color point g x", - "code": 54, + "name": "start up color temperature mireds", + "code": 16400, "mfgCode": null, "side": "server", "included": 1, @@ -7364,128 +7930,198 @@ "reportableChange": 0 }, { - "name": "color point g y", - "code": 55, + "name": "cluster revision", + "code": 65533, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "3", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 - }, + } + ] + }, + { + "name": "Temperature Measurement", + "code": 1026, + "mfgCode": null, + "define": "TEMP_MEASUREMENT_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [ { - "name": "color point g intensity", - "code": 56, + "name": "cluster revision", + "code": 65533, "mfgCode": null, - "side": "server", + "side": "client", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "3", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 - }, + } + ] + }, + { + "name": "Temperature Measurement", + "code": 1026, + "mfgCode": null, + "define": "TEMP_MEASUREMENT_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ { - "name": "color point b x", - "code": 58, + "name": "measured value", + "code": 0, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", - "reportable": 0, + "defaultValue": "0x8000", + "reportable": 1, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "color point b y", - "code": 59, + "name": "min measured value", + "code": 1, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0x8000", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "color point b intensity", - "code": 60, + "name": "max measured value", + "code": 2, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0x8000", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "enhanced current hue", - "code": 16384, + "name": "tolerance", + "code": 3, "mfgCode": null, "side": "server", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0000", - "reportable": 0, + "defaultValue": "", + "reportable": 1, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "enhanced color mode", - "code": 16385, + "name": "cluster revision", + "code": 65533, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x01", + "defaultValue": "3", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 - }, + } + ] + }, + { + "name": "IAS Zone", + "code": 1280, + "mfgCode": null, + "define": "IAS_ZONE_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ { - "name": "color loop active", - "code": 16386, + "name": "ZoneEnrollResponse", + "code": 0, "mfgCode": null, - "side": "server", + "source": "client", + "incoming": 1, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x00", + "defaultValue": "2", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 + } + ] + }, + { + "name": "IAS Zone", + "code": 1280, + "mfgCode": null, + "define": "IAS_ZONE_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "ZoneStatusChangeNotification", + "code": 0, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 }, { - "name": "color loop direction", - "code": 16387, + "name": "ZoneEnrollRequest", + "code": 1, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "zone state", + "code": 0, "mfgCode": null, "side": "server", "included": 1, @@ -7499,23 +8135,23 @@ "reportableChange": 0 }, { - "name": "color loop time", - "code": 16388, + "name": "zone type", + "code": 1, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0019", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "color capabilities", - "code": 16394, + "name": "zone status", + "code": 2, "mfgCode": null, "side": "server", "included": 1, @@ -7529,65 +8165,96 @@ "reportableChange": 0 }, { - "name": "color temp physical min", - "code": 16395, + "name": "IAS CIE address", + "code": 16, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0000", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "color temp physical max", - "code": 16396, + "name": "Zone ID", + "code": 17, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0xFEFF", + "defaultValue": "0xff", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "couple color temp to level min-mireds", - "code": 16397, + "name": "cluster revision", + "code": 65533, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "2", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 - }, + } + ] + }, + { + "name": "Low Power", + "code": 1288, + "mfgCode": null, + "define": "LOW_POWER_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ { - "name": "start up color temperature mireds", - "code": 16400, + "name": "Sleep", + "code": 0, "mfgCode": null, - "side": "server", + "source": "client", + "incoming": 1, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0x0001", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 - }, + } + ] + }, + { + "name": "Low Power", + "code": 1288, + "mfgCode": null, + "define": "LOW_POWER_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ { "name": "cluster revision", "code": 65533, @@ -7597,7 +8264,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "0x0001", "reportable": 0, "minInterval": 0, "maxInterval": 65344, @@ -7606,10 +8273,10 @@ ] }, { - "name": "Temperature Measurement", - "code": 1026, + "name": "Application Basic", + "code": 1293, "mfgCode": null, - "define": "TEMP_MEASUREMENT_CLUSTER", + "define": "APPLICATION_BASIC_CLUSTER", "side": "client", "enabled": 0, "commands": [], @@ -7623,7 +8290,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "0x0001", "reportable": 0, "minInterval": 0, "maxInterval": 65344, @@ -7632,16 +8299,16 @@ ] }, { - "name": "Temperature Measurement", - "code": 1026, + "name": "Application Basic", + "code": 1293, "mfgCode": null, - "define": "TEMP_MEASUREMENT_CLUSTER", + "define": "APPLICATION_BASIC_CLUSTER", "side": "server", "enabled": 1, "commands": [], "attributes": [ { - "name": "measured value", + "name": "vendor name", "code": 0, "mfgCode": null, "side": "server", @@ -7649,14 +8316,14 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x8000", - "reportable": 1, + "defaultValue": "", + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "min measured value", + "name": "vendor id", "code": 1, "mfgCode": null, "side": "server", @@ -7664,14 +8331,14 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x8000", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "max measured value", + "name": "application name", "code": 2, "mfgCode": null, "side": "server", @@ -7679,23 +8346,68 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x8000", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "tolerance", + "name": "product id", "code": 3, "mfgCode": null, "side": "server", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, "defaultValue": "", - "reportable": 1, + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "application id", + "code": 5, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "catalog vendor id", + "code": 6, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "application satus", + "code": 7, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x01", + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -7709,7 +8421,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "0x0001", "reportable": 0, "minInterval": 0, "maxInterval": 65344, @@ -7718,20 +8430,28 @@ ] }, { - "name": "IAS Zone", - "code": 1280, + "name": "Test Cluster", + "code": 1295, "mfgCode": null, - "define": "IAS_ZONE_CLUSTER", + "define": "TEST_CLUSTER", "side": "client", "enabled": 0, "commands": [ { - "name": "ZoneEnrollResponse", + "name": "Test", "code": 0, "mfgCode": null, "source": "client", "incoming": 1, "outgoing": 1 + }, + { + "name": "TestSpecific", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 } ], "attributes": [ @@ -7744,7 +8464,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "0x0001", "reportable": 0, "minInterval": 0, "maxInterval": 65344, @@ -7753,33 +8473,25 @@ ] }, { - "name": "IAS Zone", - "code": 1280, + "name": "Test Cluster", + "code": 1295, "mfgCode": null, - "define": "IAS_ZONE_CLUSTER", + "define": "TEST_CLUSTER", "side": "server", "enabled": 1, "commands": [ { - "name": "ZoneStatusChangeNotification", + "name": "TestSpecificResponse", "code": 0, "mfgCode": null, "source": "server", "incoming": 1, "outgoing": 1 - }, - { - "name": "ZoneEnrollRequest", - "code": 1, - "mfgCode": null, - "source": "server", - "incoming": 1, - "outgoing": 1 } ], "attributes": [ { - "name": "zone state", + "name": "boolean", "code": 0, "mfgCode": null, "side": "server", @@ -7787,14 +8499,14 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x00", + "defaultValue": "false", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "zone type", + "name": "bitmap8", "code": 1, "mfgCode": null, "side": "server", @@ -7802,14 +8514,14 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "zone status", + "name": "bitmap16", "code": 2, "mfgCode": null, "side": "server", @@ -7817,233 +8529,195 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0000", + "defaultValue": "0", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "IAS CIE address", - "code": 16, + "name": "bitmap32", + "code": 3, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "Zone ID", - "code": 17, + "name": "bitmap64", + "code": 4, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0xff", + "defaultValue": "0", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "cluster revision", - "code": 65533, + "name": "int8u", + "code": 5, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "0", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 - } - ] - }, - { - "name": "Low Power", - "code": 1288, - "mfgCode": null, - "define": "LOW_POWER_CLUSTER", - "side": "client", - "enabled": 0, - "commands": [ + }, { - "name": "Sleep", - "code": 0, + "name": "int16u", + "code": 6, "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - } - ], - "attributes": [ + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, { - "name": "cluster revision", - "code": 65533, + "name": "int32u", + "code": 8, "mfgCode": null, - "side": "client", + "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "0", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 - } - ] - }, - { - "name": "Low Power", - "code": 1288, - "mfgCode": null, - "define": "LOW_POWER_CLUSTER", - "side": "server", - "enabled": 1, - "commands": [], - "attributes": [ + }, { - "name": "cluster revision", - "code": 65533, + "name": "int64u", + "code": 12, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "0", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 - } - ] - }, - { - "name": "Application Basic", - "code": 1293, - "mfgCode": null, - "define": "APPLICATION_BASIC_CLUSTER", - "side": "client", - "enabled": 0, - "commands": [], - "attributes": [ + }, { - "name": "cluster revision", - "code": 65533, + "name": "int8s", + "code": 13, "mfgCode": null, - "side": "client", + "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "0", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 - } - ] - }, - { - "name": "Application Basic", - "code": 1293, - "mfgCode": null, - "define": "APPLICATION_BASIC_CLUSTER", - "side": "server", - "enabled": 1, - "commands": [], - "attributes": [ + }, { - "name": "vendor name", - "code": 0, + "name": "int16s", + "code": 14, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "vendor id", - "code": 1, + "name": "int32s", + "code": 16, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "application name", - "code": 2, + "name": "int64s", + "code": 20, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "product id", - "code": 3, + "name": "enum8", + "code": 21, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "application id", - "code": 5, + "name": "enum16", + "code": 22, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "catalog vendor id", - "code": 6, + "name": "octet_string", + "code": 25, "mfgCode": null, "side": "server", "included": 1, @@ -8057,15 +8731,15 @@ "reportableChange": 0 }, { - "name": "application satus", - "code": 7, + "name": "list_int8u", + "code": 26, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x01", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, @@ -11204,4 +11878,4 @@ } ], "log": [] -} \ No newline at end of file +} diff --git a/examples/all-clusters-app/all-clusters-common/gen/IMClusterCommandHandler.cpp b/examples/all-clusters-app/all-clusters-common/gen/IMClusterCommandHandler.cpp index 5e448886555b09..add9c631d73289 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/IMClusterCommandHandler.cpp +++ b/examples/all-clusters-app/all-clusters-common/gen/IMClusterCommandHandler.cpp @@ -7846,6 +7846,44 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // namespace Scenes +namespace TestCluster { + +void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) +{ + { + switch (aCommandId) + { + case ZCL_TEST_COMMAND_ID: { + + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfTestClusterClusterTestCallback(apCommandObj); + break; + } + case ZCL_TEST_NOT_HANDLED_COMMAND_ID: { + + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfTestClusterClusterTestNotHandledCallback(apCommandObj); + break; + } + case ZCL_TEST_SPECIFIC_COMMAND_ID: { + + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfTestClusterClusterTestSpecificCallback(apCommandObj); + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_TEST_CLUSTER_ID); + break; + } + } + } +} + +} // namespace TestCluster + } // namespace clusters void DispatchSingleClusterCommand(chip::ClusterId aClusterId, chip::CommandId aCommandId, chip::EndpointId aEndPointId, @@ -7906,6 +7944,9 @@ void DispatchSingleClusterCommand(chip::ClusterId aClusterId, chip::CommandId aC case ZCL_SCENES_CLUSTER_ID: clusters::Scenes::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader); break; + case ZCL_TEST_CLUSTER_ID: + clusters::TestCluster::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader); + break; default: // Unrecognized cluster ID, error status will apply. apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, Protocols::SecureChannel::Id, diff --git a/examples/all-clusters-app/all-clusters-common/gen/attribute-id.h b/examples/all-clusters-app/all-clusters-common/gen/attribute-id.h index 8e7aa393464caf..e4691450f06d9c 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/attribute-id.h +++ b/examples/all-clusters-app/all-clusters-common/gen/attribute-id.h @@ -1240,6 +1240,29 @@ // Server attributes +// Attribute ids for cluster: Test Cluster + +// Client attributes + +// Server attributes +#define ZCL_BOOLEAN_ATTRIBUTE_ID (0x0000) +#define ZCL_BITMAP8_ATTRIBUTE_ID (0x0001) +#define ZCL_BITMAP16_ATTRIBUTE_ID (0x0002) +#define ZCL_BITMAP32_ATTRIBUTE_ID (0x0003) +#define ZCL_BITMAP64_ATTRIBUTE_ID (0x0004) +#define ZCL_INT8_U_ATTRIBUTE_ID (0x0005) +#define ZCL_INT16_U_ATTRIBUTE_ID (0x0006) +#define ZCL_INT32_U_ATTRIBUTE_ID (0x0008) +#define ZCL_INT64_U_ATTRIBUTE_ID (0x000C) +#define ZCL_INT8_S_ATTRIBUTE_ID (0x000D) +#define ZCL_INT16_S_ATTRIBUTE_ID (0x000E) +#define ZCL_INT32_S_ATTRIBUTE_ID (0x0010) +#define ZCL_INT64_S_ATTRIBUTE_ID (0x0014) +#define ZCL_ENUM8_ATTRIBUTE_ID (0x0015) +#define ZCL_ENUM16_ATTRIBUTE_ID (0x0016) +#define ZCL_OCTET_STRING_ATTRIBUTE_ID (0x0019) +#define ZCL_LIST_ATTRIBUTE_ID (0x001A) + // Attribute ids for cluster: Generic Tunnel // Client attributes diff --git a/examples/all-clusters-app/all-clusters-common/gen/attribute-size.cpp b/examples/all-clusters-app/all-clusters-common/gen/attribute-size.cpp index a2af3ffbbeb79c..a5e65dbe0558d9 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/attribute-size.cpp +++ b/examples/all-clusters-app/all-clusters-common/gen/attribute-size.cpp @@ -219,6 +219,26 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } break; } + case 0x050F: // Test Cluster Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (am->attributeId) + { + case 0x001A: // list_int8u + { + entryLength = 1; + if (((index - 1) * entryLength) > (am->size - entryLength)) + { + ChipLogError(Zcl, "Index %l is invalid.", index); + return 0; + } + entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); + copyListMember(dest, src, write, &entryOffset, entryLength); // INT8U + break; + } + } + break; + } } return entryLength; @@ -281,6 +301,15 @@ uint16_t emberAfAttributeValueListSize(ClusterId clusterId, AttributeId attribut break; } break; + case 0x050F: // Test Cluster Cluster + switch (attributeId) + { + case 0x001A: // list_int8u + // uint8_t + entryLength = 1; + break; + } + break; } uint32_t totalSize = kSizeLengthInBytes + (entryCount * entryLength); diff --git a/examples/all-clusters-app/all-clusters-common/gen/call-command-handler.cpp b/examples/all-clusters-app/all-clusters-common/gen/call-command-handler.cpp index 359ea148d3e8b3..73343ad86fb48c 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/call-command-handler.cpp +++ b/examples/all-clusters-app/all-clusters-common/gen/call-command-handler.cpp @@ -51,6 +51,7 @@ EmberAfStatus emberAfPumpConfigurationAndControlClusterServerCommandParse(EmberA EmberAfStatus emberAfScenesClusterServerCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfSwitchClusterServerCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfTemperatureMeasurementClusterServerCommandParse(EmberAfClusterCommand * cmd); +EmberAfStatus emberAfTestClusterClusterServerCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfThermostatClusterServerCommandParse(EmberAfClusterCommand * cmd); static EmberAfStatus status(bool wasHandled, bool clusterExists, bool mfgSpecific) @@ -168,6 +169,9 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd) // No commands are enabled for cluster Temperature Measurement result = status(false, true, cmd->mfgSpecific); break; + case ZCL_TEST_CLUSTER_ID: + result = emberAfTestClusterClusterServerCommandParse(cmd); + break; case ZCL_THERMOSTAT_CLUSTER_ID: // No commands are enabled for cluster Thermostat result = status(false, true, cmd->mfgSpecific); @@ -2525,3 +2529,31 @@ EmberAfStatus emberAfScenesClusterServerCommandParse(EmberAfClusterCommand * cmd } return status(wasHandled, true, cmd->mfgSpecific); } +EmberAfStatus emberAfTestClusterClusterServerCommandParse(EmberAfClusterCommand * cmd) +{ + bool wasHandled = false; + + if (!cmd->mfgSpecific) + { + switch (cmd->commandId) + { + case ZCL_TEST_COMMAND_ID: { + wasHandled = emberAfTestClusterClusterTestCallback(nullptr); + break; + } + case ZCL_TEST_NOT_HANDLED_COMMAND_ID: { + wasHandled = emberAfTestClusterClusterTestNotHandledCallback(nullptr); + break; + } + case ZCL_TEST_SPECIFIC_COMMAND_ID: { + wasHandled = emberAfTestClusterClusterTestSpecificCallback(nullptr); + break; + } + default: { + // Unrecognized command ID, error status will apply. + break; + } + } + } + return status(wasHandled, true, cmd->mfgSpecific); +} diff --git a/examples/all-clusters-app/all-clusters-common/gen/callback-stub.cpp b/examples/all-clusters-app/all-clusters-common/gen/callback-stub.cpp index 3edeb0a239c183..1bbe68114bb09c 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/callback-stub.cpp +++ b/examples/all-clusters-app/all-clusters-common/gen/callback-stub.cpp @@ -98,6 +98,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case ZCL_TEMP_MEASUREMENT_CLUSTER_ID: emberAfTemperatureMeasurementClusterInitCallback(endpoint); break; + case ZCL_TEST_CLUSTER_ID: + emberAfTestClusterClusterInitCallback(endpoint); + break; case ZCL_THERMOSTAT_CLUSTER_ID: emberAfThermostatClusterInitCallback(endpoint); break; @@ -222,6 +225,11 @@ void __attribute__((weak)) emberAfTemperatureMeasurementClusterInitCallback(Endp // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfTestClusterClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfThermostatClusterInitCallback(EndpointId endpoint) { // To prevent warning diff --git a/examples/all-clusters-app/all-clusters-common/gen/callback.h b/examples/all-clusters-app/all-clusters-common/gen/callback.h index 1baf35248f386a..dad543f3dde278 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/callback.h +++ b/examples/all-clusters-app/all-clusters-common/gen/callback.h @@ -224,6 +224,14 @@ void emberAfSwitchClusterInitCallback(chip::EndpointId endpoint); */ void emberAfTemperatureMeasurementClusterInitCallback(chip::EndpointId endpoint); +/** @brief Test Cluster Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfTestClusterClusterInitCallback(chip::EndpointId endpoint); + /** @brief Thermostat Cluster Init * * Cluster Init @@ -1851,6 +1859,76 @@ EmberAfStatus emberAfTemperatureMeasurementClusterServerPreAttributeChangedCallb */ void emberAfTemperatureMeasurementClusterServerTickCallback(chip::EndpointId endpoint); +// +// Test Cluster Cluster server +// + +/** @brief Test Cluster Cluster Server Init + * + * Server Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfTestClusterClusterServerInitCallback(chip::EndpointId endpoint); + +/** @brief Test Cluster Cluster Server Attribute Changed + * + * Server Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + */ +void emberAfTestClusterClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); + +/** @brief Test Cluster Cluster Server Manufacturer Specific Attribute Changed + * + * Server Manufacturer Specific Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + * @param manufacturerCode Manufacturer Code of the attribute that changed + */ +void emberAfTestClusterClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + uint16_t manufacturerCode); + +/** @brief Test Cluster Cluster Server Message Sent + * + * Server Message Sent + * + * @param type The type of message sent + * @param indexOrDestination The destination or address to which the message was sent + * @param apsFrame The APS frame for the message + * @param msgLen The length of the message + * @param message The message that was sent + * @param status The status of the sent message + */ +void emberAfTestClusterClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, + EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, + EmberStatus status); + +/** @brief Test Cluster Cluster Server Pre Attribute Changed + * + * server Pre Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +EmberAfStatus emberAfTestClusterClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, + EmberAfAttributeType attributeType, uint8_t size, + uint8_t * value); + +/** @brief Test Cluster Cluster Server Tick + * + * server Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfTestClusterClusterServerTickCallback(chip::EndpointId endpoint); + // // Thermostat Cluster server // @@ -2724,6 +2802,24 @@ bool emberAfScenesClusterStoreSceneCallback(chip::app::Command * commandObj, uin bool emberAfScenesClusterViewSceneCallback(chip::app::Command * commandObj, uint16_t groupId, uint8_t sceneId); +/** + * @brief Test Cluster Cluster Test Command callback + */ + +bool emberAfTestClusterClusterTestCallback(chip::app::Command * commandObj); + +/** + * @brief Test Cluster Cluster TestNotHandled Command callback + */ + +bool emberAfTestClusterClusterTestNotHandledCallback(chip::app::Command * commandObj); + +/** + * @brief Test Cluster Cluster TestSpecific Command callback + */ + +bool emberAfTestClusterClusterTestSpecificCallback(chip::app::Command * commandObj); + // // Non-Cluster Related Callbacks // diff --git a/examples/all-clusters-app/all-clusters-common/gen/client-command-macro.h b/examples/all-clusters-app/all-clusters-common/gen/client-command-macro.h index 1cfc06d80ce7c2..c8666bc5678d12 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/client-command-macro.h +++ b/examples/all-clusters-app/all-clusters-common/gen/client-command-macro.h @@ -3629,6 +3629,34 @@ \ ZCL_LOGIN_COMMAND_ID, "uu", tempAccountIdentifier, setupPIN); +/** @brief Command description for Test + * + * Command: Test + * @param returnValue INT8U + */ +#define emberAfFillCommandTest \ + ClusterClusterTest(returnValue) emberAfFillExternalBuffer(mask, \ + \ + ZCL_TEST_COMMAND_ID, "u", returnValue); + +/** @brief Command description for TestNotHandled + * + * Command: TestNotHandled + */ +#define emberAfFillCommandTest \ + ClusterClusterTestNotHandled() emberAfFillExternalBuffer(mask, \ + \ + ZCL_TEST_NOT_HANDLED_COMMAND_ID, "", ); + +/** @brief Command description for TestSpecific + * + * Command: TestSpecific + */ +#define emberAfFillCommandTest \ + ClusterClusterTestSpecific() emberAfFillExternalBuffer(mask, \ + \ + ZCL_TEST_SPECIFIC_COMMAND_ID, "", ); + /** @brief Command description for MatchProtocolAddress * * Command: MatchProtocolAddress diff --git a/examples/all-clusters-app/all-clusters-common/gen/cluster-id.h b/examples/all-clusters-app/all-clusters-common/gen/cluster-id.h index b8d9a9f7ed09bf..7f71ea5976846c 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/cluster-id.h +++ b/examples/all-clusters-app/all-clusters-common/gen/cluster-id.h @@ -293,6 +293,9 @@ // Definitions for cluster: Account Login #define ZCL_ACCOUNT_LOGIN_CLUSTER_ID (0x050E) +// Definitions for cluster: Test Cluster +#define ZCL_TEST_CLUSTER_ID (0x050F) + // Definitions for cluster: Generic Tunnel #define ZCL_GENERIC_TUNNEL_CLUSTER_ID (0x0600) diff --git a/examples/all-clusters-app/all-clusters-common/gen/command-id.h b/examples/all-clusters-app/all-clusters-common/gen/command-id.h index 25ee08826f030c..8e97e911e0a423 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/command-id.h +++ b/examples/all-clusters-app/all-clusters-common/gen/command-id.h @@ -470,6 +470,12 @@ #define ZCL_GET_SETUP_PIN_RESPONSE_COMMAND_ID (0x00) #define ZCL_LOGIN_COMMAND_ID (0x01) +// Commands for cluster: Test Cluster +#define ZCL_TEST_COMMAND_ID (0x00) +#define ZCL_TEST_SPECIFIC_RESPONSE_COMMAND_ID (0x00) +#define ZCL_TEST_NOT_HANDLED_COMMAND_ID (0x01) +#define ZCL_TEST_SPECIFIC_COMMAND_ID (0x02) + // Commands for cluster: Generic Tunnel #define ZCL_MATCH_PROTOCOL_ADDRESS_COMMAND_ID (0x00) #define ZCL_MATCH_PROTOCOL_ADDRESS_RESPONSE_COMMAND_ID (0x00) 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 73e3201945103e..782523410a36f1 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 @@ -196,9 +196,35 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ + /* Endpoint: 0, Cluster: Test Cluster (server), big-endian */ \ + \ + /* 2150 - bitmap32, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* 2154 - bitmap64, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 2162 - int32u, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* 2166 - int64u, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 2174 - int32s, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* 2178 - int64s, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 2186 - octet_string, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 2196 - list_int8u, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ /* Endpoint: 0, Cluster: Group Key Management (server), big-endian */ \ \ - /* 2150 - groups, */ \ + /* 2206 - groups, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -214,7 +240,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 2404 - group keys, */ \ + /* 2460 - group keys, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -232,7 +258,7 @@ \ /* Endpoint: 1, Cluster: Descriptor (server), big-endian */ \ \ - /* 2658 - device list, */ \ + /* 2714 - device list, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -248,7 +274,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 2912 - server list, */ \ + /* 2968 - server list, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -264,7 +290,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 3166 - client list, */ \ + /* 3222 - client list, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -280,7 +306,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 3420 - parts list, */ \ + /* 3476 - parts list, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -298,7 +324,7 @@ \ /* Endpoint: 1, Cluster: Color Control (server), big-endian */ \ \ - /* 3674 - compensation text, */ \ + /* 3730 - compensation text, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -316,22 +342,48 @@ \ /* Endpoint: 1, Cluster: IAS Zone (server), big-endian */ \ \ - /* 3928 - IAS CIE address, */ \ + /* 3984 - IAS CIE address, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Application Basic (server), big-endian */ \ \ - /* 3936 - vendor name, */ \ + /* 3992 - vendor name, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 3968 - application name, */ \ + /* 4024 - application name, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 4000 - application id, */ \ + /* 4056 - application id, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* Endpoint: 1, Cluster: Test Cluster (server), big-endian */ \ + \ + /* 4088 - bitmap32, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* 4092 - bitmap64, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 4100 - int32u, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* 4104 - int64u, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 4112 - int32s, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* 4116 - int64s, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 4124 - octet_string, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 4134 - list_int8u, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ } #else // !BIGENDIAN_CPU @@ -507,9 +559,35 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ + /* Endpoint: 0, Cluster: Test Cluster (server), little-endian */ \ + \ + /* 2150 - bitmap32, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* 2154 - bitmap64, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 2162 - int32u, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* 2166 - int64u, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 2174 - int32s, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* 2178 - int64s, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 2186 - octet_string, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 2196 - list_int8u, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ /* Endpoint: 0, Cluster: Group Key Management (server), little-endian */ \ \ - /* 2150 - groups, */ \ + /* 2206 - groups, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -525,7 +603,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 2404 - group keys, */ \ + /* 2460 - group keys, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -543,7 +621,7 @@ \ /* Endpoint: 1, Cluster: Descriptor (server), little-endian */ \ \ - /* 2658 - device list, */ \ + /* 2714 - device list, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -559,7 +637,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 2912 - server list, */ \ + /* 2968 - server list, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -575,7 +653,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 3166 - client list, */ \ + /* 3222 - client list, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -591,7 +669,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 3420 - parts list, */ \ + /* 3476 - parts list, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -609,7 +687,7 @@ \ /* Endpoint: 1, Cluster: Color Control (server), little-endian */ \ \ - /* 3674 - compensation text, */ \ + /* 3730 - compensation text, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -627,27 +705,53 @@ \ /* Endpoint: 1, Cluster: IAS Zone (server), little-endian */ \ \ - /* 3928 - IAS CIE address, */ \ + /* 3984 - IAS CIE address, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Application Basic (server), little-endian */ \ \ - /* 3936 - vendor name, */ \ + /* 3992 - vendor name, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 3968 - application name, */ \ + /* 4024 - application name, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 4000 - application id, */ \ + /* 4056 - application id, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* Endpoint: 1, Cluster: Test Cluster (server), little-endian */ \ + \ + /* 4088 - bitmap32, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* 4092 - bitmap64, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 4100 - int32u, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* 4104 - int64u, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 4112 - int32s, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* 4116 - int64s, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 4124 - octet_string, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 4134 - list_int8u, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ } #endif // BIGENDIAN_CPU -#define GENERATED_DEFAULTS_COUNT (30) +#define GENERATED_DEFAULTS_COUNT (46) #define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE #define ZAP_LONG_DEFAULTS_INDEX(index) \ @@ -675,7 +779,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 153 +#define GENERATED_ATTRIBUTE_COUNT 189 #define GENERATED_ATTRIBUTES \ { \ \ @@ -726,12 +830,33 @@ { 0x0001, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(1896) }, /* fabrics list */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ + /* Endpoint: 0, Cluster: Test Cluster (server) */ \ + { 0x0000, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(false) }, /* boolean */ \ + { 0x0001, ZAP_TYPE(BITMAP8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* bitmap8 */ \ + { 0x0002, ZAP_TYPE(BITMAP16), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* bitmap16 */ \ + { 0x0003, ZAP_TYPE(BITMAP32), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(2150) }, /* bitmap32 */ \ + { 0x0004, ZAP_TYPE(BITMAP64), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(2154) }, /* bitmap64 */ \ + { 0x0005, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* int8u */ \ + { 0x0006, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* int16u */ \ + { 0x0008, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(2162) }, /* int32u */ \ + { 0x000C, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(2166) }, /* int64u */ \ + { 0x000D, ZAP_TYPE(INT8S), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* int8s */ \ + { 0x000E, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* int16s */ \ + { 0x0010, ZAP_TYPE(INT32S), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(2174) }, /* int32s */ \ + { 0x0014, ZAP_TYPE(INT64S), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(2178) }, /* int64s */ \ + { 0x0015, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* enum8 */ \ + { 0x0016, ZAP_TYPE(ENUM16), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* enum16 */ \ + { 0x0019, ZAP_TYPE(OCTET_STRING), 10, ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_LONG_DEFAULTS_INDEX(2186) }, /* octet_string */ \ + { 0x001A, ZAP_TYPE(ARRAY), 10, 0, ZAP_LONG_DEFAULTS_INDEX(2196) }, /* list_int8u */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ + \ /* Endpoint: 0, Cluster: Binding (server) */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ /* Endpoint: 0, Cluster: Group Key Management (server) */ \ - { 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(2150) }, /* groups */ \ - { 0x0001, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(2404) }, /* group keys */ \ + { 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(2206) }, /* groups */ \ + { 0x0001, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(2460) }, /* group keys */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ /* Endpoint: 1, Cluster: Identify (server) */ \ @@ -759,10 +884,10 @@ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* cluster revision */ \ \ /* Endpoint: 1, Cluster: Descriptor (server) */ \ - { 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(2658) }, /* device list */ \ - { 0x0001, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(2912) }, /* server list */ \ - { 0x0002, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(3166) }, /* client list */ \ - { 0x0003, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(3420) }, /* parts list */ \ + { 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(2714) }, /* device list */ \ + { 0x0001, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(2968) }, /* server list */ \ + { 0x0002, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(3222) }, /* client list */ \ + { 0x0003, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(3476) }, /* parts list */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ /* Endpoint: 1, Cluster: OTA Software Update Server (server) */ \ @@ -817,7 +942,7 @@ { 0x0003, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x616B) }, /* current x */ \ { 0x0004, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x607D) }, /* current y */ \ { 0x0005, ZAP_TYPE(ENUM8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* drift compensation */ \ - { 0x0006, ZAP_TYPE(CHAR_STRING), 254, 0, ZAP_LONG_DEFAULTS_INDEX(3674) }, /* compensation text */ \ + { 0x0006, ZAP_TYPE(CHAR_STRING), 254, 0, ZAP_LONG_DEFAULTS_INDEX(3730) }, /* compensation text */ \ { 0x0007, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x00FA) }, /* color temperature */ \ { 0x0008, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* color mode */ \ { 0x000F, ZAP_TYPE(BITMAP8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* color control options */ \ @@ -875,7 +1000,7 @@ { 0x0001, ZAP_TYPE(ENUM16), 2, 0, ZAP_EMPTY_DEFAULT() }, /* zone type */ \ { 0x0002, ZAP_TYPE(BITMAP16), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* zone status */ \ { 0x0010, ZAP_TYPE(IEEE_ADDRESS), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_LONG_DEFAULTS_INDEX(3928) }, /* IAS CIE address */ \ + ZAP_LONG_DEFAULTS_INDEX(3984) }, /* IAS CIE address */ \ { 0x0011, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0xff) }, /* Zone ID */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* cluster revision */ \ \ @@ -883,15 +1008,36 @@ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ /* Endpoint: 1, Cluster: Application Basic (server) */ \ - { 0x0000, ZAP_TYPE(CHAR_STRING), 32, 0, ZAP_LONG_DEFAULTS_INDEX(3936) }, /* vendor name */ \ + { 0x0000, ZAP_TYPE(CHAR_STRING), 32, 0, ZAP_LONG_DEFAULTS_INDEX(3992) }, /* vendor name */ \ { 0x0001, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* vendor id */ \ - { 0x0002, ZAP_TYPE(CHAR_STRING), 32, 0, ZAP_LONG_DEFAULTS_INDEX(3968) }, /* application name */ \ + { 0x0002, ZAP_TYPE(CHAR_STRING), 32, 0, ZAP_LONG_DEFAULTS_INDEX(4024) }, /* application name */ \ { 0x0003, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* product id */ \ - { 0x0005, ZAP_TYPE(CHAR_STRING), 32, 0, ZAP_LONG_DEFAULTS_INDEX(4000) }, /* application id */ \ + { 0x0005, ZAP_TYPE(CHAR_STRING), 32, 0, ZAP_LONG_DEFAULTS_INDEX(4056) }, /* application id */ \ { 0x0006, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* catalog vendor id */ \ { 0x0007, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* application satus */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ + /* Endpoint: 1, Cluster: Test Cluster (server) */ \ + { 0x0000, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(false) }, /* boolean */ \ + { 0x0001, ZAP_TYPE(BITMAP8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* bitmap8 */ \ + { 0x0002, ZAP_TYPE(BITMAP16), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* bitmap16 */ \ + { 0x0003, ZAP_TYPE(BITMAP32), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(4088) }, /* bitmap32 */ \ + { 0x0004, ZAP_TYPE(BITMAP64), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(4092) }, /* bitmap64 */ \ + { 0x0005, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* int8u */ \ + { 0x0006, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* int16u */ \ + { 0x0008, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(4100) }, /* int32u */ \ + { 0x000C, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(4104) }, /* int64u */ \ + { 0x000D, ZAP_TYPE(INT8S), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* int8s */ \ + { 0x000E, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* int16s */ \ + { 0x0010, ZAP_TYPE(INT32S), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(4112) }, /* int32s */ \ + { 0x0014, ZAP_TYPE(INT64S), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(4116) }, /* int64s */ \ + { 0x0015, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* enum8 */ \ + { 0x0016, ZAP_TYPE(ENUM16), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* enum16 */ \ + { 0x0019, ZAP_TYPE(OCTET_STRING), 10, ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_LONG_DEFAULTS_INDEX(4124) }, /* octet_string */ \ + { 0x001A, ZAP_TYPE(ARRAY), 10, 0, ZAP_LONG_DEFAULTS_INDEX(4134) }, /* list_int8u */ \ + { 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 */ \ \ @@ -937,7 +1083,7 @@ }; #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask -#define GENERATED_CLUSTER_COUNT 27 +#define GENERATED_CLUSTER_COUNT 29 #define GENERATED_CLUSTERS \ { \ { \ @@ -959,93 +1105,99 @@ 0x003E, ZAP_ATTRIBUTE_INDEX(27), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: Operational Credentials (server) */ \ { \ - 0xF000, ZAP_ATTRIBUTE_INDEX(29), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050F, ZAP_ATTRIBUTE_INDEX(29), 18, 71, ZAP_CLUSTER_MASK(SERVER), NULL \ + }, /* Endpoint: 0, Cluster: Test Cluster (server) */ \ + { \ + 0xF000, ZAP_ATTRIBUTE_INDEX(47), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: Binding (server) */ \ { \ - 0xF004, ZAP_ATTRIBUTE_INDEX(30), 3, 510, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0xF004, ZAP_ATTRIBUTE_INDEX(48), 3, 510, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: Group Key Management (server) */ \ { 0x0003, \ - ZAP_ATTRIBUTE_INDEX(33), \ + ZAP_ATTRIBUTE_INDEX(51), \ 2, \ 4, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ chipFuncArrayIdentifyServer }, /* Endpoint: 1, Cluster: Identify (server) */ \ { 0x0004, \ - ZAP_ATTRIBUTE_INDEX(35), \ + ZAP_ATTRIBUTE_INDEX(53), \ 2, \ 3, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayGroupsServer }, /* Endpoint: 1, Cluster: Groups (server) */ \ { 0x0005, \ - ZAP_ATTRIBUTE_INDEX(37), \ + ZAP_ATTRIBUTE_INDEX(55), \ 6, \ 8, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayScenesServer }, /* Endpoint: 1, Cluster: Scenes (server) */ \ { 0x0006, \ - ZAP_ATTRIBUTE_INDEX(43), \ + ZAP_ATTRIBUTE_INDEX(61), \ 2, \ 3, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayOnOffServer }, /* Endpoint: 1, Cluster: On/off (server) */ \ { 0x0008, \ - ZAP_ATTRIBUTE_INDEX(45), \ + ZAP_ATTRIBUTE_INDEX(63), \ 2, \ 3, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayLevelControlServer }, /* Endpoint: 1, Cluster: Level Control (server) */ \ { \ - 0x001D, ZAP_ATTRIBUTE_INDEX(47), 5, 1018, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x001D, ZAP_ATTRIBUTE_INDEX(65), 5, 1018, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Descriptor (server) */ \ { \ - 0x0029, ZAP_ATTRIBUTE_INDEX(52), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0029, ZAP_ATTRIBUTE_INDEX(70), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: OTA Software Update Server (server) */ \ { \ - 0x002A, ZAP_ATTRIBUTE_INDEX(53), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x002A, ZAP_ATTRIBUTE_INDEX(71), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: OTA Software Update Client (server) */ \ - { 0x003B, ZAP_ATTRIBUTE_INDEX(54), 3, 4, ZAP_CLUSTER_MASK(SERVER), NULL }, /* Endpoint: 1, Cluster: Switch (server) */ \ + { 0x003B, ZAP_ATTRIBUTE_INDEX(72), 3, 4, ZAP_CLUSTER_MASK(SERVER), NULL }, /* Endpoint: 1, Cluster: Switch (server) */ \ { 0x0101, \ - ZAP_ATTRIBUTE_INDEX(57), \ + ZAP_ATTRIBUTE_INDEX(75), \ 4, \ 5, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ chipFuncArrayDoorLockServer }, /* Endpoint: 1, Cluster: Door Lock (server) */ \ { \ - 0x0103, ZAP_ATTRIBUTE_INDEX(61), 5, 7, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0103, ZAP_ATTRIBUTE_INDEX(79), 5, 7, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Barrier Control (server) */ \ { \ - 0x0200, ZAP_ATTRIBUTE_INDEX(66), 8, 13, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0200, ZAP_ATTRIBUTE_INDEX(84), 8, 13, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Pump Configuration and Control (server) */ \ { \ - 0x0201, ZAP_ATTRIBUTE_INDEX(74), 6, 10, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0201, ZAP_ATTRIBUTE_INDEX(92), 6, 10, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Thermostat (server) */ \ { 0x0300, \ - ZAP_ATTRIBUTE_INDEX(80), \ + ZAP_ATTRIBUTE_INDEX(98), \ 51, \ 336, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayColorControlServer }, /* Endpoint: 1, Cluster: Color Control (server) */ \ { \ - 0x0402, ZAP_ATTRIBUTE_INDEX(131), 4, 8, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0402, ZAP_ATTRIBUTE_INDEX(149), 4, 8, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Temperature Measurement (server) */ \ { 0x0500, \ - ZAP_ATTRIBUTE_INDEX(135), \ + ZAP_ATTRIBUTE_INDEX(153), \ 6, \ 16, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION) | \ ZAP_CLUSTER_MASK(MESSAGE_SENT_FUNCTION), \ chipFuncArrayIasZoneServer }, /* Endpoint: 1, Cluster: IAS Zone (server) */ \ { \ - 0x0508, ZAP_ATTRIBUTE_INDEX(141), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0508, ZAP_ATTRIBUTE_INDEX(159), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Low Power (server) */ \ { \ - 0x050D, ZAP_ATTRIBUTE_INDEX(142), 8, 105, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050D, ZAP_ATTRIBUTE_INDEX(160), 8, 105, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Application Basic (server) */ \ { \ - 0xF000, ZAP_ATTRIBUTE_INDEX(150), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050F, ZAP_ATTRIBUTE_INDEX(168), 18, 71, ZAP_CLUSTER_MASK(SERVER), NULL \ + }, /* Endpoint: 1, Cluster: Test Cluster (server) */ \ + { \ + 0xF000, ZAP_ATTRIBUTE_INDEX(186), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Binding (server) */ \ { 0x0006, \ - ZAP_ATTRIBUTE_INDEX(151), \ + ZAP_ATTRIBUTE_INDEX(187), \ 2, \ 3, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -1057,7 +1209,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 7, 2681 }, { ZAP_CLUSTER_INDEX(7), 19, 1551 }, { ZAP_CLUSTER_INDEX(26), 1, 3 }, \ + { ZAP_CLUSTER_INDEX(0), 8, 2752 }, { ZAP_CLUSTER_INDEX(8), 20, 1622 }, { ZAP_CLUSTER_INDEX(28), 1, 3 }, \ } // Largest attribute size is needed for various buffers @@ -1067,7 +1219,7 @@ #define ATTRIBUTE_SINGLETONS_SIZE (875) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (4235) +#define ATTRIBUTE_MAX_SIZE (4377) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (3) @@ -1111,7 +1263,7 @@ // Array of EmberAfCommandMetadata structs. #define ZAP_COMMAND_MASK(mask) COMMAND_MASK_##mask -#define EMBER_AF_GENERATED_COMMAND_COUNT (133) +#define EMBER_AF_GENERATED_COMMAND_COUNT (140) #define GENERATED_COMMANDS \ { \ \ @@ -1155,6 +1307,12 @@ { 0x003E, 0x09, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* UpdateFabricLabel */ \ { 0x003E, 0x0A, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* RemoveFabric */ \ \ + /* Endpoint: 0, Cluster: Test Cluster (server) */ \ + { 0x050F, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Test */ \ + { 0x050F, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* TestSpecificResponse */ \ + { 0x050F, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* TestNotHandled */ \ + { 0x050F, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* TestSpecific */ \ + \ /* Endpoint: 0, Cluster: Binding (server) */ \ { 0xF000, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Bind */ \ { 0xF000, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Unbind */ \ @@ -1280,6 +1438,11 @@ /* Endpoint: 1, Cluster: Low Power (server) */ \ { 0x0508, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Sleep */ \ \ + /* Endpoint: 1, Cluster: Test Cluster (server) */ \ + { 0x050F, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Test */ \ + { 0x050F, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* TestSpecificResponse */ \ + { 0x050F, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* TestNotHandled */ \ + \ /* Endpoint: 1, Cluster: Binding (server) */ \ { 0xF000, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Bind */ \ { 0xF000, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Unbind */ \ diff --git a/examples/all-clusters-app/all-clusters-common/gen/gen_config.h b/examples/all-clusters-app/all-clusters-common/gen/gen_config.h index f59fcfcfc398b0..bb79ede1af6ee5 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/gen_config.h +++ b/examples/all-clusters-app/all-clusters-common/gen/gen_config.h @@ -52,6 +52,7 @@ #define EMBER_AF_SCENES_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_SWITCH_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_TEMP_MEASUREMENT_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_TEST_CLUSTER_SERVER_ENDPOINT_COUNT (2) #define EMBER_AF_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT (1) /**** Cluster Plugins ****/ @@ -183,6 +184,11 @@ #define EMBER_AF_PLUGIN_TEMPERATURE_MEASUREMENT_SERVER #define EMBER_AF_PLUGIN_TEMPERATURE_MEASUREMENT +// Use this macro to check if the server side of the Test Cluster cluster is included +#define ZCL_USING_TEST_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_TEST_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_TEST_CLUSTER + // Use this macro to check if the server side of the Thermostat cluster is included #define ZCL_USING_THERMOSTAT_CLUSTER_SERVER #define EMBER_AF_PLUGIN_THERMOSTAT_SERVER diff --git a/examples/all-clusters-app/all-clusters-common/gen/print-cluster.h b/examples/all-clusters-app/all-clusters-common/gen/print-cluster.h index 9c879d94a9390d..886dad371554b7 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/print-cluster.h +++ b/examples/all-clusters-app/all-clusters-common/gen/print-cluster.h @@ -634,6 +634,12 @@ #define CHIP_PRINTCLUSTER_ACCOUNT_LOGIN_CLUSTER #endif +#if defined(ZCL_USING_TEST_CLUSTER_SERVER) || defined(ZCL_USING_TEST_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_TEST_CLUSTER { ZCL_TEST_CLUSTER_ID, 1295, "Test Cluster" }, +#else +#define CHIP_PRINTCLUSTER_TEST_CLUSTER +#endif + #if defined(ZCL_USING_GENERIC_TUNNEL_CLUSTER_SERVER) || defined(ZCL_USING_GENERIC_TUNNEL_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_GENERIC_TUNNEL_CLUSTER { ZCL_GENERIC_TUNNEL_CLUSTER_ID, 1536, "Generic Tunnel" }, #else @@ -965,6 +971,7 @@ CHIP_PRINTCLUSTER_APPLICATION_LAUNCHER_CLUSTER \ CHIP_PRINTCLUSTER_APPLICATION_BASIC_CLUSTER \ CHIP_PRINTCLUSTER_ACCOUNT_LOGIN_CLUSTER \ + CHIP_PRINTCLUSTER_TEST_CLUSTER \ CHIP_PRINTCLUSTER_GENERIC_TUNNEL_CLUSTER \ CHIP_PRINTCLUSTER_BACNET_PROTOCOL_TUNNEL_CLUSTER \ CHIP_PRINTCLUSTER_11073_PROTOCOL_TUNNEL_CLUSTER \ diff --git a/examples/all-clusters-app/esp32/main/CMakeLists.txt b/examples/all-clusters-app/esp32/main/CMakeLists.txt index 3931a2d997b03f..221d2ddc6221e0 100644 --- a/examples/all-clusters-app/esp32/main/CMakeLists.txt +++ b/examples/all-clusters-app/esp32/main/CMakeLists.txt @@ -27,6 +27,7 @@ idf_component_register(PRIV_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/gen" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/util" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/test-cluster-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/descriptor" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/on-off-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/level-control" diff --git a/examples/all-clusters-app/esp32/main/component.mk b/examples/all-clusters-app/esp32/main/component.mk index db198b612ffac1..8e1715785e8bb8 100644 --- a/examples/all-clusters-app/esp32/main/component.mk +++ b/examples/all-clusters-app/esp32/main/component.mk @@ -27,6 +27,7 @@ COMPONENT_SRCDIRS := ../third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/gen \ ../third_party/connectedhomeip/src/app/server \ ../third_party/connectedhomeip/src/app/util \ + ../third_party/connectedhomeip/src/app/clusters/test-cluster-server \ ../third_party/connectedhomeip/src/app/clusters/descriptor \ ../third_party/connectedhomeip/src/app/clusters/on-off-server \ ../third_party/connectedhomeip/src/app/clusters/level-control \ diff --git a/examples/bridge-app/bridge-common/gen/attribute-id.h b/examples/bridge-app/bridge-common/gen/attribute-id.h index 8e7aa393464caf..e4691450f06d9c 100644 --- a/examples/bridge-app/bridge-common/gen/attribute-id.h +++ b/examples/bridge-app/bridge-common/gen/attribute-id.h @@ -1240,6 +1240,29 @@ // Server attributes +// Attribute ids for cluster: Test Cluster + +// Client attributes + +// Server attributes +#define ZCL_BOOLEAN_ATTRIBUTE_ID (0x0000) +#define ZCL_BITMAP8_ATTRIBUTE_ID (0x0001) +#define ZCL_BITMAP16_ATTRIBUTE_ID (0x0002) +#define ZCL_BITMAP32_ATTRIBUTE_ID (0x0003) +#define ZCL_BITMAP64_ATTRIBUTE_ID (0x0004) +#define ZCL_INT8_U_ATTRIBUTE_ID (0x0005) +#define ZCL_INT16_U_ATTRIBUTE_ID (0x0006) +#define ZCL_INT32_U_ATTRIBUTE_ID (0x0008) +#define ZCL_INT64_U_ATTRIBUTE_ID (0x000C) +#define ZCL_INT8_S_ATTRIBUTE_ID (0x000D) +#define ZCL_INT16_S_ATTRIBUTE_ID (0x000E) +#define ZCL_INT32_S_ATTRIBUTE_ID (0x0010) +#define ZCL_INT64_S_ATTRIBUTE_ID (0x0014) +#define ZCL_ENUM8_ATTRIBUTE_ID (0x0015) +#define ZCL_ENUM16_ATTRIBUTE_ID (0x0016) +#define ZCL_OCTET_STRING_ATTRIBUTE_ID (0x0019) +#define ZCL_LIST_ATTRIBUTE_ID (0x001A) + // Attribute ids for cluster: Generic Tunnel // Client attributes diff --git a/examples/bridge-app/bridge-common/gen/client-command-macro.h b/examples/bridge-app/bridge-common/gen/client-command-macro.h index 1cfc06d80ce7c2..c8666bc5678d12 100644 --- a/examples/bridge-app/bridge-common/gen/client-command-macro.h +++ b/examples/bridge-app/bridge-common/gen/client-command-macro.h @@ -3629,6 +3629,34 @@ \ ZCL_LOGIN_COMMAND_ID, "uu", tempAccountIdentifier, setupPIN); +/** @brief Command description for Test + * + * Command: Test + * @param returnValue INT8U + */ +#define emberAfFillCommandTest \ + ClusterClusterTest(returnValue) emberAfFillExternalBuffer(mask, \ + \ + ZCL_TEST_COMMAND_ID, "u", returnValue); + +/** @brief Command description for TestNotHandled + * + * Command: TestNotHandled + */ +#define emberAfFillCommandTest \ + ClusterClusterTestNotHandled() emberAfFillExternalBuffer(mask, \ + \ + ZCL_TEST_NOT_HANDLED_COMMAND_ID, "", ); + +/** @brief Command description for TestSpecific + * + * Command: TestSpecific + */ +#define emberAfFillCommandTest \ + ClusterClusterTestSpecific() emberAfFillExternalBuffer(mask, \ + \ + ZCL_TEST_SPECIFIC_COMMAND_ID, "", ); + /** @brief Command description for MatchProtocolAddress * * Command: MatchProtocolAddress diff --git a/examples/bridge-app/bridge-common/gen/cluster-id.h b/examples/bridge-app/bridge-common/gen/cluster-id.h index b8d9a9f7ed09bf..7f71ea5976846c 100644 --- a/examples/bridge-app/bridge-common/gen/cluster-id.h +++ b/examples/bridge-app/bridge-common/gen/cluster-id.h @@ -293,6 +293,9 @@ // Definitions for cluster: Account Login #define ZCL_ACCOUNT_LOGIN_CLUSTER_ID (0x050E) +// Definitions for cluster: Test Cluster +#define ZCL_TEST_CLUSTER_ID (0x050F) + // Definitions for cluster: Generic Tunnel #define ZCL_GENERIC_TUNNEL_CLUSTER_ID (0x0600) diff --git a/examples/bridge-app/bridge-common/gen/command-id.h b/examples/bridge-app/bridge-common/gen/command-id.h index 25ee08826f030c..8e97e911e0a423 100644 --- a/examples/bridge-app/bridge-common/gen/command-id.h +++ b/examples/bridge-app/bridge-common/gen/command-id.h @@ -470,6 +470,12 @@ #define ZCL_GET_SETUP_PIN_RESPONSE_COMMAND_ID (0x00) #define ZCL_LOGIN_COMMAND_ID (0x01) +// Commands for cluster: Test Cluster +#define ZCL_TEST_COMMAND_ID (0x00) +#define ZCL_TEST_SPECIFIC_RESPONSE_COMMAND_ID (0x00) +#define ZCL_TEST_NOT_HANDLED_COMMAND_ID (0x01) +#define ZCL_TEST_SPECIFIC_COMMAND_ID (0x02) + // Commands for cluster: Generic Tunnel #define ZCL_MATCH_PROTOCOL_ADDRESS_COMMAND_ID (0x00) #define ZCL_MATCH_PROTOCOL_ADDRESS_RESPONSE_COMMAND_ID (0x00) diff --git a/examples/bridge-app/bridge-common/gen/print-cluster.h b/examples/bridge-app/bridge-common/gen/print-cluster.h index 9c879d94a9390d..886dad371554b7 100644 --- a/examples/bridge-app/bridge-common/gen/print-cluster.h +++ b/examples/bridge-app/bridge-common/gen/print-cluster.h @@ -634,6 +634,12 @@ #define CHIP_PRINTCLUSTER_ACCOUNT_LOGIN_CLUSTER #endif +#if defined(ZCL_USING_TEST_CLUSTER_SERVER) || defined(ZCL_USING_TEST_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_TEST_CLUSTER { ZCL_TEST_CLUSTER_ID, 1295, "Test Cluster" }, +#else +#define CHIP_PRINTCLUSTER_TEST_CLUSTER +#endif + #if defined(ZCL_USING_GENERIC_TUNNEL_CLUSTER_SERVER) || defined(ZCL_USING_GENERIC_TUNNEL_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_GENERIC_TUNNEL_CLUSTER { ZCL_GENERIC_TUNNEL_CLUSTER_ID, 1536, "Generic Tunnel" }, #else @@ -965,6 +971,7 @@ CHIP_PRINTCLUSTER_APPLICATION_LAUNCHER_CLUSTER \ CHIP_PRINTCLUSTER_APPLICATION_BASIC_CLUSTER \ CHIP_PRINTCLUSTER_ACCOUNT_LOGIN_CLUSTER \ + CHIP_PRINTCLUSTER_TEST_CLUSTER \ CHIP_PRINTCLUSTER_GENERIC_TUNNEL_CLUSTER \ CHIP_PRINTCLUSTER_BACNET_PROTOCOL_TUNNEL_CLUSTER \ CHIP_PRINTCLUSTER_11073_PROTOCOL_TUNNEL_CLUSTER \ diff --git a/examples/chip-tool/chip-tool.zap b/examples/chip-tool/chip-tool.zap index 226434a2a82c4a..db6a262eca390d 100644 --- a/examples/chip-tool/chip-tool.zap +++ b/examples/chip-tool/chip-tool.zap @@ -1,5 +1,5 @@ { - "featureLevel": 26, + "featureLevel": 29, "creator": "zap", "keyValuePairs": [ { @@ -5526,6 +5526,347 @@ } ] }, + { + "name": "Test Cluster", + "code": 1295, + "mfgCode": null, + "define": "TEST_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [ + { + "name": "Test", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "TestNotHandled", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "TestSpecific", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Test Cluster", + "code": 1295, + "mfgCode": null, + "define": "TEST_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [ + { + "name": "TestSpecificResponse", + "code": 0, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 0 + } + ], + "attributes": [ + { + "name": "boolean", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "false", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "bitmap8", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "bitmap16", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "bitmap32", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "bitmap64", + "code": 4, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int8u", + "code": 5, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int16u", + "code": 6, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int32u", + "code": 8, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int64u", + "code": 12, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int8s", + "code": 13, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int16s", + "code": 14, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int32s", + "code": 16, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int64s", + "code": 20, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "enum8", + "code": 21, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "enum16", + "code": 22, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "octet_string", + "code": 25, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "list_int8u", + "code": 26, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, { "name": "Binding", "code": 61440, @@ -5686,8 +6027,10 @@ "endpointTypeIndex": 0, "profileId": "0x0103", "endpointId": 1, - "networkId": 0 + "networkId": 0, + "endpointVersion": null, + "deviceIdentifier": null } ], "log": [] -} \ No newline at end of file +} diff --git a/examples/chip-tool/commands/clusters/Commands.h b/examples/chip-tool/commands/clusters/Commands.h index f330eb0333fdfe..7686346bdd8cac 100644 --- a/examples/chip-tool/commands/clusters/Commands.h +++ b/examples/chip-tool/commands/clusters/Commands.h @@ -82,6 +82,14 @@ static void OnInt64uAttributeResponse(void * context, uint64_t value) command->SetCommandExitStatus(true); } +static void OnInt8sAttributeResponse(void * context, int8_t value) +{ + ChipLogProgress(chipTool, "Int8s attribute Response: %" PRId8, value); + + ModelCommand * command = reinterpret_cast(context); + command->SetCommandExitStatus(true); +} + static void OnInt16sAttributeResponse(void * context, int16_t value) { ChipLogProgress(chipTool, "Int16s attribute Response: %" PRId16, value); @@ -90,6 +98,22 @@ static void OnInt16sAttributeResponse(void * context, int16_t value) command->SetCommandExitStatus(true); } +static void OnInt32sAttributeResponse(void * context, int32_t value) +{ + ChipLogProgress(chipTool, "Int32s attribute Response: %" PRId32, value); + + ModelCommand * command = reinterpret_cast(context); + command->SetCommandExitStatus(true); +} + +static void OnInt64sAttributeResponse(void * context, int64_t value) +{ + ChipLogProgress(chipTool, "Int64s attribute Response: %" PRId64, value); + + ModelCommand * command = reinterpret_cast(context); + command->SetCommandExitStatus(true); +} + static void OnStringAttributeResponse(void * context, const chip::ByteSpan value) { char * str = (char *) malloc(value.size() * sizeof(char)); @@ -628,6 +652,14 @@ static void OnTargetNavigatorClusterNavigateTargetResponse(void * context, uint8 command->SetCommandExitStatus(true); } +static void OnTestClusterClusterTestSpecificResponse(void * context, uint8_t returnValue) +{ + ChipLogProgress(chipTool, "TestClusterClusterTestSpecificResponse"); + + ModelCommand * command = reinterpret_cast(context); + command->SetCommandExitStatus(true); +} + static void OnDescriptorDeviceListListAttributeResponse(void * context, uint16_t count, _DeviceType * entries) { ChipLogProgress(chipTool, "OnDescriptorDeviceListListAttributeResponse: %lu entries", count); @@ -733,6 +765,19 @@ static void OnOperationalCredentialsFabricsListListAttributeResponse(void * cont command->SetCommandExitStatus(true); } +static void OnTestClusterListInt8uListAttributeResponse(void * context, uint16_t count, uint8_t * entries) +{ + ChipLogProgress(chipTool, "OnTestClusterListInt8uListAttributeResponse: %lu entries", count); + + for (uint16_t i = 0; i < count; i++) + { + ChipLogProgress(chipTool, "INT8U[%lu]: %" PRIu8 "", i, entries[i]); + } + + ModelCommand * command = reinterpret_cast(context); + command->SetCommandExitStatus(true); +} + /*----------------------------------------------------------------------------*\ | Cluster Name | ID | |---------------------------------------------------------------------+--------| @@ -765,6 +810,7 @@ static void OnOperationalCredentialsFabricsListListAttributeResponse(void * cont | TvChannel | 0x0504 | | TargetNavigator | 0x0505 | | TemperatureMeasurement | 0x0402 | +| TestCluster | 0x050F | | Thermostat | 0x0201 | | WakeOnLan | 0x0503 | \*----------------------------------------------------------------------------*/ @@ -798,6 +844,7 @@ constexpr chip::ClusterId kSwitchClusterId = 0x003B; constexpr chip::ClusterId kTvChannelClusterId = 0x0504; constexpr chip::ClusterId kTargetNavigatorClusterId = 0x0505; constexpr chip::ClusterId kTemperatureMeasurementClusterId = 0x0402; +constexpr chip::ClusterId kTestClusterClusterId = 0x050F; constexpr chip::ClusterId kThermostatClusterId = 0x0201; constexpr chip::ClusterId kWakeOnLanClusterId = 0x0503; @@ -12431,32 +12478,42 @@ class ReadTemperatureMeasurementClusterRevision : public ModelCommand }; /*----------------------------------------------------------------------------*\ -| Cluster Thermostat | 0x0201 | +| Cluster TestCluster | 0x050F | |------------------------------------------------------------------------------| | Commands: | | -| * ClearWeeklySchedule | 0x03 | -| * GetRelayStatusLog | 0x04 | -| * GetWeeklySchedule | 0x02 | -| * SetWeeklySchedule | 0x01 | -| * SetpointRaiseLower | 0x00 | +| * Test | 0x00 | +| * TestNotHandled | 0x01 | +| * TestSpecific | 0x02 | |------------------------------------------------------------------------------| | Attributes: | | -| * LocalTemperature | 0x0000 | -| * OccupiedCoolingSetpoint | 0x0011 | -| * OccupiedHeatingSetpoint | 0x0012 | -| * ControlSequenceOfOperation | 0x001B | -| * SystemMode | 0x001C | +| * Boolean | 0x0000 | +| * Bitmap8 | 0x0001 | +| * Bitmap16 | 0x0002 | +| * Bitmap32 | 0x0003 | +| * Bitmap64 | 0x0004 | +| * Int8u | 0x0005 | +| * Int16u | 0x0006 | +| * Int32u | 0x0008 | +| * Int64u | 0x000C | +| * Int8s | 0x000D | +| * Int16s | 0x000E | +| * Int32s | 0x0010 | +| * Int64s | 0x0014 | +| * Enum8 | 0x0015 | +| * Enum16 | 0x0016 | +| * OctetString | 0x0019 | +| * ListInt8u | 0x001A | | * ClusterRevision | 0xFFFD | \*----------------------------------------------------------------------------*/ /* - * Command ClearWeeklySchedule + * Command Test */ -class ThermostatClearWeeklySchedule : public ModelCommand +class TestClusterTest : public ModelCommand { public: - ThermostatClearWeeklySchedule() : ModelCommand("clear-weekly-schedule") { ModelCommand::AddArguments(); } - ~ThermostatClearWeeklySchedule() + TestClusterTest() : ModelCommand("test") { ModelCommand::AddArguments(); } + ~TestClusterTest() { delete onSuccessCallback; delete onFailureCallback; @@ -12464,11 +12521,11 @@ class ThermostatClearWeeklySchedule : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x03) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x00) on endpoint %" PRIu16, endpointId); - chip::Controller::ThermostatCluster cluster; + chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - return cluster.ClearWeeklySchedule(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + return cluster.Test(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); } private: @@ -12479,13 +12536,13 @@ class ThermostatClearWeeklySchedule : public ModelCommand }; /* - * Command GetRelayStatusLog + * Command TestNotHandled */ -class ThermostatGetRelayStatusLog : public ModelCommand +class TestClusterTestNotHandled : public ModelCommand { public: - ThermostatGetRelayStatusLog() : ModelCommand("get-relay-status-log") { ModelCommand::AddArguments(); } - ~ThermostatGetRelayStatusLog() + TestClusterTestNotHandled() : ModelCommand("test-not-handled") { ModelCommand::AddArguments(); } + ~TestClusterTestNotHandled() { delete onSuccessCallback; delete onFailureCallback; @@ -12493,11 +12550,11 @@ class ThermostatGetRelayStatusLog : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x04) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x01) on endpoint %" PRIu16, endpointId); - chip::Controller::ThermostatCluster cluster; + chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - return cluster.GetRelayStatusLog(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + return cluster.TestNotHandled(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); } private: @@ -12508,18 +12565,13 @@ class ThermostatGetRelayStatusLog : public ModelCommand }; /* - * Command GetWeeklySchedule + * Command TestSpecific */ -class ThermostatGetWeeklySchedule : public ModelCommand +class TestClusterTestSpecific : public ModelCommand { public: - ThermostatGetWeeklySchedule() : ModelCommand("get-weekly-schedule") - { - AddArgument("daysToReturn", 0, UINT8_MAX, &mDaysToReturn); - AddArgument("modeToReturn", 0, UINT8_MAX, &mModeToReturn); - ModelCommand::AddArguments(); - } - ~ThermostatGetWeeklySchedule() + TestClusterTestSpecific() : ModelCommand("test-specific") { ModelCommand::AddArguments(); } + ~TestClusterTestSpecific() { delete onSuccessCallback; delete onFailureCallback; @@ -12527,37 +12579,30 @@ class ThermostatGetWeeklySchedule : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x02) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x02) on endpoint %" PRIu16, endpointId); - chip::Controller::ThermostatCluster cluster; + chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - return cluster.GetWeeklySchedule(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mDaysToReturn, mModeToReturn); + return cluster.TestSpecific(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); } private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnTestClusterClusterTestSpecificResponse, + this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); - uint8_t mDaysToReturn; - uint8_t mModeToReturn; }; /* - * Command SetWeeklySchedule + * Discover Attributes */ -class ThermostatSetWeeklySchedule : public ModelCommand +class DiscoverTestClusterAttributes : public ModelCommand { public: - ThermostatSetWeeklySchedule() : ModelCommand("set-weekly-schedule") - { - AddArgument("numberOfTransitionsForSequence", 0, UINT8_MAX, &mNumberOfTransitionsForSequence); - AddArgument("dayOfWeekForSequence", 0, UINT8_MAX, &mDayOfWeekForSequence); - AddArgument("modeForSequence", 0, UINT8_MAX, &mModeForSequence); - AddArgument("payload", 0, UINT8_MAX, &mPayload); - ModelCommand::AddArguments(); - } - ~ThermostatSetWeeklySchedule() + DiscoverTestClusterAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); } + + ~DiscoverTestClusterAttributes() { delete onSuccessCallback; delete onFailureCallback; @@ -12565,12 +12610,11 @@ class ThermostatSetWeeklySchedule : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x01) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x0C) on endpoint %" PRIu16, endpointId); - chip::Controller::ThermostatCluster cluster; + chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - return cluster.SetWeeklySchedule(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mNumberOfTransitionsForSequence, - mDayOfWeekForSequence, mModeForSequence, mPayload); + return cluster.DiscoverAttributes(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); } private: @@ -12578,25 +12622,21 @@ class ThermostatSetWeeklySchedule : public ModelCommand new chip::Callback::Callback(OnDefaultSuccessResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); - uint8_t mNumberOfTransitionsForSequence; - uint8_t mDayOfWeekForSequence; - uint8_t mModeForSequence; - uint8_t mPayload; }; /* - * Command SetpointRaiseLower + * Attribute Boolean */ -class ThermostatSetpointRaiseLower : public ModelCommand +class ReadTestClusterBoolean : public ModelCommand { public: - ThermostatSetpointRaiseLower() : ModelCommand("setpoint-raise-lower") + ReadTestClusterBoolean() : ModelCommand("read") { - AddArgument("mode", 0, UINT8_MAX, &mMode); - AddArgument("amount", INT8_MIN, INT8_MAX, &mAmount); + AddArgument("attr-name", "boolean"); ModelCommand::AddArguments(); } - ~ThermostatSetpointRaiseLower() + + ~ReadTestClusterBoolean() { delete onSuccessCallback; delete onFailureCallback; @@ -12604,31 +12644,31 @@ class ThermostatSetpointRaiseLower : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x00) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x00) on endpoint %" PRIu16, endpointId); - chip::Controller::ThermostatCluster cluster; + chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - return cluster.SetpointRaiseLower(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMode, mAmount); + return cluster.ReadAttributeBoolean(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); } private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnBooleanAttributeResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); - uint8_t mMode; - int8_t mAmount; }; -/* - * Discover Attributes - */ -class DiscoverThermostatAttributes : public ModelCommand +class WriteTestClusterBoolean : public ModelCommand { public: - DiscoverThermostatAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); } + WriteTestClusterBoolean() : ModelCommand("write") + { + AddArgument("attr-name", "boolean"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + ModelCommand::AddArguments(); + } - ~DiscoverThermostatAttributes() + ~WriteTestClusterBoolean() { delete onSuccessCallback; delete onFailureCallback; @@ -12636,11 +12676,11 @@ class DiscoverThermostatAttributes : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x0C) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x01) on endpoint %" PRIu16, endpointId); - chip::Controller::ThermostatCluster cluster; + chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - return cluster.DiscoverAttributes(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + return cluster.WriteAttributeBoolean(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); } private: @@ -12648,21 +12688,22 @@ class DiscoverThermostatAttributes : public ModelCommand new chip::Callback::Callback(OnDefaultSuccessResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); + uint8_t mValue; }; /* - * Attribute LocalTemperature + * Attribute Bitmap8 */ -class ReadThermostatLocalTemperature : public ModelCommand +class ReadTestClusterBitmap8 : public ModelCommand { public: - ReadThermostatLocalTemperature() : ModelCommand("read") + ReadTestClusterBitmap8() : ModelCommand("read") { - AddArgument("attr-name", "local-temperature"); + AddArgument("attr-name", "bitmap8"); ModelCommand::AddArguments(); } - ~ReadThermostatLocalTemperature() + ~ReadTestClusterBitmap8() { delete onSuccessCallback; delete onFailureCallback; @@ -12670,54 +12711,43 @@ class ReadThermostatLocalTemperature : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x00) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x00) on endpoint %" PRIu16, endpointId); - chip::Controller::ThermostatCluster cluster; + chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - return cluster.ReadAttributeLocalTemperature(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + return cluster.ReadAttributeBitmap8(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); } private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnInt16sAttributeResponse, this); + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt8uAttributeResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); }; -class ReportThermostatLocalTemperature : public ModelCommand +class WriteTestClusterBitmap8 : public ModelCommand { public: - ReportThermostatLocalTemperature() : ModelCommand("report") + WriteTestClusterBitmap8() : ModelCommand("write") { - AddArgument("attr-name", "local-temperature"); - AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); - AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); - AddArgument("change", INT16_MIN, INT16_MAX, &mChange); + AddArgument("attr-name", "bitmap8"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); ModelCommand::AddArguments(); } - ~ReportThermostatLocalTemperature() + ~WriteTestClusterBitmap8() { delete onSuccessCallback; delete onFailureCallback; - delete onReportCallback; } CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x06) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x01) on endpoint %" PRIu16, endpointId); - chip::Controller::ThermostatCluster cluster; + chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - - CHIP_ERROR err = cluster.ReportAttributeLocalTemperature(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } - - return cluster.ConfigureAttributeLocalTemperature(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, - mMaxInterval, mChange); + return cluster.WriteAttributeBitmap8(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); } private: @@ -12725,26 +12755,22 @@ class ReportThermostatLocalTemperature : public ModelCommand new chip::Callback::Callback(OnDefaultSuccessResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeResponse, this); - uint16_t mMinInterval; - uint16_t mMaxInterval; - int16_t mChange; + uint8_t mValue; }; /* - * Attribute OccupiedCoolingSetpoint + * Attribute Bitmap16 */ -class ReadThermostatOccupiedCoolingSetpoint : public ModelCommand +class ReadTestClusterBitmap16 : public ModelCommand { public: - ReadThermostatOccupiedCoolingSetpoint() : ModelCommand("read") + ReadTestClusterBitmap16() : ModelCommand("read") { - AddArgument("attr-name", "occupied-cooling-setpoint"); + AddArgument("attr-name", "bitmap16"); ModelCommand::AddArguments(); } - ~ReadThermostatOccupiedCoolingSetpoint() + ~ReadTestClusterBitmap16() { delete onSuccessCallback; delete onFailureCallback; @@ -12752,31 +12778,31 @@ class ReadThermostatOccupiedCoolingSetpoint : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x00) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x00) on endpoint %" PRIu16, endpointId); - chip::Controller::ThermostatCluster cluster; + chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - return cluster.ReadAttributeOccupiedCoolingSetpoint(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + return cluster.ReadAttributeBitmap16(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); } private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnInt16sAttributeResponse, this); + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt16uAttributeResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); }; -class WriteThermostatOccupiedCoolingSetpoint : public ModelCommand +class WriteTestClusterBitmap16 : public ModelCommand { public: - WriteThermostatOccupiedCoolingSetpoint() : ModelCommand("write") + WriteTestClusterBitmap16() : ModelCommand("write") { - AddArgument("attr-name", "occupied-cooling-setpoint"); - AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); + AddArgument("attr-name", "bitmap16"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); ModelCommand::AddArguments(); } - ~WriteThermostatOccupiedCoolingSetpoint() + ~WriteTestClusterBitmap16() { delete onSuccessCallback; delete onFailureCallback; @@ -12784,11 +12810,11 @@ class WriteThermostatOccupiedCoolingSetpoint : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x01) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x01) on endpoint %" PRIu16, endpointId); - chip::Controller::ThermostatCluster cluster; + chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - return cluster.WriteAttributeOccupiedCoolingSetpoint(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); + return cluster.WriteAttributeBitmap16(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); } private: @@ -12796,22 +12822,22 @@ class WriteThermostatOccupiedCoolingSetpoint : public ModelCommand new chip::Callback::Callback(OnDefaultSuccessResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); - int16_t mValue; + uint16_t mValue; }; /* - * Attribute OccupiedHeatingSetpoint + * Attribute Bitmap32 */ -class ReadThermostatOccupiedHeatingSetpoint : public ModelCommand +class ReadTestClusterBitmap32 : public ModelCommand { public: - ReadThermostatOccupiedHeatingSetpoint() : ModelCommand("read") + ReadTestClusterBitmap32() : ModelCommand("read") { - AddArgument("attr-name", "occupied-heating-setpoint"); + AddArgument("attr-name", "bitmap32"); ModelCommand::AddArguments(); } - ~ReadThermostatOccupiedHeatingSetpoint() + ~ReadTestClusterBitmap32() { delete onSuccessCallback; delete onFailureCallback; @@ -12819,31 +12845,31 @@ class ReadThermostatOccupiedHeatingSetpoint : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x00) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x00) on endpoint %" PRIu16, endpointId); - chip::Controller::ThermostatCluster cluster; + chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - return cluster.ReadAttributeOccupiedHeatingSetpoint(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + return cluster.ReadAttributeBitmap32(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); } private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnInt16sAttributeResponse, this); + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt32uAttributeResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); }; -class WriteThermostatOccupiedHeatingSetpoint : public ModelCommand +class WriteTestClusterBitmap32 : public ModelCommand { public: - WriteThermostatOccupiedHeatingSetpoint() : ModelCommand("write") + WriteTestClusterBitmap32() : ModelCommand("write") { - AddArgument("attr-name", "occupied-heating-setpoint"); - AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); + AddArgument("attr-name", "bitmap32"); + AddArgument("attr-value", 0, UINT32_MAX, &mValue); ModelCommand::AddArguments(); } - ~WriteThermostatOccupiedHeatingSetpoint() + ~WriteTestClusterBitmap32() { delete onSuccessCallback; delete onFailureCallback; @@ -12851,11 +12877,11 @@ class WriteThermostatOccupiedHeatingSetpoint : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x01) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x01) on endpoint %" PRIu16, endpointId); - chip::Controller::ThermostatCluster cluster; + chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - return cluster.WriteAttributeOccupiedHeatingSetpoint(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); + return cluster.WriteAttributeBitmap32(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); } private: @@ -12863,22 +12889,22 @@ class WriteThermostatOccupiedHeatingSetpoint : public ModelCommand new chip::Callback::Callback(OnDefaultSuccessResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); - int16_t mValue; + uint32_t mValue; }; /* - * Attribute ControlSequenceOfOperation + * Attribute Bitmap64 */ -class ReadThermostatControlSequenceOfOperation : public ModelCommand +class ReadTestClusterBitmap64 : public ModelCommand { public: - ReadThermostatControlSequenceOfOperation() : ModelCommand("read") + ReadTestClusterBitmap64() : ModelCommand("read") { - AddArgument("attr-name", "control-sequence-of-operation"); + AddArgument("attr-name", "bitmap64"); ModelCommand::AddArguments(); } - ~ReadThermostatControlSequenceOfOperation() + ~ReadTestClusterBitmap64() { delete onSuccessCallback; delete onFailureCallback; @@ -12886,31 +12912,31 @@ class ReadThermostatControlSequenceOfOperation : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x00) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x00) on endpoint %" PRIu16, endpointId); - chip::Controller::ThermostatCluster cluster; + chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - return cluster.ReadAttributeControlSequenceOfOperation(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + return cluster.ReadAttributeBitmap64(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); } private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnInt8uAttributeResponse, this); + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt64uAttributeResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); }; -class WriteThermostatControlSequenceOfOperation : public ModelCommand +class WriteTestClusterBitmap64 : public ModelCommand { public: - WriteThermostatControlSequenceOfOperation() : ModelCommand("write") + WriteTestClusterBitmap64() : ModelCommand("write") { - AddArgument("attr-name", "control-sequence-of-operation"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); + AddArgument("attr-name", "bitmap64"); + AddArgument("attr-value", 0, UINT64_MAX, &mValue); ModelCommand::AddArguments(); } - ~WriteThermostatControlSequenceOfOperation() + ~WriteTestClusterBitmap64() { delete onSuccessCallback; delete onFailureCallback; @@ -12918,11 +12944,11 @@ class WriteThermostatControlSequenceOfOperation : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x01) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x01) on endpoint %" PRIu16, endpointId); - chip::Controller::ThermostatCluster cluster; + chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - return cluster.WriteAttributeControlSequenceOfOperation(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); + return cluster.WriteAttributeBitmap64(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); } private: @@ -12930,22 +12956,22 @@ class WriteThermostatControlSequenceOfOperation : public ModelCommand new chip::Callback::Callback(OnDefaultSuccessResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); - uint8_t mValue; + uint64_t mValue; }; /* - * Attribute SystemMode + * Attribute Int8u */ -class ReadThermostatSystemMode : public ModelCommand +class ReadTestClusterInt8u : public ModelCommand { public: - ReadThermostatSystemMode() : ModelCommand("read") + ReadTestClusterInt8u() : ModelCommand("read") { - AddArgument("attr-name", "system-mode"); + AddArgument("attr-name", "int8u"); ModelCommand::AddArguments(); } - ~ReadThermostatSystemMode() + ~ReadTestClusterInt8u() { delete onSuccessCallback; delete onFailureCallback; @@ -12953,11 +12979,11 @@ class ReadThermostatSystemMode : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x00) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x00) on endpoint %" PRIu16, endpointId); - chip::Controller::ThermostatCluster cluster; + chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - return cluster.ReadAttributeSystemMode(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + return cluster.ReadAttributeInt8u(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); } private: @@ -12967,17 +12993,17 @@ class ReadThermostatSystemMode : public ModelCommand new chip::Callback::Callback(OnDefaultFailureResponse, this); }; -class WriteThermostatSystemMode : public ModelCommand +class WriteTestClusterInt8u : public ModelCommand { public: - WriteThermostatSystemMode() : ModelCommand("write") + WriteTestClusterInt8u() : ModelCommand("write") { - AddArgument("attr-name", "system-mode"); + AddArgument("attr-name", "int8u"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); ModelCommand::AddArguments(); } - ~WriteThermostatSystemMode() + ~WriteTestClusterInt8u() { delete onSuccessCallback; delete onFailureCallback; @@ -12985,11 +13011,11 @@ class WriteThermostatSystemMode : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x01) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x01) on endpoint %" PRIu16, endpointId); - chip::Controller::ThermostatCluster cluster; + chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - return cluster.WriteAttributeSystemMode(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); + return cluster.WriteAttributeInt8u(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); } private: @@ -13001,18 +13027,18 @@ class WriteThermostatSystemMode : public ModelCommand }; /* - * Attribute ClusterRevision + * Attribute Int16u */ -class ReadThermostatClusterRevision : public ModelCommand +class ReadTestClusterInt16u : public ModelCommand { public: - ReadThermostatClusterRevision() : ModelCommand("read") + ReadTestClusterInt16u() : ModelCommand("read") { - AddArgument("attr-name", "cluster-revision"); + AddArgument("attr-name", "int16u"); ModelCommand::AddArguments(); } - ~ReadThermostatClusterRevision() + ~ReadTestClusterInt16u() { delete onSuccessCallback; delete onFailureCallback; @@ -13020,9 +13046,1318 @@ class ReadThermostatClusterRevision : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x00) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x00) on endpoint %" PRIu16, endpointId); - chip::Controller::ThermostatCluster cluster; + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributeInt16u(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt16uAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteTestClusterInt16u : public ModelCommand +{ +public: + WriteTestClusterInt16u() : ModelCommand("write") + { + AddArgument("attr-name", "int16u"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterInt16u() + { + 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.WriteAttributeInt16u(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); + uint16_t mValue; +}; + +/* + * Attribute Int32u + */ +class ReadTestClusterInt32u : public ModelCommand +{ +public: + ReadTestClusterInt32u() : ModelCommand("read") + { + AddArgument("attr-name", "int32u"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterInt32u() + { + 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.ReadAttributeInt32u(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt32uAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteTestClusterInt32u : public ModelCommand +{ +public: + WriteTestClusterInt32u() : ModelCommand("write") + { + AddArgument("attr-name", "int32u"); + AddArgument("attr-value", 0, UINT32_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterInt32u() + { + 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.WriteAttributeInt32u(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); + uint32_t mValue; +}; + +/* + * Attribute Int64u + */ +class ReadTestClusterInt64u : public ModelCommand +{ +public: + ReadTestClusterInt64u() : ModelCommand("read") + { + AddArgument("attr-name", "int64u"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterInt64u() + { + 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.ReadAttributeInt64u(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt64uAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteTestClusterInt64u : public ModelCommand +{ +public: + WriteTestClusterInt64u() : ModelCommand("write") + { + AddArgument("attr-name", "int64u"); + AddArgument("attr-value", 0, UINT64_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterInt64u() + { + 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.WriteAttributeInt64u(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); + uint64_t mValue; +}; + +/* + * Attribute Int8s + */ +class ReadTestClusterInt8s : public ModelCommand +{ +public: + ReadTestClusterInt8s() : ModelCommand("read") + { + AddArgument("attr-name", "int8s"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterInt8s() + { + 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.ReadAttributeInt8s(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt8sAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteTestClusterInt8s : public ModelCommand +{ +public: + WriteTestClusterInt8s() : ModelCommand("write") + { + AddArgument("attr-name", "int8s"); + AddArgument("attr-value", INT8_MIN, INT8_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterInt8s() + { + 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.WriteAttributeInt8s(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); + int8_t mValue; +}; + +/* + * Attribute Int16s + */ +class ReadTestClusterInt16s : public ModelCommand +{ +public: + ReadTestClusterInt16s() : ModelCommand("read") + { + AddArgument("attr-name", "int16s"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterInt16s() + { + 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.ReadAttributeInt16s(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt16sAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteTestClusterInt16s : public ModelCommand +{ +public: + WriteTestClusterInt16s() : ModelCommand("write") + { + AddArgument("attr-name", "int16s"); + AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterInt16s() + { + 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.WriteAttributeInt16s(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); + int16_t mValue; +}; + +/* + * Attribute Int32s + */ +class ReadTestClusterInt32s : public ModelCommand +{ +public: + ReadTestClusterInt32s() : ModelCommand("read") + { + AddArgument("attr-name", "int32s"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterInt32s() + { + 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.ReadAttributeInt32s(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt32sAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteTestClusterInt32s : public ModelCommand +{ +public: + WriteTestClusterInt32s() : ModelCommand("write") + { + AddArgument("attr-name", "int32s"); + AddArgument("attr-value", INT32_MIN, INT32_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterInt32s() + { + 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.WriteAttributeInt32s(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); + int32_t mValue; +}; + +/* + * Attribute Int64s + */ +class ReadTestClusterInt64s : public ModelCommand +{ +public: + ReadTestClusterInt64s() : ModelCommand("read") + { + AddArgument("attr-name", "int64s"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterInt64s() + { + 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.ReadAttributeInt64s(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt64sAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteTestClusterInt64s : public ModelCommand +{ +public: + WriteTestClusterInt64s() : ModelCommand("write") + { + AddArgument("attr-name", "int64s"); + AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterInt64s() + { + 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.WriteAttributeInt64s(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); + int64_t mValue; +}; + +/* + * Attribute Enum8 + */ +class ReadTestClusterEnum8 : public ModelCommand +{ +public: + ReadTestClusterEnum8() : ModelCommand("read") + { + AddArgument("attr-name", "enum8"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterEnum8() + { + 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.ReadAttributeEnum8(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt8uAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteTestClusterEnum8 : public ModelCommand +{ +public: + WriteTestClusterEnum8() : ModelCommand("write") + { + AddArgument("attr-name", "enum8"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterEnum8() + { + 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.WriteAttributeEnum8(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 Enum16 + */ +class ReadTestClusterEnum16 : public ModelCommand +{ +public: + ReadTestClusterEnum16() : ModelCommand("read") + { + AddArgument("attr-name", "enum16"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterEnum16() + { + 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.ReadAttributeEnum16(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt16uAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteTestClusterEnum16 : public ModelCommand +{ +public: + WriteTestClusterEnum16() : ModelCommand("write") + { + AddArgument("attr-name", "enum16"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterEnum16() + { + 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.WriteAttributeEnum16(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); + uint16_t mValue; +}; + +/* + * Attribute OctetString + */ +class ReadTestClusterOctetString : public ModelCommand +{ +public: + ReadTestClusterOctetString() : ModelCommand("read") + { + AddArgument("attr-name", "octet-string"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterOctetString() + { + 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.ReadAttributeOctetString(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 WriteTestClusterOctetString : public ModelCommand +{ +public: + WriteTestClusterOctetString() : ModelCommand("write") + { + AddArgument("attr-name", "octet-string"); + AddArgument("attr-value", &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterOctetString() + { + 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.WriteAttributeOctetString(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), + chip::ByteSpan(chip::Uint8::from_char(mValue), strlen(mValue))); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + char * mValue; +}; + +/* + * Attribute ListInt8u + */ +class ReadTestClusterListInt8u : public ModelCommand +{ +public: + ReadTestClusterListInt8u() : ModelCommand("read") + { + AddArgument("attr-name", "list-int8u"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterListInt8u() + { + 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.ReadAttributeListInt8u(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnTestClusterListInt8uListAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +/* + * Attribute ClusterRevision + */ +class ReadTestClusterClusterRevision : public ModelCommand +{ +public: + ReadTestClusterClusterRevision() : ModelCommand("read") + { + AddArgument("attr-name", "cluster-revision"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterClusterRevision() + { + 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.ReadAttributeClusterRevision(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt16uAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +/*----------------------------------------------------------------------------*\ +| Cluster Thermostat | 0x0201 | +|------------------------------------------------------------------------------| +| Commands: | | +| * ClearWeeklySchedule | 0x03 | +| * GetRelayStatusLog | 0x04 | +| * GetWeeklySchedule | 0x02 | +| * SetWeeklySchedule | 0x01 | +| * SetpointRaiseLower | 0x00 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * LocalTemperature | 0x0000 | +| * OccupiedCoolingSetpoint | 0x0011 | +| * OccupiedHeatingSetpoint | 0x0012 | +| * ControlSequenceOfOperation | 0x001B | +| * SystemMode | 0x001C | +| * ClusterRevision | 0xFFFD | +\*----------------------------------------------------------------------------*/ + +/* + * Command ClearWeeklySchedule + */ +class ThermostatClearWeeklySchedule : public ModelCommand +{ +public: + ThermostatClearWeeklySchedule() : ModelCommand("clear-weekly-schedule") { ModelCommand::AddArguments(); } + ~ThermostatClearWeeklySchedule() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x03) on endpoint %" PRIu16, endpointId); + + chip::Controller::ThermostatCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ClearWeeklySchedule(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +/* + * Command GetRelayStatusLog + */ +class ThermostatGetRelayStatusLog : public ModelCommand +{ +public: + ThermostatGetRelayStatusLog() : ModelCommand("get-relay-status-log") { ModelCommand::AddArguments(); } + ~ThermostatGetRelayStatusLog() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x04) on endpoint %" PRIu16, endpointId); + + chip::Controller::ThermostatCluster cluster; + cluster.Associate(device, endpointId); + return cluster.GetRelayStatusLog(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +/* + * Command GetWeeklySchedule + */ +class ThermostatGetWeeklySchedule : public ModelCommand +{ +public: + ThermostatGetWeeklySchedule() : ModelCommand("get-weekly-schedule") + { + AddArgument("daysToReturn", 0, UINT8_MAX, &mDaysToReturn); + AddArgument("modeToReturn", 0, UINT8_MAX, &mModeToReturn); + ModelCommand::AddArguments(); + } + ~ThermostatGetWeeklySchedule() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x02) on endpoint %" PRIu16, endpointId); + + chip::Controller::ThermostatCluster cluster; + cluster.Associate(device, endpointId); + return cluster.GetWeeklySchedule(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mDaysToReturn, mModeToReturn); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + uint8_t mDaysToReturn; + uint8_t mModeToReturn; +}; + +/* + * Command SetWeeklySchedule + */ +class ThermostatSetWeeklySchedule : public ModelCommand +{ +public: + ThermostatSetWeeklySchedule() : ModelCommand("set-weekly-schedule") + { + AddArgument("numberOfTransitionsForSequence", 0, UINT8_MAX, &mNumberOfTransitionsForSequence); + AddArgument("dayOfWeekForSequence", 0, UINT8_MAX, &mDayOfWeekForSequence); + AddArgument("modeForSequence", 0, UINT8_MAX, &mModeForSequence); + AddArgument("payload", 0, UINT8_MAX, &mPayload); + ModelCommand::AddArguments(); + } + ~ThermostatSetWeeklySchedule() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x01) on endpoint %" PRIu16, endpointId); + + chip::Controller::ThermostatCluster cluster; + cluster.Associate(device, endpointId); + return cluster.SetWeeklySchedule(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mNumberOfTransitionsForSequence, + mDayOfWeekForSequence, mModeForSequence, mPayload); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + uint8_t mNumberOfTransitionsForSequence; + uint8_t mDayOfWeekForSequence; + uint8_t mModeForSequence; + uint8_t mPayload; +}; + +/* + * Command SetpointRaiseLower + */ +class ThermostatSetpointRaiseLower : public ModelCommand +{ +public: + ThermostatSetpointRaiseLower() : ModelCommand("setpoint-raise-lower") + { + AddArgument("mode", 0, UINT8_MAX, &mMode); + AddArgument("amount", INT8_MIN, INT8_MAX, &mAmount); + ModelCommand::AddArguments(); + } + ~ThermostatSetpointRaiseLower() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::ThermostatCluster cluster; + cluster.Associate(device, endpointId); + return cluster.SetpointRaiseLower(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMode, mAmount); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + uint8_t mMode; + int8_t mAmount; +}; + +/* + * Discover Attributes + */ +class DiscoverThermostatAttributes : public ModelCommand +{ +public: + DiscoverThermostatAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); } + + ~DiscoverThermostatAttributes() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x0C) on endpoint %" PRIu16, endpointId); + + chip::Controller::ThermostatCluster cluster; + cluster.Associate(device, endpointId); + return cluster.DiscoverAttributes(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +/* + * Attribute LocalTemperature + */ +class ReadThermostatLocalTemperature : public ModelCommand +{ +public: + ReadThermostatLocalTemperature() : ModelCommand("read") + { + AddArgument("attr-name", "local-temperature"); + ModelCommand::AddArguments(); + } + + ~ReadThermostatLocalTemperature() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::ThermostatCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributeLocalTemperature(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt16sAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class ReportThermostatLocalTemperature : public ModelCommand +{ +public: + ReportThermostatLocalTemperature() : ModelCommand("report") + { + AddArgument("attr-name", "local-temperature"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("change", INT16_MIN, INT16_MAX, &mChange); + ModelCommand::AddArguments(); + } + + ~ReportThermostatLocalTemperature() + { + delete onSuccessCallback; + delete onFailureCallback; + delete onReportCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x06) on endpoint %" PRIu16, endpointId); + + chip::Controller::ThermostatCluster cluster; + cluster.Associate(device, endpointId); + + CHIP_ERROR err = cluster.ReportAttributeLocalTemperature(onReportCallback->Cancel()); + if (err != CHIP_NO_ERROR) + { + return err; + } + + return cluster.ConfigureAttributeLocalTemperature(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, + mMaxInterval, mChange); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + chip::Callback::Callback * onReportCallback = + new chip::Callback::Callback(OnInt16sAttributeResponse, this); + uint16_t mMinInterval; + uint16_t mMaxInterval; + int16_t mChange; +}; + +/* + * Attribute OccupiedCoolingSetpoint + */ +class ReadThermostatOccupiedCoolingSetpoint : public ModelCommand +{ +public: + ReadThermostatOccupiedCoolingSetpoint() : ModelCommand("read") + { + AddArgument("attr-name", "occupied-cooling-setpoint"); + ModelCommand::AddArguments(); + } + + ~ReadThermostatOccupiedCoolingSetpoint() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::ThermostatCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributeOccupiedCoolingSetpoint(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt16sAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteThermostatOccupiedCoolingSetpoint : public ModelCommand +{ +public: + WriteThermostatOccupiedCoolingSetpoint() : ModelCommand("write") + { + AddArgument("attr-name", "occupied-cooling-setpoint"); + AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteThermostatOccupiedCoolingSetpoint() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x01) on endpoint %" PRIu16, endpointId); + + chip::Controller::ThermostatCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttributeOccupiedCoolingSetpoint(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); + int16_t mValue; +}; + +/* + * Attribute OccupiedHeatingSetpoint + */ +class ReadThermostatOccupiedHeatingSetpoint : public ModelCommand +{ +public: + ReadThermostatOccupiedHeatingSetpoint() : ModelCommand("read") + { + AddArgument("attr-name", "occupied-heating-setpoint"); + ModelCommand::AddArguments(); + } + + ~ReadThermostatOccupiedHeatingSetpoint() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::ThermostatCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributeOccupiedHeatingSetpoint(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt16sAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteThermostatOccupiedHeatingSetpoint : public ModelCommand +{ +public: + WriteThermostatOccupiedHeatingSetpoint() : ModelCommand("write") + { + AddArgument("attr-name", "occupied-heating-setpoint"); + AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteThermostatOccupiedHeatingSetpoint() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x01) on endpoint %" PRIu16, endpointId); + + chip::Controller::ThermostatCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttributeOccupiedHeatingSetpoint(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); + int16_t mValue; +}; + +/* + * Attribute ControlSequenceOfOperation + */ +class ReadThermostatControlSequenceOfOperation : public ModelCommand +{ +public: + ReadThermostatControlSequenceOfOperation() : ModelCommand("read") + { + AddArgument("attr-name", "control-sequence-of-operation"); + ModelCommand::AddArguments(); + } + + ~ReadThermostatControlSequenceOfOperation() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::ThermostatCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributeControlSequenceOfOperation(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt8uAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteThermostatControlSequenceOfOperation : public ModelCommand +{ +public: + WriteThermostatControlSequenceOfOperation() : ModelCommand("write") + { + AddArgument("attr-name", "control-sequence-of-operation"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteThermostatControlSequenceOfOperation() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x01) on endpoint %" PRIu16, endpointId); + + chip::Controller::ThermostatCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttributeControlSequenceOfOperation(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 SystemMode + */ +class ReadThermostatSystemMode : public ModelCommand +{ +public: + ReadThermostatSystemMode() : ModelCommand("read") + { + AddArgument("attr-name", "system-mode"); + ModelCommand::AddArguments(); + } + + ~ReadThermostatSystemMode() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::ThermostatCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributeSystemMode(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt8uAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteThermostatSystemMode : public ModelCommand +{ +public: + WriteThermostatSystemMode() : ModelCommand("write") + { + AddArgument("attr-name", "system-mode"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteThermostatSystemMode() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x01) on endpoint %" PRIu16, endpointId); + + chip::Controller::ThermostatCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttributeSystemMode(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 + */ +class ReadThermostatClusterRevision : public ModelCommand +{ +public: + ReadThermostatClusterRevision() : ModelCommand("read") + { + AddArgument("attr-name", "cluster-revision"); + ModelCommand::AddArguments(); + } + + ~ReadThermostatClusterRevision() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0201) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::ThermostatCluster cluster; cluster.Associate(device, endpointId); return cluster.ReadAttributeClusterRevision(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); } @@ -13675,6 +15010,53 @@ void registerClusterTemperatureMeasurement(Commands & commands) commands.Register(clusterName, clusterCommands); } +void registerClusterTestCluster(Commands & commands) +{ + const char * clusterName = "TestCluster"; + + commands_list clusterCommands = { + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + }; + + commands.Register(clusterName, clusterCommands); +} void registerClusterThermostat(Commands & commands) { const char * clusterName = "Thermostat"; @@ -13745,6 +15127,7 @@ void registerClusters(Commands & commands) registerClusterTvChannel(commands); registerClusterTargetNavigator(commands); registerClusterTemperatureMeasurement(commands); + registerClusterTestCluster(commands); registerClusterThermostat(commands); registerClusterWakeOnLan(commands); } diff --git a/examples/chip-tool/gen/CHIPClientCallbacks.cpp b/examples/chip-tool/gen/CHIPClientCallbacks.cpp index 70a488cb90df99..84abd16b2426bb 100644 --- a/examples/chip-tool/gen/CHIPClientCallbacks.cpp +++ b/examples/chip-tool/gen/CHIPClientCallbacks.cpp @@ -506,6 +506,26 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag } } break; + case 0x050F: + switch (attributeId) + { + case 0x001A: // INT8U + { + uint8_t data[count]; + for (size_t i = 0; i < count; i++) + { + data[i] = emberAfGetInt8u(message, 0, messageLen); + message += 1; + CHECK_MESSAGE_LENGTH(1); + } + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, count, data); + break; + } + } + break; } break; } @@ -2052,6 +2072,19 @@ bool emberAfTargetNavigatorClusterNavigateTargetResponseCallback(chip::app::Comm return true; } +bool emberAfTestClusterClusterTestSpecificResponseCallback(chip::app::Command * commandObj, uint8_t returnValue) +{ + ChipLogProgress(Zcl, "TestSpecificResponse:"); + ChipLogProgress(Zcl, " returnValue: %" PRIu8 "", returnValue); + + GET_RESPONSE_CALLBACKS("TestClusterClusterTestSpecificResponseCallback"); + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, returnValue); + return true; +} + bool emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * message, uint16_t messageLen) { ChipLogProgress(Zcl, "emberAfReportAttributeCallback:"); diff --git a/examples/chip-tool/gen/CHIPClientCallbacks.h b/examples/chip-tool/gen/CHIPClientCallbacks.h index 8f56f0dbb498ab..79336b599e30af 100644 --- a/examples/chip-tool/gen/CHIPClientCallbacks.h +++ b/examples/chip-tool/gen/CHIPClientCallbacks.h @@ -125,6 +125,7 @@ typedef void (*TvChannelClusterChangeChannelResponseCallback)(void * context, /* TYPE WARNING: array array defaults to */ uint8_t * ChannelMatch, uint8_t ErrorType); typedef void (*TargetNavigatorClusterNavigateTargetResponseCallback)(void * context, uint8_t * data); +typedef void (*TestClusterClusterTestSpecificResponseCallback)(void * context, uint8_t returnValue); typedef void (*ThermostatClusterCurrentWeeklyScheduleCallback)(void * context, uint8_t numberOfTransitionsForSequence, uint8_t dayOfWeekForSequence, uint8_t modeForSequence, /* TYPE WARNING: array array defaults to */ uint8_t * payload); @@ -140,3 +141,4 @@ typedef void (*DescriptorPartsListListAttributeCallback)(void * context, uint16_ typedef void (*GroupKeyManagementGroupsListAttributeCallback)(void * context, uint16_t count, _GroupState * entries); typedef void (*GroupKeyManagementGroupKeysListAttributeCallback)(void * context, uint16_t count, _GroupKey * entries); typedef void (*OperationalCredentialsFabricsListListAttributeCallback)(void * context, uint16_t count, _FabricDescriptor * entries); +typedef void (*TestClusterListInt8uListAttributeCallback)(void * context, uint16_t count, uint8_t * entries); diff --git a/examples/chip-tool/gen/CHIPClusters.cpp b/examples/chip-tool/gen/CHIPClusters.cpp index bf5576722bee36..86146e3b8c8e58 100644 --- a/examples/chip-tool/gen/CHIPClusters.cpp +++ b/examples/chip-tool/gen/CHIPClusters.cpp @@ -5303,6 +5303,362 @@ CHIP_ERROR TemperatureMeasurementCluster::ReadAttributeClusterRevision(Callback: return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); } +// TestCluster Cluster Commands +CHIP_ERROR TestClusterCluster::Test(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kTestCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + // Command takes no arguments. + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterTestCommand(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + +CHIP_ERROR TestClusterCluster::TestNotHandled(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kTestNotHandledCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + // Command takes no arguments. + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterTestNotHandledCommand(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + +CHIP_ERROR TestClusterCluster::TestSpecific(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kTestSpecificCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + // Command takes no arguments. + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterTestSpecificCommand(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + +// TestCluster Cluster Attributes +CHIP_ERROR TestClusterCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterDiscoverAttributes(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} +CHIP_ERROR TestClusterCluster::ReadAttributeBoolean(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadBooleanAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeBoolean(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint8_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteBooleanAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeBitmap8(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadBitmap8Attribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeBitmap8(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint8_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteBitmap8Attribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeBitmap16(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadBitmap16Attribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeBitmap16(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteBitmap16Attribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeBitmap32(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadBitmap32Attribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeBitmap32(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint32_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteBitmap32Attribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeBitmap64(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadBitmap64Attribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeBitmap64(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint64_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteBitmap64Attribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeInt8u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadInt8uAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeInt8u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint8_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteInt8uAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeInt16u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadInt16uAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeInt16u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteInt16uAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeInt32u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadInt32uAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeInt32u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint32_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteInt32uAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeInt64u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadInt64uAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeInt64u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint64_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteInt64uAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeInt8s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadInt8sAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeInt8s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, int8_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteInt8sAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeInt16s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadInt16sAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeInt16s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, int16_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteInt16sAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeInt32s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadInt32sAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeInt32s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, int32_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteInt32sAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeInt64s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadInt64sAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeInt64s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, int64_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteInt64sAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeEnum8(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadEnum8Attribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeEnum8(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint8_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteEnum8Attribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeEnum16(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadEnum16Attribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeEnum16(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteEnum16Attribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeOctetString(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadOctetStringAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeOctetString(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, chip::ByteSpan value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteOctetStringAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeListInt8u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadListInt8uAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadClusterRevisionAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + // Thermostat Cluster Commands CHIP_ERROR ThermostatCluster::ClearWeeklySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) diff --git a/examples/chip-tool/gen/CHIPClusters.h b/examples/chip-tool/gen/CHIPClusters.h index aced89e986465a..33ab97783dcf0c 100644 --- a/examples/chip-tool/gen/CHIPClusters.h +++ b/examples/chip-tool/gen/CHIPClusters.h @@ -56,6 +56,7 @@ constexpr ClusterId kSwitchClusterId = 0x003B; constexpr ClusterId kTvChannelClusterId = 0x0504; constexpr ClusterId kTargetNavigatorClusterId = 0x0505; constexpr ClusterId kTemperatureMeasurementClusterId = 0x0402; +constexpr ClusterId kTestClusterClusterId = 0x050F; constexpr ClusterId kThermostatClusterId = 0x0201; constexpr ClusterId kWakeOnLanClusterId = 0x0503; @@ -978,6 +979,76 @@ class DLL_EXPORT TemperatureMeasurementCluster : public ClusterBase CHIP_ERROR ReportAttributeMeasuredValue(Callback::Cancelable * onReportCallback); }; +class DLL_EXPORT TestClusterCluster : public ClusterBase +{ +public: + TestClusterCluster() : ClusterBase(kTestClusterClusterId) {} + ~TestClusterCluster() {} + + // Cluster Commands + CHIP_ERROR Test(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR TestNotHandled(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR TestSpecific(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + + // Cluster Attributes + CHIP_ERROR DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeBoolean(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeBitmap8(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeBitmap16(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeBitmap32(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeBitmap64(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeInt8u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeInt16u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeInt32u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeInt64u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeInt8s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeInt16s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeInt32s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeInt64s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeEnum8(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeEnum16(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeOctetString(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeListInt8u(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); + CHIP_ERROR WriteAttributeBitmap8(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t value); + CHIP_ERROR WriteAttributeBitmap16(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t value); + CHIP_ERROR WriteAttributeBitmap32(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint32_t value); + CHIP_ERROR WriteAttributeBitmap64(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint64_t value); + CHIP_ERROR WriteAttributeInt8u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t value); + CHIP_ERROR WriteAttributeInt16u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t value); + CHIP_ERROR WriteAttributeInt32u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint32_t value); + CHIP_ERROR WriteAttributeInt64u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint64_t value); + CHIP_ERROR WriteAttributeInt8s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + int8_t value); + CHIP_ERROR WriteAttributeInt16s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + int16_t value); + CHIP_ERROR WriteAttributeInt32s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + int32_t value); + CHIP_ERROR WriteAttributeInt64s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + int64_t value); + CHIP_ERROR WriteAttributeEnum8(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t value); + CHIP_ERROR WriteAttributeEnum16(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t value); + CHIP_ERROR WriteAttributeOctetString(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + chip::ByteSpan value); + +private: + static constexpr CommandId kTestCommandId = 0x00; + static constexpr CommandId kTestNotHandledCommandId = 0x01; + static constexpr CommandId kTestSpecificCommandId = 0x02; +}; + class DLL_EXPORT ThermostatCluster : public ClusterBase { public: diff --git a/examples/chip-tool/gen/CHIPClustersObjc.h b/examples/chip-tool/gen/CHIPClustersObjc.h index d0170ef2e91fc4..b93a294f29bf1f 100644 --- a/examples/chip-tool/gen/CHIPClustersObjc.h +++ b/examples/chip-tool/gen/CHIPClustersObjc.h @@ -827,6 +827,53 @@ NS_ASSUME_NONNULL_BEGIN @end +/** + * Cluster Test Cluster + * + */ +@interface CHIPTestCluster : CHIPCluster + +- (void)test:(ResponseHandler)completionHandler; +- (void)testNotHandled:(ResponseHandler)completionHandler; +- (void)testSpecific:(ResponseHandler)completionHandler; + +- (void)readAttributeBoolean:(ResponseHandler)completionHandler; +- (void)writeAttributeBoolean:(uint8_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeBitmap8:(ResponseHandler)completionHandler; +- (void)writeAttributeBitmap8:(uint8_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeBitmap16:(ResponseHandler)completionHandler; +- (void)writeAttributeBitmap16:(uint16_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeBitmap32:(ResponseHandler)completionHandler; +- (void)writeAttributeBitmap32:(uint32_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeBitmap64:(ResponseHandler)completionHandler; +- (void)writeAttributeBitmap64:(uint64_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeInt8u:(ResponseHandler)completionHandler; +- (void)writeAttributeInt8u:(uint8_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeInt16u:(ResponseHandler)completionHandler; +- (void)writeAttributeInt16u:(uint16_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeInt32u:(ResponseHandler)completionHandler; +- (void)writeAttributeInt32u:(uint32_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeInt64u:(ResponseHandler)completionHandler; +- (void)writeAttributeInt64u:(uint64_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeInt8s:(ResponseHandler)completionHandler; +- (void)writeAttributeInt8s:(int8_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeInt16s:(ResponseHandler)completionHandler; +- (void)writeAttributeInt16s:(int16_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeInt32s:(ResponseHandler)completionHandler; +- (void)writeAttributeInt32s:(int32_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeInt64s:(ResponseHandler)completionHandler; +- (void)writeAttributeInt64s:(int64_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeEnum8:(ResponseHandler)completionHandler; +- (void)writeAttributeEnum8:(uint8_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeEnum16:(ResponseHandler)completionHandler; +- (void)writeAttributeEnum16:(uint16_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeOctetString:(ResponseHandler)completionHandler; +- (void)writeAttributeOctetString:(NSData *)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeListInt8u:(ResponseHandler)completionHandler; +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler; + +@end + /** * Cluster Thermostat * diff --git a/examples/chip-tool/gen/CHIPClustersObjc.mm b/examples/chip-tool/gen/CHIPClustersObjc.mm index ed80a36ca9e775..7e46e2467edef7 100644 --- a/examples/chip-tool/gen/CHIPClustersObjc.mm +++ b/examples/chip-tool/gen/CHIPClustersObjc.mm @@ -259,6 +259,38 @@ static void CallbackFn(void * context, uint16_t value) bool mKeepAlive; }; +class CHIPInt16sAttributeCallbackBridge : public Callback::Callback { +public: + CHIPInt16sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + , mKeepAlive(keepAlive) + { + } + + ~CHIPInt16sAttributeCallbackBridge() {}; + + static void CallbackFn(void * context, int16_t value) + { + CHIPInt16sAttributeCallbackBridge * callback = reinterpret_cast(context); + if (callback && callback->mQueue) { + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { @"value" : [NSNumber numberWithShort:value] }); + if (!callback->mKeepAlive) { + callback->Cancel(); + delete callback; + } + }); + } + }; + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; + bool mKeepAlive; +}; + class CHIPInt32uAttributeCallbackBridge : public Callback::Callback { public: CHIPInt32uAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false) @@ -291,6 +323,38 @@ static void CallbackFn(void * context, uint32_t value) bool mKeepAlive; }; +class CHIPInt32sAttributeCallbackBridge : public Callback::Callback { +public: + CHIPInt32sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + , mKeepAlive(keepAlive) + { + } + + ~CHIPInt32sAttributeCallbackBridge() {}; + + static void CallbackFn(void * context, int32_t value) + { + CHIPInt32sAttributeCallbackBridge * callback = reinterpret_cast(context); + if (callback && callback->mQueue) { + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { @"value" : [NSNumber numberWithLong:value] }); + if (!callback->mKeepAlive) { + callback->Cancel(); + delete callback; + } + }); + } + }; + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; + bool mKeepAlive; +}; + class CHIPInt64uAttributeCallbackBridge : public Callback::Callback { public: CHIPInt64uAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false) @@ -323,24 +387,24 @@ static void CallbackFn(void * context, uint64_t value) bool mKeepAlive; }; -class CHIPInt16sAttributeCallbackBridge : public Callback::Callback { +class CHIPInt64sAttributeCallbackBridge : public Callback::Callback { public: - CHIPInt16sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false) - : Callback::Callback(CallbackFn, this) + CHIPInt64sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false) + : Callback::Callback(CallbackFn, this) , mHandler(handler) , mQueue(queue) , mKeepAlive(keepAlive) { } - ~CHIPInt16sAttributeCallbackBridge() {}; + ~CHIPInt64sAttributeCallbackBridge() {}; - static void CallbackFn(void * context, int16_t value) + static void CallbackFn(void * context, int64_t value) { - CHIPInt16sAttributeCallbackBridge * callback = reinterpret_cast(context); + CHIPInt64sAttributeCallbackBridge * callback = reinterpret_cast(context); if (callback && callback->mQueue) { dispatch_async(callback->mQueue, ^{ - callback->mHandler(nil, @ { @"value" : [NSNumber numberWithShort:value] }); + callback->mHandler(nil, @ { @"value" : [NSNumber numberWithLongLong:value] }); if (!callback->mKeepAlive) { callback->Cancel(); delete callback; @@ -2419,6 +2483,38 @@ static void CallbackFn(void * context, uint8_t * data) dispatch_queue_t mQueue; }; +class CHIPTestClusterClusterTestSpecificResponseCallbackBridge + : public Callback::Callback { +public: + CHIPTestClusterClusterTestSpecificResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPTestClusterClusterTestSpecificResponseCallbackBridge() {}; + + static void CallbackFn(void * context, uint8_t returnValue) + { + CHIPTestClusterClusterTestSpecificResponseCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { + @"returnValue" : [NSNumber numberWithUnsignedChar:returnValue], + }); + callback->Cancel(); + delete callback; + }); + } + }; + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + class CHIPThermostatClusterCurrentWeeklyScheduleCallbackBridge : public Callback::Callback { public: @@ -2754,6 +2850,41 @@ static void CallbackFn(void * context, uint16_t count, _FabricDescriptor * entri dispatch_queue_t mQueue; }; +class CHIPTestClusterListInt8uAttributeCallbackBridge : public Callback::Callback { +public: + CHIPTestClusterListInt8uAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPTestClusterListInt8uAttributeCallbackBridge() {}; + + static void CallbackFn(void * context, uint16_t count, uint8_t * entries) + { + CHIPTestClusterListInt8uAttributeCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + id values[count]; + for (uint16_t i = 0; i < count; i++) { + values[i] = [NSNumber numberWithUnsignedChar:entries[i]]; + } + + id array = [NSArray arrayWithObjects:values count:count]; + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { @"value" : array }); + callback->Cancel(); + delete callback; + }); + } + } + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + @interface CHIPCluster () @property (readonly, nonatomic) dispatch_queue_t callbackQueue; @property (readonly, nonatomic) dispatch_queue_t chipWorkQueue; @@ -11507,6 +11638,1021 @@ - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler @end +@interface CHIPTestCluster () +@property (readonly) Controller::TestClusterCluster cppCluster; +@end + +@implementation CHIPTestCluster + +- (Controller::ClusterBase *)getCluster +{ + return &_cppCluster; +} + +- (void)test:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.Test(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)testNotHandled:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.TestNotHandled(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)testSpecific:(ResponseHandler)completionHandler +{ + CHIPTestClusterClusterTestSpecificResponseCallbackBridge * onSuccess + = new CHIPTestClusterClusterTestSpecificResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.TestSpecific(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeBoolean:(ResponseHandler)completionHandler +{ + CHIPBooleanAttributeCallbackBridge * onSuccess + = new CHIPBooleanAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeBoolean(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeBoolean:(uint8_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeBoolean(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeBitmap8:(ResponseHandler)completionHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeBitmap8(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeBitmap8:(uint8_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeBitmap8(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeBitmap16:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeBitmap16(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeBitmap16:(uint16_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeBitmap16(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeBitmap32:(ResponseHandler)completionHandler +{ + CHIPInt32uAttributeCallbackBridge * onSuccess = new CHIPInt32uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeBitmap32(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeBitmap32:(uint32_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeBitmap32(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeBitmap64:(ResponseHandler)completionHandler +{ + CHIPInt64uAttributeCallbackBridge * onSuccess = new CHIPInt64uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeBitmap64(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeBitmap64:(uint64_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeBitmap64(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeInt8u:(ResponseHandler)completionHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeInt8u(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeInt8u:(uint8_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeInt8u(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeInt16u:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeInt16u(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeInt16u:(uint16_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeInt16u(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeInt32u:(ResponseHandler)completionHandler +{ + CHIPInt32uAttributeCallbackBridge * onSuccess = new CHIPInt32uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeInt32u(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeInt32u:(uint32_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeInt32u(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeInt64u:(ResponseHandler)completionHandler +{ + CHIPInt64uAttributeCallbackBridge * onSuccess = new CHIPInt64uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeInt64u(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeInt64u:(uint64_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeInt64u(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeInt8s:(ResponseHandler)completionHandler +{ + CHIPInt8sAttributeCallbackBridge * onSuccess = new CHIPInt8sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeInt8s(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeInt8s:(int8_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeInt8s(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeInt16s:(ResponseHandler)completionHandler +{ + CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeInt16s(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeInt16s:(int16_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeInt16s(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeInt32s:(ResponseHandler)completionHandler +{ + CHIPInt32sAttributeCallbackBridge * onSuccess = new CHIPInt32sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeInt32s(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeInt32s:(int32_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeInt32s(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeInt64s:(ResponseHandler)completionHandler +{ + CHIPInt64sAttributeCallbackBridge * onSuccess = new CHIPInt64sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeInt64s(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeInt64s:(int64_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeInt64s(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeEnum8:(ResponseHandler)completionHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeEnum8(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeEnum8:(uint8_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeEnum8(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeEnum16:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeEnum16(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeEnum16:(uint16_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeEnum16(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeOctetString:(ResponseHandler)completionHandler +{ + CHIPStringAttributeCallbackBridge * onSuccess + = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], true); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeOctetString(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeOctetString:(NSData *)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeOctetString( + onSuccess->Cancel(), onFailure->Cancel(), chip::ByteSpan((const uint8_t *) value.bytes, value.length)); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeListInt8u:(ResponseHandler)completionHandler +{ + CHIPTestClusterListInt8uAttributeCallbackBridge * onSuccess + = new CHIPTestClusterListInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeListInt8u(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +@end + @interface CHIPThermostat () @property (readonly) Controller::ThermostatCluster cppCluster; @end diff --git a/examples/chip-tool/gen/IMClusterCommandHandler.cpp b/examples/chip-tool/gen/IMClusterCommandHandler.cpp index 1d6fcffd5c1921..d520e72d3b2a88 100644 --- a/examples/chip-tool/gen/IMClusterCommandHandler.cpp +++ b/examples/chip-tool/gen/IMClusterCommandHandler.cpp @@ -5744,6 +5744,93 @@ void DispatchClientCommand(app::Command * apCommandObj, CommandId aCommandId, En } // namespace TargetNavigator +namespace TestCluster { + +void DispatchClientCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) +{ + { + switch (aCommandId) + { + case ZCL_TEST_SPECIFIC_RESPONSE_COMMAND_ID: { + // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV + // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. + // Any error value TLVUnpackError means we have received an illegal value. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t returnValue; + bool returnValueExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(aDataTlv.GetTag())) + { + case 0: + if (returnValueExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(returnValue); + if (CHIP_NO_ERROR == TLVUnpackError) + { + returnValueExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(aDataTlv.GetTag()), TLVUnpackError); + break; + } + } + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfTestClusterClusterTestSpecificResponseCallback(apCommandObj, returnValue); + } + else + { + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kBadRequest, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogProgress( + Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, + 1, validArgumentCount, TLVError, TLVUnpackError); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_TEST_CLUSTER_ID); + break; + } + } + } +} + +} // namespace TestCluster + namespace Thermostat { void DispatchClientCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) diff --git a/examples/chip-tool/gen/attribute-id.h b/examples/chip-tool/gen/attribute-id.h index 8e7aa393464caf..e4691450f06d9c 100644 --- a/examples/chip-tool/gen/attribute-id.h +++ b/examples/chip-tool/gen/attribute-id.h @@ -1240,6 +1240,29 @@ // Server attributes +// Attribute ids for cluster: Test Cluster + +// Client attributes + +// Server attributes +#define ZCL_BOOLEAN_ATTRIBUTE_ID (0x0000) +#define ZCL_BITMAP8_ATTRIBUTE_ID (0x0001) +#define ZCL_BITMAP16_ATTRIBUTE_ID (0x0002) +#define ZCL_BITMAP32_ATTRIBUTE_ID (0x0003) +#define ZCL_BITMAP64_ATTRIBUTE_ID (0x0004) +#define ZCL_INT8_U_ATTRIBUTE_ID (0x0005) +#define ZCL_INT16_U_ATTRIBUTE_ID (0x0006) +#define ZCL_INT32_U_ATTRIBUTE_ID (0x0008) +#define ZCL_INT64_U_ATTRIBUTE_ID (0x000C) +#define ZCL_INT8_S_ATTRIBUTE_ID (0x000D) +#define ZCL_INT16_S_ATTRIBUTE_ID (0x000E) +#define ZCL_INT32_S_ATTRIBUTE_ID (0x0010) +#define ZCL_INT64_S_ATTRIBUTE_ID (0x0014) +#define ZCL_ENUM8_ATTRIBUTE_ID (0x0015) +#define ZCL_ENUM16_ATTRIBUTE_ID (0x0016) +#define ZCL_OCTET_STRING_ATTRIBUTE_ID (0x0019) +#define ZCL_LIST_ATTRIBUTE_ID (0x001A) + // Attribute ids for cluster: Generic Tunnel // Client attributes diff --git a/examples/chip-tool/gen/call-command-handler.cpp b/examples/chip-tool/gen/call-command-handler.cpp index 92e652ab2e04cf..ab8338acef7b77 100644 --- a/examples/chip-tool/gen/call-command-handler.cpp +++ b/examples/chip-tool/gen/call-command-handler.cpp @@ -57,6 +57,7 @@ EmberAfStatus emberAfSwitchClusterClientCommandParse(EmberAfClusterCommand * cmd EmberAfStatus emberAfTvChannelClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfTargetNavigatorClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfTemperatureMeasurementClusterClientCommandParse(EmberAfClusterCommand * cmd); +EmberAfStatus emberAfTestClusterClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfThermostatClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfWakeOnLanClusterClientCommandParse(EmberAfClusterCommand * cmd); @@ -191,6 +192,9 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd) // No commands are enabled for cluster Temperature Measurement result = status(false, true, cmd->mfgSpecific); break; + case ZCL_TEST_CLUSTER_ID: + result = emberAfTestClusterClusterClientCommandParse(cmd); + break; case ZCL_THERMOSTAT_CLUSTER_ID: result = emberAfThermostatClusterClientCommandParse(cmd); break; @@ -1766,6 +1770,35 @@ EmberAfStatus emberAfTargetNavigatorClusterClientCommandParse(EmberAfClusterComm } return status(wasHandled, true, cmd->mfgSpecific); } +EmberAfStatus emberAfTestClusterClusterClientCommandParse(EmberAfClusterCommand * cmd) +{ + bool wasHandled = false; + + if (!cmd->mfgSpecific) + { + switch (cmd->commandId) + { + case ZCL_TEST_SPECIFIC_RESPONSE_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t returnValue; + + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + returnValue = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfTestClusterClusterTestSpecificResponseCallback(nullptr, returnValue); + break; + } + default: { + // Unrecognized command ID, error status will apply. + break; + } + } + } + return status(wasHandled, true, cmd->mfgSpecific); +} EmberAfStatus emberAfThermostatClusterClientCommandParse(EmberAfClusterCommand * cmd) { bool wasHandled = false; diff --git a/examples/chip-tool/gen/callback-stub.cpp b/examples/chip-tool/gen/callback-stub.cpp index 3f1208e57cdb23..f37741eec41dcb 100644 --- a/examples/chip-tool/gen/callback-stub.cpp +++ b/examples/chip-tool/gen/callback-stub.cpp @@ -116,6 +116,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case ZCL_TEMP_MEASUREMENT_CLUSTER_ID: emberAfTemperatureMeasurementClusterInitCallback(endpoint); break; + case ZCL_TEST_CLUSTER_ID: + emberAfTestClusterClusterInitCallback(endpoint); + break; case ZCL_THERMOSTAT_CLUSTER_ID: emberAfThermostatClusterInitCallback(endpoint); break; @@ -273,6 +276,11 @@ void __attribute__((weak)) emberAfTemperatureMeasurementClusterInitCallback(Endp // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfTestClusterClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfThermostatClusterInitCallback(EndpointId endpoint) { // To prevent warning diff --git a/examples/chip-tool/gen/callback.h b/examples/chip-tool/gen/callback.h index d7cf625829ce43..68ef71ef130dcc 100644 --- a/examples/chip-tool/gen/callback.h +++ b/examples/chip-tool/gen/callback.h @@ -272,6 +272,14 @@ void emberAfTargetNavigatorClusterInitCallback(chip::EndpointId endpoint); */ void emberAfTemperatureMeasurementClusterInitCallback(chip::EndpointId endpoint); +/** @brief Test Cluster Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfTestClusterClusterInitCallback(chip::EndpointId endpoint); + /** @brief Thermostat Cluster Init * * Cluster Init @@ -2327,6 +2335,76 @@ EmberAfStatus emberAfTemperatureMeasurementClusterClientPreAttributeChangedCallb */ void emberAfTemperatureMeasurementClusterClientTickCallback(chip::EndpointId endpoint); +// +// Test Cluster Cluster client +// + +/** @brief Test Cluster Cluster Client Init + * + * Client Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfTestClusterClusterClientInitCallback(chip::EndpointId endpoint); + +/** @brief Test Cluster Cluster Client Attribute Changed + * + * Client Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + */ +void emberAfTestClusterClusterClientAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); + +/** @brief Test Cluster Cluster Client Manufacturer Specific Attribute Changed + * + * Client Manufacturer Specific Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + * @param manufacturerCode Manufacturer Code of the attribute that changed + */ +void emberAfTestClusterClusterClientManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + uint16_t manufacturerCode); + +/** @brief Test Cluster Cluster Client Message Sent + * + * Client Message Sent + * + * @param type The type of message sent + * @param indexOrDestination The destination or address to which the message was sent + * @param apsFrame The APS frame for the message + * @param msgLen The length of the message + * @param message The message that was sent + * @param status The status of the sent message + */ +void emberAfTestClusterClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, + EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, + EmberStatus status); + +/** @brief Test Cluster Cluster Client Pre Attribute Changed + * + * client Pre Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +EmberAfStatus emberAfTestClusterClusterClientPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, + EmberAfAttributeType attributeType, uint8_t size, + uint8_t * value); + +/** @brief Test Cluster Cluster Client Tick + * + * client Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfTestClusterClusterClientTickCallback(chip::EndpointId endpoint); + // // Thermostat Cluster client // @@ -3020,6 +3098,13 @@ bool emberAfTvChannelClusterChangeChannelResponseCallback(chip::app::Command * c bool emberAfTargetNavigatorClusterNavigateTargetResponseCallback(chip::app::Command * commandObj, uint8_t status, uint8_t * data); +/** + * @brief Test Cluster Cluster TestSpecificResponse Command callback + * @param returnValue + */ + +bool emberAfTestClusterClusterTestSpecificResponseCallback(chip::app::Command * commandObj, uint8_t returnValue); + /** * @brief Thermostat Cluster CurrentWeeklySchedule Command callback * @param numberOfTransitionsForSequence diff --git a/examples/chip-tool/gen/client-command-macro.h b/examples/chip-tool/gen/client-command-macro.h index 1cfc06d80ce7c2..c8666bc5678d12 100644 --- a/examples/chip-tool/gen/client-command-macro.h +++ b/examples/chip-tool/gen/client-command-macro.h @@ -3629,6 +3629,34 @@ \ ZCL_LOGIN_COMMAND_ID, "uu", tempAccountIdentifier, setupPIN); +/** @brief Command description for Test + * + * Command: Test + * @param returnValue INT8U + */ +#define emberAfFillCommandTest \ + ClusterClusterTest(returnValue) emberAfFillExternalBuffer(mask, \ + \ + ZCL_TEST_COMMAND_ID, "u", returnValue); + +/** @brief Command description for TestNotHandled + * + * Command: TestNotHandled + */ +#define emberAfFillCommandTest \ + ClusterClusterTestNotHandled() emberAfFillExternalBuffer(mask, \ + \ + ZCL_TEST_NOT_HANDLED_COMMAND_ID, "", ); + +/** @brief Command description for TestSpecific + * + * Command: TestSpecific + */ +#define emberAfFillCommandTest \ + ClusterClusterTestSpecific() emberAfFillExternalBuffer(mask, \ + \ + ZCL_TEST_SPECIFIC_COMMAND_ID, "", ); + /** @brief Command description for MatchProtocolAddress * * Command: MatchProtocolAddress diff --git a/examples/chip-tool/gen/cluster-id.h b/examples/chip-tool/gen/cluster-id.h index b8d9a9f7ed09bf..7f71ea5976846c 100644 --- a/examples/chip-tool/gen/cluster-id.h +++ b/examples/chip-tool/gen/cluster-id.h @@ -293,6 +293,9 @@ // Definitions for cluster: Account Login #define ZCL_ACCOUNT_LOGIN_CLUSTER_ID (0x050E) +// Definitions for cluster: Test Cluster +#define ZCL_TEST_CLUSTER_ID (0x050F) + // Definitions for cluster: Generic Tunnel #define ZCL_GENERIC_TUNNEL_CLUSTER_ID (0x0600) diff --git a/examples/chip-tool/gen/command-id.h b/examples/chip-tool/gen/command-id.h index 25ee08826f030c..8e97e911e0a423 100644 --- a/examples/chip-tool/gen/command-id.h +++ b/examples/chip-tool/gen/command-id.h @@ -470,6 +470,12 @@ #define ZCL_GET_SETUP_PIN_RESPONSE_COMMAND_ID (0x00) #define ZCL_LOGIN_COMMAND_ID (0x01) +// Commands for cluster: Test Cluster +#define ZCL_TEST_COMMAND_ID (0x00) +#define ZCL_TEST_SPECIFIC_RESPONSE_COMMAND_ID (0x00) +#define ZCL_TEST_NOT_HANDLED_COMMAND_ID (0x01) +#define ZCL_TEST_SPECIFIC_COMMAND_ID (0x02) + // Commands for cluster: Generic Tunnel #define ZCL_MATCH_PROTOCOL_ADDRESS_COMMAND_ID (0x00) #define ZCL_MATCH_PROTOCOL_ADDRESS_RESPONSE_COMMAND_ID (0x00) diff --git a/examples/chip-tool/gen/endpoint_config.h b/examples/chip-tool/gen/endpoint_config.h index 6f7149a6451d71..6599ceb17d6cc9 100644 --- a/examples/chip-tool/gen/endpoint_config.h +++ b/examples/chip-tool/gen/endpoint_config.h @@ -63,7 +63,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 31 +#define GENERATED_ATTRIBUTE_COUNT 32 #define GENERATED_ATTRIBUTES \ { \ \ @@ -153,6 +153,9 @@ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ /* Endpoint: 1, Cluster: Account Login (client) */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ + \ + /* Endpoint: 1, Cluster: Test Cluster (client) */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ /* Endpoint: 1, Cluster: Binding (client) */ \ @@ -169,7 +172,7 @@ #define GENERATED_FUNCTION_ARRAYS #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask -#define GENERATED_CLUSTER_COUNT 31 +#define GENERATED_CLUSTER_COUNT 32 #define GENERATED_CLUSTERS \ { \ { 0x0003, ZAP_ATTRIBUTE_INDEX(0), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Identify (client) */ \ @@ -248,10 +251,13 @@ 0x050E, ZAP_ATTRIBUTE_INDEX(28), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Account Login (client) */ \ { \ - 0xF000, ZAP_ATTRIBUTE_INDEX(29), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x050F, ZAP_ATTRIBUTE_INDEX(29), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + }, /* Endpoint: 1, Cluster: Test Cluster (client) */ \ + { \ + 0xF000, ZAP_ATTRIBUTE_INDEX(30), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Binding (client) */ \ { \ - 0xF004, ZAP_ATTRIBUTE_INDEX(30), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0xF004, ZAP_ATTRIBUTE_INDEX(31), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Group Key Management (client) */ \ } @@ -260,7 +266,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 31, 62 }, \ + { ZAP_CLUSTER_INDEX(0), 32, 64 }, \ } // Largest attribute size is needed for various buffers @@ -270,7 +276,7 @@ #define ATTRIBUTE_SINGLETONS_SIZE (2) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (62) +#define ATTRIBUTE_MAX_SIZE (64) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (1) @@ -314,7 +320,7 @@ // Array of EmberAfCommandMetadata structs. #define ZAP_COMMAND_MASK(mask) COMMAND_MASK_##mask -#define EMBER_AF_GENERATED_COMMAND_COUNT (187) +#define EMBER_AF_GENERATED_COMMAND_COUNT (191) #define GENERATED_COMMANDS \ { \ \ @@ -560,6 +566,12 @@ { 0x050E, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* GetSetupPINResponse */ \ { 0x050E, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Login */ \ \ + /* Endpoint: 1, Cluster: Test Cluster (client) */ \ + { 0x050F, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Test */ \ + { 0x050F, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* TestSpecificResponse */ \ + { 0x050F, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* TestNotHandled */ \ + { 0x050F, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* TestSpecific */ \ + \ /* Endpoint: 1, Cluster: Binding (client) */ \ { 0xF000, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Bind */ \ { 0xF000, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Unbind */ \ diff --git a/examples/chip-tool/gen/gen_config.h b/examples/chip-tool/gen/gen_config.h index 8c614ed0219acd..a7e91667586ee9 100644 --- a/examples/chip-tool/gen/gen_config.h +++ b/examples/chip-tool/gen/gen_config.h @@ -58,6 +58,7 @@ #define EMBER_AF_TV_CHANNEL_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_TARGET_NAVIGATOR_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_TEMP_MEASUREMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_TEST_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_THERMOSTAT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_WAKE_ON_LAN_CLUSTER_CLIENT_ENDPOINT_COUNT (1) @@ -179,6 +180,10 @@ #define ZCL_USING_TEMP_MEASUREMENT_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_TEMPERATURE_MEASUREMENT_CLIENT +// Use this macro to check if the client side of the Test Cluster cluster is included +#define ZCL_USING_TEST_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_TEST_CLUSTER_CLIENT + // Use this macro to check if the client side of the Thermostat cluster is included #define ZCL_USING_THERMOSTAT_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_THERMOSTAT_CLIENT diff --git a/examples/chip-tool/gen/print-cluster.h b/examples/chip-tool/gen/print-cluster.h index 9c879d94a9390d..886dad371554b7 100644 --- a/examples/chip-tool/gen/print-cluster.h +++ b/examples/chip-tool/gen/print-cluster.h @@ -634,6 +634,12 @@ #define CHIP_PRINTCLUSTER_ACCOUNT_LOGIN_CLUSTER #endif +#if defined(ZCL_USING_TEST_CLUSTER_SERVER) || defined(ZCL_USING_TEST_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_TEST_CLUSTER { ZCL_TEST_CLUSTER_ID, 1295, "Test Cluster" }, +#else +#define CHIP_PRINTCLUSTER_TEST_CLUSTER +#endif + #if defined(ZCL_USING_GENERIC_TUNNEL_CLUSTER_SERVER) || defined(ZCL_USING_GENERIC_TUNNEL_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_GENERIC_TUNNEL_CLUSTER { ZCL_GENERIC_TUNNEL_CLUSTER_ID, 1536, "Generic Tunnel" }, #else @@ -965,6 +971,7 @@ CHIP_PRINTCLUSTER_APPLICATION_LAUNCHER_CLUSTER \ CHIP_PRINTCLUSTER_APPLICATION_BASIC_CLUSTER \ CHIP_PRINTCLUSTER_ACCOUNT_LOGIN_CLUSTER \ + CHIP_PRINTCLUSTER_TEST_CLUSTER \ CHIP_PRINTCLUSTER_GENERIC_TUNNEL_CLUSTER \ CHIP_PRINTCLUSTER_BACNET_PROTOCOL_TUNNEL_CLUSTER \ CHIP_PRINTCLUSTER_11073_PROTOCOL_TUNNEL_CLUSTER \ diff --git a/examples/chip-tool/templates/commands.zapt b/examples/chip-tool/templates/commands.zapt index 065349a30fe0a5..c053e55a804992 100644 --- a/examples/chip-tool/templates/commands.zapt +++ b/examples/chip-tool/templates/commands.zapt @@ -65,6 +65,14 @@ static void OnInt64uAttributeResponse(void * context, uint64_t value) command->SetCommandExitStatus(true); } +static void OnInt8sAttributeResponse(void * context, int8_t value) +{ + ChipLogProgress(chipTool, "Int8s attribute Response: %" PRId8, value); + + ModelCommand * command = reinterpret_cast(context); + command->SetCommandExitStatus(true); +} + static void OnInt16sAttributeResponse(void * context, int16_t value) { ChipLogProgress(chipTool, "Int16s attribute Response: %" PRId16, value); @@ -73,6 +81,22 @@ static void OnInt16sAttributeResponse(void * context, int16_t value) command->SetCommandExitStatus(true); } +static void OnInt32sAttributeResponse(void * context, int32_t value) +{ + ChipLogProgress(chipTool, "Int32s attribute Response: %" PRId32, value); + + ModelCommand * command = reinterpret_cast(context); + command->SetCommandExitStatus(true); +} + +static void OnInt64sAttributeResponse(void * context, int64_t value) +{ + ChipLogProgress(chipTool, "Int64s attribute Response: %" PRId64, value); + + ModelCommand * command = reinterpret_cast(context); + command->SetCommandExitStatus(true); +} + static void OnStringAttributeResponse(void * context, const chip::ByteSpan value) { char * str = (char *)malloc(value.size() * sizeof(char)); diff --git a/examples/lighting-app/lighting-common/gen/attribute-id.h b/examples/lighting-app/lighting-common/gen/attribute-id.h index 8e7aa393464caf..e4691450f06d9c 100644 --- a/examples/lighting-app/lighting-common/gen/attribute-id.h +++ b/examples/lighting-app/lighting-common/gen/attribute-id.h @@ -1240,6 +1240,29 @@ // Server attributes +// Attribute ids for cluster: Test Cluster + +// Client attributes + +// Server attributes +#define ZCL_BOOLEAN_ATTRIBUTE_ID (0x0000) +#define ZCL_BITMAP8_ATTRIBUTE_ID (0x0001) +#define ZCL_BITMAP16_ATTRIBUTE_ID (0x0002) +#define ZCL_BITMAP32_ATTRIBUTE_ID (0x0003) +#define ZCL_BITMAP64_ATTRIBUTE_ID (0x0004) +#define ZCL_INT8_U_ATTRIBUTE_ID (0x0005) +#define ZCL_INT16_U_ATTRIBUTE_ID (0x0006) +#define ZCL_INT32_U_ATTRIBUTE_ID (0x0008) +#define ZCL_INT64_U_ATTRIBUTE_ID (0x000C) +#define ZCL_INT8_S_ATTRIBUTE_ID (0x000D) +#define ZCL_INT16_S_ATTRIBUTE_ID (0x000E) +#define ZCL_INT32_S_ATTRIBUTE_ID (0x0010) +#define ZCL_INT64_S_ATTRIBUTE_ID (0x0014) +#define ZCL_ENUM8_ATTRIBUTE_ID (0x0015) +#define ZCL_ENUM16_ATTRIBUTE_ID (0x0016) +#define ZCL_OCTET_STRING_ATTRIBUTE_ID (0x0019) +#define ZCL_LIST_ATTRIBUTE_ID (0x001A) + // Attribute ids for cluster: Generic Tunnel // Client attributes diff --git a/examples/lighting-app/lighting-common/gen/client-command-macro.h b/examples/lighting-app/lighting-common/gen/client-command-macro.h index 1cfc06d80ce7c2..c8666bc5678d12 100644 --- a/examples/lighting-app/lighting-common/gen/client-command-macro.h +++ b/examples/lighting-app/lighting-common/gen/client-command-macro.h @@ -3629,6 +3629,34 @@ \ ZCL_LOGIN_COMMAND_ID, "uu", tempAccountIdentifier, setupPIN); +/** @brief Command description for Test + * + * Command: Test + * @param returnValue INT8U + */ +#define emberAfFillCommandTest \ + ClusterClusterTest(returnValue) emberAfFillExternalBuffer(mask, \ + \ + ZCL_TEST_COMMAND_ID, "u", returnValue); + +/** @brief Command description for TestNotHandled + * + * Command: TestNotHandled + */ +#define emberAfFillCommandTest \ + ClusterClusterTestNotHandled() emberAfFillExternalBuffer(mask, \ + \ + ZCL_TEST_NOT_HANDLED_COMMAND_ID, "", ); + +/** @brief Command description for TestSpecific + * + * Command: TestSpecific + */ +#define emberAfFillCommandTest \ + ClusterClusterTestSpecific() emberAfFillExternalBuffer(mask, \ + \ + ZCL_TEST_SPECIFIC_COMMAND_ID, "", ); + /** @brief Command description for MatchProtocolAddress * * Command: MatchProtocolAddress diff --git a/examples/lighting-app/lighting-common/gen/cluster-id.h b/examples/lighting-app/lighting-common/gen/cluster-id.h index b8d9a9f7ed09bf..7f71ea5976846c 100644 --- a/examples/lighting-app/lighting-common/gen/cluster-id.h +++ b/examples/lighting-app/lighting-common/gen/cluster-id.h @@ -293,6 +293,9 @@ // Definitions for cluster: Account Login #define ZCL_ACCOUNT_LOGIN_CLUSTER_ID (0x050E) +// Definitions for cluster: Test Cluster +#define ZCL_TEST_CLUSTER_ID (0x050F) + // Definitions for cluster: Generic Tunnel #define ZCL_GENERIC_TUNNEL_CLUSTER_ID (0x0600) diff --git a/examples/lighting-app/lighting-common/gen/command-id.h b/examples/lighting-app/lighting-common/gen/command-id.h index 25ee08826f030c..8e97e911e0a423 100644 --- a/examples/lighting-app/lighting-common/gen/command-id.h +++ b/examples/lighting-app/lighting-common/gen/command-id.h @@ -470,6 +470,12 @@ #define ZCL_GET_SETUP_PIN_RESPONSE_COMMAND_ID (0x00) #define ZCL_LOGIN_COMMAND_ID (0x01) +// Commands for cluster: Test Cluster +#define ZCL_TEST_COMMAND_ID (0x00) +#define ZCL_TEST_SPECIFIC_RESPONSE_COMMAND_ID (0x00) +#define ZCL_TEST_NOT_HANDLED_COMMAND_ID (0x01) +#define ZCL_TEST_SPECIFIC_COMMAND_ID (0x02) + // Commands for cluster: Generic Tunnel #define ZCL_MATCH_PROTOCOL_ADDRESS_COMMAND_ID (0x00) #define ZCL_MATCH_PROTOCOL_ADDRESS_RESPONSE_COMMAND_ID (0x00) diff --git a/examples/lighting-app/lighting-common/gen/print-cluster.h b/examples/lighting-app/lighting-common/gen/print-cluster.h index 9c879d94a9390d..886dad371554b7 100644 --- a/examples/lighting-app/lighting-common/gen/print-cluster.h +++ b/examples/lighting-app/lighting-common/gen/print-cluster.h @@ -634,6 +634,12 @@ #define CHIP_PRINTCLUSTER_ACCOUNT_LOGIN_CLUSTER #endif +#if defined(ZCL_USING_TEST_CLUSTER_SERVER) || defined(ZCL_USING_TEST_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_TEST_CLUSTER { ZCL_TEST_CLUSTER_ID, 1295, "Test Cluster" }, +#else +#define CHIP_PRINTCLUSTER_TEST_CLUSTER +#endif + #if defined(ZCL_USING_GENERIC_TUNNEL_CLUSTER_SERVER) || defined(ZCL_USING_GENERIC_TUNNEL_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_GENERIC_TUNNEL_CLUSTER { ZCL_GENERIC_TUNNEL_CLUSTER_ID, 1536, "Generic Tunnel" }, #else @@ -965,6 +971,7 @@ CHIP_PRINTCLUSTER_APPLICATION_LAUNCHER_CLUSTER \ CHIP_PRINTCLUSTER_APPLICATION_BASIC_CLUSTER \ CHIP_PRINTCLUSTER_ACCOUNT_LOGIN_CLUSTER \ + CHIP_PRINTCLUSTER_TEST_CLUSTER \ CHIP_PRINTCLUSTER_GENERIC_TUNNEL_CLUSTER \ CHIP_PRINTCLUSTER_BACNET_PROTOCOL_TUNNEL_CLUSTER \ CHIP_PRINTCLUSTER_11073_PROTOCOL_TUNNEL_CLUSTER \ diff --git a/examples/lock-app/lock-common/gen/attribute-id.h b/examples/lock-app/lock-common/gen/attribute-id.h index 8e7aa393464caf..e4691450f06d9c 100644 --- a/examples/lock-app/lock-common/gen/attribute-id.h +++ b/examples/lock-app/lock-common/gen/attribute-id.h @@ -1240,6 +1240,29 @@ // Server attributes +// Attribute ids for cluster: Test Cluster + +// Client attributes + +// Server attributes +#define ZCL_BOOLEAN_ATTRIBUTE_ID (0x0000) +#define ZCL_BITMAP8_ATTRIBUTE_ID (0x0001) +#define ZCL_BITMAP16_ATTRIBUTE_ID (0x0002) +#define ZCL_BITMAP32_ATTRIBUTE_ID (0x0003) +#define ZCL_BITMAP64_ATTRIBUTE_ID (0x0004) +#define ZCL_INT8_U_ATTRIBUTE_ID (0x0005) +#define ZCL_INT16_U_ATTRIBUTE_ID (0x0006) +#define ZCL_INT32_U_ATTRIBUTE_ID (0x0008) +#define ZCL_INT64_U_ATTRIBUTE_ID (0x000C) +#define ZCL_INT8_S_ATTRIBUTE_ID (0x000D) +#define ZCL_INT16_S_ATTRIBUTE_ID (0x000E) +#define ZCL_INT32_S_ATTRIBUTE_ID (0x0010) +#define ZCL_INT64_S_ATTRIBUTE_ID (0x0014) +#define ZCL_ENUM8_ATTRIBUTE_ID (0x0015) +#define ZCL_ENUM16_ATTRIBUTE_ID (0x0016) +#define ZCL_OCTET_STRING_ATTRIBUTE_ID (0x0019) +#define ZCL_LIST_ATTRIBUTE_ID (0x001A) + // Attribute ids for cluster: Generic Tunnel // Client attributes diff --git a/examples/lock-app/lock-common/gen/client-command-macro.h b/examples/lock-app/lock-common/gen/client-command-macro.h index 1cfc06d80ce7c2..c8666bc5678d12 100644 --- a/examples/lock-app/lock-common/gen/client-command-macro.h +++ b/examples/lock-app/lock-common/gen/client-command-macro.h @@ -3629,6 +3629,34 @@ \ ZCL_LOGIN_COMMAND_ID, "uu", tempAccountIdentifier, setupPIN); +/** @brief Command description for Test + * + * Command: Test + * @param returnValue INT8U + */ +#define emberAfFillCommandTest \ + ClusterClusterTest(returnValue) emberAfFillExternalBuffer(mask, \ + \ + ZCL_TEST_COMMAND_ID, "u", returnValue); + +/** @brief Command description for TestNotHandled + * + * Command: TestNotHandled + */ +#define emberAfFillCommandTest \ + ClusterClusterTestNotHandled() emberAfFillExternalBuffer(mask, \ + \ + ZCL_TEST_NOT_HANDLED_COMMAND_ID, "", ); + +/** @brief Command description for TestSpecific + * + * Command: TestSpecific + */ +#define emberAfFillCommandTest \ + ClusterClusterTestSpecific() emberAfFillExternalBuffer(mask, \ + \ + ZCL_TEST_SPECIFIC_COMMAND_ID, "", ); + /** @brief Command description for MatchProtocolAddress * * Command: MatchProtocolAddress diff --git a/examples/lock-app/lock-common/gen/cluster-id.h b/examples/lock-app/lock-common/gen/cluster-id.h index b8d9a9f7ed09bf..7f71ea5976846c 100644 --- a/examples/lock-app/lock-common/gen/cluster-id.h +++ b/examples/lock-app/lock-common/gen/cluster-id.h @@ -293,6 +293,9 @@ // Definitions for cluster: Account Login #define ZCL_ACCOUNT_LOGIN_CLUSTER_ID (0x050E) +// Definitions for cluster: Test Cluster +#define ZCL_TEST_CLUSTER_ID (0x050F) + // Definitions for cluster: Generic Tunnel #define ZCL_GENERIC_TUNNEL_CLUSTER_ID (0x0600) diff --git a/examples/lock-app/lock-common/gen/command-id.h b/examples/lock-app/lock-common/gen/command-id.h index 25ee08826f030c..8e97e911e0a423 100644 --- a/examples/lock-app/lock-common/gen/command-id.h +++ b/examples/lock-app/lock-common/gen/command-id.h @@ -470,6 +470,12 @@ #define ZCL_GET_SETUP_PIN_RESPONSE_COMMAND_ID (0x00) #define ZCL_LOGIN_COMMAND_ID (0x01) +// Commands for cluster: Test Cluster +#define ZCL_TEST_COMMAND_ID (0x00) +#define ZCL_TEST_SPECIFIC_RESPONSE_COMMAND_ID (0x00) +#define ZCL_TEST_NOT_HANDLED_COMMAND_ID (0x01) +#define ZCL_TEST_SPECIFIC_COMMAND_ID (0x02) + // Commands for cluster: Generic Tunnel #define ZCL_MATCH_PROTOCOL_ADDRESS_COMMAND_ID (0x00) #define ZCL_MATCH_PROTOCOL_ADDRESS_RESPONSE_COMMAND_ID (0x00) diff --git a/examples/lock-app/lock-common/gen/print-cluster.h b/examples/lock-app/lock-common/gen/print-cluster.h index 9c879d94a9390d..886dad371554b7 100644 --- a/examples/lock-app/lock-common/gen/print-cluster.h +++ b/examples/lock-app/lock-common/gen/print-cluster.h @@ -634,6 +634,12 @@ #define CHIP_PRINTCLUSTER_ACCOUNT_LOGIN_CLUSTER #endif +#if defined(ZCL_USING_TEST_CLUSTER_SERVER) || defined(ZCL_USING_TEST_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_TEST_CLUSTER { ZCL_TEST_CLUSTER_ID, 1295, "Test Cluster" }, +#else +#define CHIP_PRINTCLUSTER_TEST_CLUSTER +#endif + #if defined(ZCL_USING_GENERIC_TUNNEL_CLUSTER_SERVER) || defined(ZCL_USING_GENERIC_TUNNEL_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_GENERIC_TUNNEL_CLUSTER { ZCL_GENERIC_TUNNEL_CLUSTER_ID, 1536, "Generic Tunnel" }, #else @@ -965,6 +971,7 @@ CHIP_PRINTCLUSTER_APPLICATION_LAUNCHER_CLUSTER \ CHIP_PRINTCLUSTER_APPLICATION_BASIC_CLUSTER \ CHIP_PRINTCLUSTER_ACCOUNT_LOGIN_CLUSTER \ + CHIP_PRINTCLUSTER_TEST_CLUSTER \ CHIP_PRINTCLUSTER_GENERIC_TUNNEL_CLUSTER \ CHIP_PRINTCLUSTER_BACNET_PROTOCOL_TUNNEL_CLUSTER \ CHIP_PRINTCLUSTER_11073_PROTOCOL_TUNNEL_CLUSTER \ diff --git a/examples/temperature-measurement-app/esp32/main/gen/attribute-id.h b/examples/temperature-measurement-app/esp32/main/gen/attribute-id.h index 8e7aa393464caf..e4691450f06d9c 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/attribute-id.h +++ b/examples/temperature-measurement-app/esp32/main/gen/attribute-id.h @@ -1240,6 +1240,29 @@ // Server attributes +// Attribute ids for cluster: Test Cluster + +// Client attributes + +// Server attributes +#define ZCL_BOOLEAN_ATTRIBUTE_ID (0x0000) +#define ZCL_BITMAP8_ATTRIBUTE_ID (0x0001) +#define ZCL_BITMAP16_ATTRIBUTE_ID (0x0002) +#define ZCL_BITMAP32_ATTRIBUTE_ID (0x0003) +#define ZCL_BITMAP64_ATTRIBUTE_ID (0x0004) +#define ZCL_INT8_U_ATTRIBUTE_ID (0x0005) +#define ZCL_INT16_U_ATTRIBUTE_ID (0x0006) +#define ZCL_INT32_U_ATTRIBUTE_ID (0x0008) +#define ZCL_INT64_U_ATTRIBUTE_ID (0x000C) +#define ZCL_INT8_S_ATTRIBUTE_ID (0x000D) +#define ZCL_INT16_S_ATTRIBUTE_ID (0x000E) +#define ZCL_INT32_S_ATTRIBUTE_ID (0x0010) +#define ZCL_INT64_S_ATTRIBUTE_ID (0x0014) +#define ZCL_ENUM8_ATTRIBUTE_ID (0x0015) +#define ZCL_ENUM16_ATTRIBUTE_ID (0x0016) +#define ZCL_OCTET_STRING_ATTRIBUTE_ID (0x0019) +#define ZCL_LIST_ATTRIBUTE_ID (0x001A) + // Attribute ids for cluster: Generic Tunnel // Client attributes diff --git a/examples/temperature-measurement-app/esp32/main/gen/client-command-macro.h b/examples/temperature-measurement-app/esp32/main/gen/client-command-macro.h index 1cfc06d80ce7c2..c8666bc5678d12 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/client-command-macro.h +++ b/examples/temperature-measurement-app/esp32/main/gen/client-command-macro.h @@ -3629,6 +3629,34 @@ \ ZCL_LOGIN_COMMAND_ID, "uu", tempAccountIdentifier, setupPIN); +/** @brief Command description for Test + * + * Command: Test + * @param returnValue INT8U + */ +#define emberAfFillCommandTest \ + ClusterClusterTest(returnValue) emberAfFillExternalBuffer(mask, \ + \ + ZCL_TEST_COMMAND_ID, "u", returnValue); + +/** @brief Command description for TestNotHandled + * + * Command: TestNotHandled + */ +#define emberAfFillCommandTest \ + ClusterClusterTestNotHandled() emberAfFillExternalBuffer(mask, \ + \ + ZCL_TEST_NOT_HANDLED_COMMAND_ID, "", ); + +/** @brief Command description for TestSpecific + * + * Command: TestSpecific + */ +#define emberAfFillCommandTest \ + ClusterClusterTestSpecific() emberAfFillExternalBuffer(mask, \ + \ + ZCL_TEST_SPECIFIC_COMMAND_ID, "", ); + /** @brief Command description for MatchProtocolAddress * * Command: MatchProtocolAddress diff --git a/examples/temperature-measurement-app/esp32/main/gen/cluster-id.h b/examples/temperature-measurement-app/esp32/main/gen/cluster-id.h index b8d9a9f7ed09bf..7f71ea5976846c 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/cluster-id.h +++ b/examples/temperature-measurement-app/esp32/main/gen/cluster-id.h @@ -293,6 +293,9 @@ // Definitions for cluster: Account Login #define ZCL_ACCOUNT_LOGIN_CLUSTER_ID (0x050E) +// Definitions for cluster: Test Cluster +#define ZCL_TEST_CLUSTER_ID (0x050F) + // Definitions for cluster: Generic Tunnel #define ZCL_GENERIC_TUNNEL_CLUSTER_ID (0x0600) diff --git a/examples/temperature-measurement-app/esp32/main/gen/command-id.h b/examples/temperature-measurement-app/esp32/main/gen/command-id.h index 25ee08826f030c..8e97e911e0a423 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/command-id.h +++ b/examples/temperature-measurement-app/esp32/main/gen/command-id.h @@ -470,6 +470,12 @@ #define ZCL_GET_SETUP_PIN_RESPONSE_COMMAND_ID (0x00) #define ZCL_LOGIN_COMMAND_ID (0x01) +// Commands for cluster: Test Cluster +#define ZCL_TEST_COMMAND_ID (0x00) +#define ZCL_TEST_SPECIFIC_RESPONSE_COMMAND_ID (0x00) +#define ZCL_TEST_NOT_HANDLED_COMMAND_ID (0x01) +#define ZCL_TEST_SPECIFIC_COMMAND_ID (0x02) + // Commands for cluster: Generic Tunnel #define ZCL_MATCH_PROTOCOL_ADDRESS_COMMAND_ID (0x00) #define ZCL_MATCH_PROTOCOL_ADDRESS_RESPONSE_COMMAND_ID (0x00) diff --git a/examples/temperature-measurement-app/esp32/main/gen/print-cluster.h b/examples/temperature-measurement-app/esp32/main/gen/print-cluster.h index 9c879d94a9390d..886dad371554b7 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/print-cluster.h +++ b/examples/temperature-measurement-app/esp32/main/gen/print-cluster.h @@ -634,6 +634,12 @@ #define CHIP_PRINTCLUSTER_ACCOUNT_LOGIN_CLUSTER #endif +#if defined(ZCL_USING_TEST_CLUSTER_SERVER) || defined(ZCL_USING_TEST_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_TEST_CLUSTER { ZCL_TEST_CLUSTER_ID, 1295, "Test Cluster" }, +#else +#define CHIP_PRINTCLUSTER_TEST_CLUSTER +#endif + #if defined(ZCL_USING_GENERIC_TUNNEL_CLUSTER_SERVER) || defined(ZCL_USING_GENERIC_TUNNEL_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_GENERIC_TUNNEL_CLUSTER { ZCL_GENERIC_TUNNEL_CLUSTER_ID, 1536, "Generic Tunnel" }, #else @@ -965,6 +971,7 @@ CHIP_PRINTCLUSTER_APPLICATION_LAUNCHER_CLUSTER \ CHIP_PRINTCLUSTER_APPLICATION_BASIC_CLUSTER \ CHIP_PRINTCLUSTER_ACCOUNT_LOGIN_CLUSTER \ + CHIP_PRINTCLUSTER_TEST_CLUSTER \ CHIP_PRINTCLUSTER_GENERIC_TUNNEL_CLUSTER \ CHIP_PRINTCLUSTER_BACNET_PROTOCOL_TUNNEL_CLUSTER \ CHIP_PRINTCLUSTER_11073_PROTOCOL_TUNNEL_CLUSTER \ diff --git a/examples/tv-app/tv-common/gen/attribute-id.h b/examples/tv-app/tv-common/gen/attribute-id.h index 8e7aa393464caf..e4691450f06d9c 100644 --- a/examples/tv-app/tv-common/gen/attribute-id.h +++ b/examples/tv-app/tv-common/gen/attribute-id.h @@ -1240,6 +1240,29 @@ // Server attributes +// Attribute ids for cluster: Test Cluster + +// Client attributes + +// Server attributes +#define ZCL_BOOLEAN_ATTRIBUTE_ID (0x0000) +#define ZCL_BITMAP8_ATTRIBUTE_ID (0x0001) +#define ZCL_BITMAP16_ATTRIBUTE_ID (0x0002) +#define ZCL_BITMAP32_ATTRIBUTE_ID (0x0003) +#define ZCL_BITMAP64_ATTRIBUTE_ID (0x0004) +#define ZCL_INT8_U_ATTRIBUTE_ID (0x0005) +#define ZCL_INT16_U_ATTRIBUTE_ID (0x0006) +#define ZCL_INT32_U_ATTRIBUTE_ID (0x0008) +#define ZCL_INT64_U_ATTRIBUTE_ID (0x000C) +#define ZCL_INT8_S_ATTRIBUTE_ID (0x000D) +#define ZCL_INT16_S_ATTRIBUTE_ID (0x000E) +#define ZCL_INT32_S_ATTRIBUTE_ID (0x0010) +#define ZCL_INT64_S_ATTRIBUTE_ID (0x0014) +#define ZCL_ENUM8_ATTRIBUTE_ID (0x0015) +#define ZCL_ENUM16_ATTRIBUTE_ID (0x0016) +#define ZCL_OCTET_STRING_ATTRIBUTE_ID (0x0019) +#define ZCL_LIST_ATTRIBUTE_ID (0x001A) + // Attribute ids for cluster: Generic Tunnel // Client attributes diff --git a/examples/tv-app/tv-common/gen/client-command-macro.h b/examples/tv-app/tv-common/gen/client-command-macro.h index 1cfc06d80ce7c2..c8666bc5678d12 100644 --- a/examples/tv-app/tv-common/gen/client-command-macro.h +++ b/examples/tv-app/tv-common/gen/client-command-macro.h @@ -3629,6 +3629,34 @@ \ ZCL_LOGIN_COMMAND_ID, "uu", tempAccountIdentifier, setupPIN); +/** @brief Command description for Test + * + * Command: Test + * @param returnValue INT8U + */ +#define emberAfFillCommandTest \ + ClusterClusterTest(returnValue) emberAfFillExternalBuffer(mask, \ + \ + ZCL_TEST_COMMAND_ID, "u", returnValue); + +/** @brief Command description for TestNotHandled + * + * Command: TestNotHandled + */ +#define emberAfFillCommandTest \ + ClusterClusterTestNotHandled() emberAfFillExternalBuffer(mask, \ + \ + ZCL_TEST_NOT_HANDLED_COMMAND_ID, "", ); + +/** @brief Command description for TestSpecific + * + * Command: TestSpecific + */ +#define emberAfFillCommandTest \ + ClusterClusterTestSpecific() emberAfFillExternalBuffer(mask, \ + \ + ZCL_TEST_SPECIFIC_COMMAND_ID, "", ); + /** @brief Command description for MatchProtocolAddress * * Command: MatchProtocolAddress diff --git a/examples/tv-app/tv-common/gen/cluster-id.h b/examples/tv-app/tv-common/gen/cluster-id.h index b8d9a9f7ed09bf..7f71ea5976846c 100644 --- a/examples/tv-app/tv-common/gen/cluster-id.h +++ b/examples/tv-app/tv-common/gen/cluster-id.h @@ -293,6 +293,9 @@ // Definitions for cluster: Account Login #define ZCL_ACCOUNT_LOGIN_CLUSTER_ID (0x050E) +// Definitions for cluster: Test Cluster +#define ZCL_TEST_CLUSTER_ID (0x050F) + // Definitions for cluster: Generic Tunnel #define ZCL_GENERIC_TUNNEL_CLUSTER_ID (0x0600) diff --git a/examples/tv-app/tv-common/gen/command-id.h b/examples/tv-app/tv-common/gen/command-id.h index 25ee08826f030c..8e97e911e0a423 100644 --- a/examples/tv-app/tv-common/gen/command-id.h +++ b/examples/tv-app/tv-common/gen/command-id.h @@ -470,6 +470,12 @@ #define ZCL_GET_SETUP_PIN_RESPONSE_COMMAND_ID (0x00) #define ZCL_LOGIN_COMMAND_ID (0x01) +// Commands for cluster: Test Cluster +#define ZCL_TEST_COMMAND_ID (0x00) +#define ZCL_TEST_SPECIFIC_RESPONSE_COMMAND_ID (0x00) +#define ZCL_TEST_NOT_HANDLED_COMMAND_ID (0x01) +#define ZCL_TEST_SPECIFIC_COMMAND_ID (0x02) + // Commands for cluster: Generic Tunnel #define ZCL_MATCH_PROTOCOL_ADDRESS_COMMAND_ID (0x00) #define ZCL_MATCH_PROTOCOL_ADDRESS_RESPONSE_COMMAND_ID (0x00) diff --git a/examples/tv-app/tv-common/gen/print-cluster.h b/examples/tv-app/tv-common/gen/print-cluster.h index 9c879d94a9390d..886dad371554b7 100644 --- a/examples/tv-app/tv-common/gen/print-cluster.h +++ b/examples/tv-app/tv-common/gen/print-cluster.h @@ -634,6 +634,12 @@ #define CHIP_PRINTCLUSTER_ACCOUNT_LOGIN_CLUSTER #endif +#if defined(ZCL_USING_TEST_CLUSTER_SERVER) || defined(ZCL_USING_TEST_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_TEST_CLUSTER { ZCL_TEST_CLUSTER_ID, 1295, "Test Cluster" }, +#else +#define CHIP_PRINTCLUSTER_TEST_CLUSTER +#endif + #if defined(ZCL_USING_GENERIC_TUNNEL_CLUSTER_SERVER) || defined(ZCL_USING_GENERIC_TUNNEL_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_GENERIC_TUNNEL_CLUSTER { ZCL_GENERIC_TUNNEL_CLUSTER_ID, 1536, "Generic Tunnel" }, #else @@ -965,6 +971,7 @@ CHIP_PRINTCLUSTER_APPLICATION_LAUNCHER_CLUSTER \ CHIP_PRINTCLUSTER_APPLICATION_BASIC_CLUSTER \ CHIP_PRINTCLUSTER_ACCOUNT_LOGIN_CLUSTER \ + CHIP_PRINTCLUSTER_TEST_CLUSTER \ CHIP_PRINTCLUSTER_GENERIC_TUNNEL_CLUSTER \ CHIP_PRINTCLUSTER_BACNET_PROTOCOL_TUNNEL_CLUSTER \ CHIP_PRINTCLUSTER_11073_PROTOCOL_TUNNEL_CLUSTER \ diff --git a/examples/window-app/common/gen/attribute-id.h b/examples/window-app/common/gen/attribute-id.h index 8e7aa393464caf..e4691450f06d9c 100644 --- a/examples/window-app/common/gen/attribute-id.h +++ b/examples/window-app/common/gen/attribute-id.h @@ -1240,6 +1240,29 @@ // Server attributes +// Attribute ids for cluster: Test Cluster + +// Client attributes + +// Server attributes +#define ZCL_BOOLEAN_ATTRIBUTE_ID (0x0000) +#define ZCL_BITMAP8_ATTRIBUTE_ID (0x0001) +#define ZCL_BITMAP16_ATTRIBUTE_ID (0x0002) +#define ZCL_BITMAP32_ATTRIBUTE_ID (0x0003) +#define ZCL_BITMAP64_ATTRIBUTE_ID (0x0004) +#define ZCL_INT8_U_ATTRIBUTE_ID (0x0005) +#define ZCL_INT16_U_ATTRIBUTE_ID (0x0006) +#define ZCL_INT32_U_ATTRIBUTE_ID (0x0008) +#define ZCL_INT64_U_ATTRIBUTE_ID (0x000C) +#define ZCL_INT8_S_ATTRIBUTE_ID (0x000D) +#define ZCL_INT16_S_ATTRIBUTE_ID (0x000E) +#define ZCL_INT32_S_ATTRIBUTE_ID (0x0010) +#define ZCL_INT64_S_ATTRIBUTE_ID (0x0014) +#define ZCL_ENUM8_ATTRIBUTE_ID (0x0015) +#define ZCL_ENUM16_ATTRIBUTE_ID (0x0016) +#define ZCL_OCTET_STRING_ATTRIBUTE_ID (0x0019) +#define ZCL_LIST_ATTRIBUTE_ID (0x001A) + // Attribute ids for cluster: Generic Tunnel // Client attributes diff --git a/examples/window-app/common/gen/client-command-macro.h b/examples/window-app/common/gen/client-command-macro.h index 1cfc06d80ce7c2..c8666bc5678d12 100644 --- a/examples/window-app/common/gen/client-command-macro.h +++ b/examples/window-app/common/gen/client-command-macro.h @@ -3629,6 +3629,34 @@ \ ZCL_LOGIN_COMMAND_ID, "uu", tempAccountIdentifier, setupPIN); +/** @brief Command description for Test + * + * Command: Test + * @param returnValue INT8U + */ +#define emberAfFillCommandTest \ + ClusterClusterTest(returnValue) emberAfFillExternalBuffer(mask, \ + \ + ZCL_TEST_COMMAND_ID, "u", returnValue); + +/** @brief Command description for TestNotHandled + * + * Command: TestNotHandled + */ +#define emberAfFillCommandTest \ + ClusterClusterTestNotHandled() emberAfFillExternalBuffer(mask, \ + \ + ZCL_TEST_NOT_HANDLED_COMMAND_ID, "", ); + +/** @brief Command description for TestSpecific + * + * Command: TestSpecific + */ +#define emberAfFillCommandTest \ + ClusterClusterTestSpecific() emberAfFillExternalBuffer(mask, \ + \ + ZCL_TEST_SPECIFIC_COMMAND_ID, "", ); + /** @brief Command description for MatchProtocolAddress * * Command: MatchProtocolAddress diff --git a/examples/window-app/common/gen/cluster-id.h b/examples/window-app/common/gen/cluster-id.h index b8d9a9f7ed09bf..7f71ea5976846c 100644 --- a/examples/window-app/common/gen/cluster-id.h +++ b/examples/window-app/common/gen/cluster-id.h @@ -293,6 +293,9 @@ // Definitions for cluster: Account Login #define ZCL_ACCOUNT_LOGIN_CLUSTER_ID (0x050E) +// Definitions for cluster: Test Cluster +#define ZCL_TEST_CLUSTER_ID (0x050F) + // Definitions for cluster: Generic Tunnel #define ZCL_GENERIC_TUNNEL_CLUSTER_ID (0x0600) diff --git a/examples/window-app/common/gen/command-id.h b/examples/window-app/common/gen/command-id.h index 25ee08826f030c..8e97e911e0a423 100644 --- a/examples/window-app/common/gen/command-id.h +++ b/examples/window-app/common/gen/command-id.h @@ -470,6 +470,12 @@ #define ZCL_GET_SETUP_PIN_RESPONSE_COMMAND_ID (0x00) #define ZCL_LOGIN_COMMAND_ID (0x01) +// Commands for cluster: Test Cluster +#define ZCL_TEST_COMMAND_ID (0x00) +#define ZCL_TEST_SPECIFIC_RESPONSE_COMMAND_ID (0x00) +#define ZCL_TEST_NOT_HANDLED_COMMAND_ID (0x01) +#define ZCL_TEST_SPECIFIC_COMMAND_ID (0x02) + // Commands for cluster: Generic Tunnel #define ZCL_MATCH_PROTOCOL_ADDRESS_COMMAND_ID (0x00) #define ZCL_MATCH_PROTOCOL_ADDRESS_RESPONSE_COMMAND_ID (0x00) diff --git a/examples/window-app/common/gen/print-cluster.h b/examples/window-app/common/gen/print-cluster.h index 9c879d94a9390d..886dad371554b7 100644 --- a/examples/window-app/common/gen/print-cluster.h +++ b/examples/window-app/common/gen/print-cluster.h @@ -634,6 +634,12 @@ #define CHIP_PRINTCLUSTER_ACCOUNT_LOGIN_CLUSTER #endif +#if defined(ZCL_USING_TEST_CLUSTER_SERVER) || defined(ZCL_USING_TEST_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_TEST_CLUSTER { ZCL_TEST_CLUSTER_ID, 1295, "Test Cluster" }, +#else +#define CHIP_PRINTCLUSTER_TEST_CLUSTER +#endif + #if defined(ZCL_USING_GENERIC_TUNNEL_CLUSTER_SERVER) || defined(ZCL_USING_GENERIC_TUNNEL_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_GENERIC_TUNNEL_CLUSTER { ZCL_GENERIC_TUNNEL_CLUSTER_ID, 1536, "Generic Tunnel" }, #else @@ -965,6 +971,7 @@ CHIP_PRINTCLUSTER_APPLICATION_LAUNCHER_CLUSTER \ CHIP_PRINTCLUSTER_APPLICATION_BASIC_CLUSTER \ CHIP_PRINTCLUSTER_ACCOUNT_LOGIN_CLUSTER \ + CHIP_PRINTCLUSTER_TEST_CLUSTER \ CHIP_PRINTCLUSTER_GENERIC_TUNNEL_CLUSTER \ CHIP_PRINTCLUSTER_BACNET_PROTOCOL_TUNNEL_CLUSTER \ CHIP_PRINTCLUSTER_11073_PROTOCOL_TUNNEL_CLUSTER \ diff --git a/src/app/chip-zcl-zpro-codec-api.h b/src/app/chip-zcl-zpro-codec-api.h index e433f32cec7a2d..77871bbf9e49b8 100644 --- a/src/app/chip-zcl-zpro-codec-api.h +++ b/src/app/chip-zcl-zpro-codec-api.h @@ -57,6 +57,7 @@ | TvChannel | 0x0504 | | TargetNavigator | 0x0505 | | TemperatureMeasurement | 0x0402 | +| TestCluster | 0x050F | | Thermostat | 0x0201 | | WakeOnLan | 0x0503 | | WindowCovering | 0x0102 | @@ -2845,6 +2846,286 @@ encodeTemperatureMeasurementClusterReadMaxMeasuredValueAttribute(uint8_t seqNum, chip::System::PacketBufferHandle encodeTemperatureMeasurementClusterReadClusterRevisionAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); +/*----------------------------------------------------------------------------*\ +| Cluster TestCluster | 0x050F | +|------------------------------------------------------------------------------| +| Commands: | | +| * Test | 0x00 | +| * TestNotHandled | 0x01 | +| * TestSpecific | 0x02 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * Boolean | 0x0000 | +| * Bitmap8 | 0x0001 | +| * Bitmap16 | 0x0002 | +| * Bitmap32 | 0x0003 | +| * Bitmap64 | 0x0004 | +| * Int8u | 0x0005 | +| * Int16u | 0x0006 | +| * Int32u | 0x0008 | +| * Int64u | 0x000C | +| * Int8s | 0x000D | +| * Int16s | 0x000E | +| * Int32s | 0x0010 | +| * Int64s | 0x0014 | +| * Enum8 | 0x0015 | +| * Enum16 | 0x0016 | +| * OctetString | 0x0019 | +| * ListInt8u | 0x001A | +| * ClusterRevision | 0xFFFD | +\*----------------------------------------------------------------------------*/ + +/** + * @brief + * Encode an Test command for Test Cluster server into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterTestCommand(uint8_t seqNum, chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode an TestNotHandled command for Test Cluster server into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterTestNotHandledCommand(uint8_t seqNum, + chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode an TestSpecific command for Test Cluster server into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterTestSpecificCommand(uint8_t seqNum, chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Test Cluster server discover command into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterDiscoverAttributes(uint8_t seqNum, chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Test Cluster server read command for the boolean attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterReadBooleanAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Test Cluster server write command for the boolean attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterWriteBooleanAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint, + uint8_t boolean); + +/** + * @brief + * Encode a Test Cluster server read command for the bitmap8 attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterReadBitmap8Attribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Test Cluster server write command for the bitmap8 attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterWriteBitmap8Attribute(uint8_t seqNum, chip::EndpointId destinationEndpoint, + uint8_t bitmap8); + +/** + * @brief + * Encode a Test Cluster server read command for the bitmap16 attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterReadBitmap16Attribute(uint8_t seqNum, + chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Test Cluster server write command for the bitmap16 attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle +encodeTestClusterClusterWriteBitmap16Attribute(uint8_t seqNum, chip::EndpointId destinationEndpoint, uint16_t bitmap16); + +/** + * @brief + * Encode a Test Cluster server read command for the bitmap32 attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterReadBitmap32Attribute(uint8_t seqNum, + chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Test Cluster server write command for the bitmap32 attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle +encodeTestClusterClusterWriteBitmap32Attribute(uint8_t seqNum, chip::EndpointId destinationEndpoint, uint32_t bitmap32); + +/** + * @brief + * Encode a Test Cluster server read command for the bitmap64 attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterReadBitmap64Attribute(uint8_t seqNum, + chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Test Cluster server write command for the bitmap64 attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle +encodeTestClusterClusterWriteBitmap64Attribute(uint8_t seqNum, chip::EndpointId destinationEndpoint, uint64_t bitmap64); + +/** + * @brief + * Encode a Test Cluster server read command for the int8u attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterReadInt8uAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Test Cluster server write command for the int8u attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterWriteInt8uAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint, + uint8_t int8u); + +/** + * @brief + * Encode a Test Cluster server read command for the int16u attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterReadInt16uAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Test Cluster server write command for the int16u attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterWriteInt16uAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint, + uint16_t int16u); + +/** + * @brief + * Encode a Test Cluster server read command for the int32u attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterReadInt32uAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Test Cluster server write command for the int32u attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterWriteInt32uAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint, + uint32_t int32u); + +/** + * @brief + * Encode a Test Cluster server read command for the int64u attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterReadInt64uAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Test Cluster server write command for the int64u attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterWriteInt64uAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint, + uint64_t int64u); + +/** + * @brief + * Encode a Test Cluster server read command for the int8s attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterReadInt8sAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Test Cluster server write command for the int8s attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterWriteInt8sAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint, + int8_t int8s); + +/** + * @brief + * Encode a Test Cluster server read command for the int16s attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterReadInt16sAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Test Cluster server write command for the int16s attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterWriteInt16sAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint, + int16_t int16s); + +/** + * @brief + * Encode a Test Cluster server read command for the int32s attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterReadInt32sAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Test Cluster server write command for the int32s attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterWriteInt32sAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint, + int32_t int32s); + +/** + * @brief + * Encode a Test Cluster server read command for the int64s attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterReadInt64sAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Test Cluster server write command for the int64s attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterWriteInt64sAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint, + int64_t int64s); + +/** + * @brief + * Encode a Test Cluster server read command for the enum8 attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterReadEnum8Attribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Test Cluster server write command for the enum8 attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterWriteEnum8Attribute(uint8_t seqNum, chip::EndpointId destinationEndpoint, + uint8_t enum8); + +/** + * @brief + * Encode a Test Cluster server read command for the enum16 attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterReadEnum16Attribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Test Cluster server write command for the enum16 attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterWriteEnum16Attribute(uint8_t seqNum, chip::EndpointId destinationEndpoint, + uint16_t enum16); + +/** + * @brief + * Encode a Test Cluster server read command for the octet_string attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterReadOctetStringAttribute(uint8_t seqNum, + chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Test Cluster server write command for the octet_string attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle +encodeTestClusterClusterWriteOctetStringAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint, chip::ByteSpan octetString); + +/** + * @brief + * Encode a Test Cluster server read command for the list_int8u attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterReadListInt8uAttribute(uint8_t seqNum, + chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Test Cluster server read command for the cluster revision attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeTestClusterClusterReadClusterRevisionAttribute(uint8_t seqNum, + chip::EndpointId destinationEndpoint); + /*----------------------------------------------------------------------------*\ | Cluster Thermostat | 0x0201 | |------------------------------------------------------------------------------| diff --git a/src/app/clusters/test-cluster-server/test-cluster-server.cpp b/src/app/clusters/test-cluster-server/test-cluster-server.cpp new file mode 100644 index 00000000000000..9e657730b58aeb --- /dev/null +++ b/src/app/clusters/test-cluster-server/test-cluster-server.cpp @@ -0,0 +1,63 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/**************************************************************************** + * @file + * @brief Implementation for the Test Server Cluster + ***************************************************************************/ + +#include +#include +#include +#include +#include + +#include "gen/af-structs.h" +#include "gen/attribute-id.h" +#include "gen/attribute-type.h" +#include "gen/cluster-id.h" +#include "gen/command-id.h" + +using namespace chip; + +void emberAfPluginTestClusterServerInitCallback(void) {} + +bool emberAfTestClusterClusterTestCallback(chip::app::Command *) +{ + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS); + return true; +} + +bool emberAfTestClusterClusterTestSpecificCallback(chip::app::Command *) +{ + uint8_t returnValue = 7; + emberAfFillExternalBuffer((ZCL_CLUSTER_SPECIFIC_COMMAND | ZCL_FRAME_CONTROL_SERVER_TO_CLIENT), ZCL_TEST_CLUSTER_ID, + ZCL_TEST_SPECIFIC_RESPONSE_COMMAND_ID, "u", returnValue); + + EmberStatus sendStatus = emberAfSendResponse(); + if (EMBER_SUCCESS != sendStatus) + { + ChipLogError(Zcl, "Test Cluster: failed to send TestSpecific response: 0x%x", sendStatus); + } + + return true; +} + +bool emberAfTestClusterClusterTestNotHandledCallback(chip::app::Command *) +{ + return false; +} diff --git a/src/app/encoder.cpp b/src/app/encoder.cpp index 3358a6b1caf6d3..57a0d534c3160a 100644 --- a/src/app/encoder.cpp +++ b/src/app/encoder.cpp @@ -128,6 +128,7 @@ uint16_t encodeApsFrame(uint8_t * buffer, uint16_t buf_length, EmberApsFrame * a | TvChannel | 0x0504 | | TargetNavigator | 0x0505 | | TemperatureMeasurement | 0x0402 | +| TestCluster | 0x050F | | Thermostat | 0x0201 | | WakeOnLan | 0x0503 | | WindowCovering | 0x0102 | @@ -328,6 +329,11 @@ uint16_t encodeApsFrame(uint8_t * buffer, uint16_t buf_length, EmberApsFrame * a #define TEMP_MEASUREMENT_CLUSTER_ID 0x0402 +#define TEST_CLUSTER_ID 0x050F +#define ZCL_TEST_COMMAND_ID (0x00) +#define ZCL_TEST_NOT_HANDLED_COMMAND_ID (0x01) +#define ZCL_TEST_SPECIFIC_COMMAND_ID (0x02) + #define THERMOSTAT_CLUSTER_ID 0x0201 #define ZCL_CLEAR_WEEKLY_SCHEDULE_COMMAND_ID (0x03) #define ZCL_GET_RELAY_STATUS_LOG_COMMAND_ID (0x04) @@ -4867,6 +4873,453 @@ PacketBufferHandle encodeTemperatureMeasurementClusterReadClusterRevisionAttribu COMMAND_FOOTER(); } +/*----------------------------------------------------------------------------*\ +| Cluster TestCluster | 0x050F | +|------------------------------------------------------------------------------| +| Commands: | | +| * Test | 0x00 | +| * TestNotHandled | 0x01 | +| * TestSpecific | 0x02 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * Boolean | 0x0000 | +| * Bitmap8 | 0x0001 | +| * Bitmap16 | 0x0002 | +| * Bitmap32 | 0x0003 | +| * Bitmap64 | 0x0004 | +| * Int8u | 0x0005 | +| * Int16u | 0x0006 | +| * Int32u | 0x0008 | +| * Int64u | 0x000C | +| * Int8s | 0x000D | +| * Int16s | 0x000E | +| * Int32s | 0x0010 | +| * Int64s | 0x0014 | +| * Enum8 | 0x0015 | +| * Enum16 | 0x0016 | +| * OctetString | 0x0019 | +| * ListInt8u | 0x001A | +| * ClusterRevision | 0xFFFD | +\*----------------------------------------------------------------------------*/ + +/* + * Command Test + */ +PacketBufferHandle encodeTestClusterClusterTestCommand(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("Test", TEST_CLUSTER_ID); + buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_TEST_COMMAND_ID); + COMMAND_FOOTER(); +} + +/* + * Command TestNotHandled + */ +PacketBufferHandle encodeTestClusterClusterTestNotHandledCommand(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("TestNotHandled", TEST_CLUSTER_ID); + buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_TEST_NOT_HANDLED_COMMAND_ID); + COMMAND_FOOTER(); +} + +/* + * Command TestSpecific + */ +PacketBufferHandle encodeTestClusterClusterTestSpecificCommand(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("TestSpecific", TEST_CLUSTER_ID); + buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_TEST_SPECIFIC_COMMAND_ID); + COMMAND_FOOTER(); +} + +PacketBufferHandle encodeTestClusterClusterDiscoverAttributes(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("DiscoverTestClusterAttributes", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_DISCOVER_ATTRIBUTES_COMMAND_ID).Put16(0x0000).Put8(0xFF); + COMMAND_FOOTER(); +} + +/* + * Attribute Boolean + */ +PacketBufferHandle encodeTestClusterClusterReadBooleanAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadTestClusterBoolean", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0000); + COMMAND_FOOTER(); +} + +PacketBufferHandle encodeTestClusterClusterWriteBooleanAttribute(uint8_t seqNum, EndpointId destinationEndpoint, uint8_t boolean) +{ + COMMAND_HEADER("WriteTestClusterBoolean", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand) + .Put8(seqNum) + .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID) + .Put16(0x0000) + .Put8(16) + .Put8(static_cast(boolean)); + COMMAND_FOOTER(); +} + +/* + * Attribute Bitmap8 + */ +PacketBufferHandle encodeTestClusterClusterReadBitmap8Attribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadTestClusterBitmap8", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0001); + COMMAND_FOOTER(); +} + +PacketBufferHandle encodeTestClusterClusterWriteBitmap8Attribute(uint8_t seqNum, EndpointId destinationEndpoint, uint8_t bitmap8) +{ + COMMAND_HEADER("WriteTestClusterBitmap8", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand) + .Put8(seqNum) + .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID) + .Put16(0x0001) + .Put8(24) + .Put8(static_cast(bitmap8)); + COMMAND_FOOTER(); +} + +/* + * Attribute Bitmap16 + */ +PacketBufferHandle encodeTestClusterClusterReadBitmap16Attribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadTestClusterBitmap16", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0002); + COMMAND_FOOTER(); +} + +PacketBufferHandle encodeTestClusterClusterWriteBitmap16Attribute(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t bitmap16) +{ + COMMAND_HEADER("WriteTestClusterBitmap16", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand) + .Put8(seqNum) + .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID) + .Put16(0x0002) + .Put8(25) + .Put16(static_cast(bitmap16)); + COMMAND_FOOTER(); +} + +/* + * Attribute Bitmap32 + */ +PacketBufferHandle encodeTestClusterClusterReadBitmap32Attribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadTestClusterBitmap32", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0003); + COMMAND_FOOTER(); +} + +PacketBufferHandle encodeTestClusterClusterWriteBitmap32Attribute(uint8_t seqNum, EndpointId destinationEndpoint, uint32_t bitmap32) +{ + COMMAND_HEADER("WriteTestClusterBitmap32", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand) + .Put8(seqNum) + .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID) + .Put16(0x0003) + .Put8(27) + .Put32(static_cast(bitmap32)); + COMMAND_FOOTER(); +} + +/* + * Attribute Bitmap64 + */ +PacketBufferHandle encodeTestClusterClusterReadBitmap64Attribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadTestClusterBitmap64", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0004); + COMMAND_FOOTER(); +} + +PacketBufferHandle encodeTestClusterClusterWriteBitmap64Attribute(uint8_t seqNum, EndpointId destinationEndpoint, uint64_t bitmap64) +{ + COMMAND_HEADER("WriteTestClusterBitmap64", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand) + .Put8(seqNum) + .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID) + .Put16(0x0004) + .Put8(31) + .Put64(static_cast(bitmap64)); + COMMAND_FOOTER(); +} + +/* + * Attribute Int8u + */ +PacketBufferHandle encodeTestClusterClusterReadInt8uAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadTestClusterInt8u", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0005); + COMMAND_FOOTER(); +} + +PacketBufferHandle encodeTestClusterClusterWriteInt8uAttribute(uint8_t seqNum, EndpointId destinationEndpoint, uint8_t int8u) +{ + COMMAND_HEADER("WriteTestClusterInt8u", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand) + .Put8(seqNum) + .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID) + .Put16(0x0005) + .Put8(32) + .Put8(static_cast(int8u)); + COMMAND_FOOTER(); +} + +/* + * Attribute Int16u + */ +PacketBufferHandle encodeTestClusterClusterReadInt16uAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadTestClusterInt16u", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0006); + COMMAND_FOOTER(); +} + +PacketBufferHandle encodeTestClusterClusterWriteInt16uAttribute(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t int16u) +{ + COMMAND_HEADER("WriteTestClusterInt16u", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand) + .Put8(seqNum) + .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID) + .Put16(0x0006) + .Put8(33) + .Put16(static_cast(int16u)); + COMMAND_FOOTER(); +} + +/* + * Attribute Int32u + */ +PacketBufferHandle encodeTestClusterClusterReadInt32uAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadTestClusterInt32u", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0008); + COMMAND_FOOTER(); +} + +PacketBufferHandle encodeTestClusterClusterWriteInt32uAttribute(uint8_t seqNum, EndpointId destinationEndpoint, uint32_t int32u) +{ + COMMAND_HEADER("WriteTestClusterInt32u", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand) + .Put8(seqNum) + .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID) + .Put16(0x0008) + .Put8(35) + .Put32(static_cast(int32u)); + COMMAND_FOOTER(); +} + +/* + * Attribute Int64u + */ +PacketBufferHandle encodeTestClusterClusterReadInt64uAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadTestClusterInt64u", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x000C); + COMMAND_FOOTER(); +} + +PacketBufferHandle encodeTestClusterClusterWriteInt64uAttribute(uint8_t seqNum, EndpointId destinationEndpoint, uint64_t int64u) +{ + COMMAND_HEADER("WriteTestClusterInt64u", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand) + .Put8(seqNum) + .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID) + .Put16(0x000C) + .Put8(39) + .Put64(static_cast(int64u)); + COMMAND_FOOTER(); +} + +/* + * Attribute Int8s + */ +PacketBufferHandle encodeTestClusterClusterReadInt8sAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadTestClusterInt8s", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x000D); + COMMAND_FOOTER(); +} + +PacketBufferHandle encodeTestClusterClusterWriteInt8sAttribute(uint8_t seqNum, EndpointId destinationEndpoint, int8_t int8s) +{ + COMMAND_HEADER("WriteTestClusterInt8s", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand) + .Put8(seqNum) + .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID) + .Put16(0x000D) + .Put8(40) + .Put8(static_cast(int8s)); + COMMAND_FOOTER(); +} + +/* + * Attribute Int16s + */ +PacketBufferHandle encodeTestClusterClusterReadInt16sAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadTestClusterInt16s", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x000E); + COMMAND_FOOTER(); +} + +PacketBufferHandle encodeTestClusterClusterWriteInt16sAttribute(uint8_t seqNum, EndpointId destinationEndpoint, int16_t int16s) +{ + COMMAND_HEADER("WriteTestClusterInt16s", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand) + .Put8(seqNum) + .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID) + .Put16(0x000E) + .Put8(41) + .Put16(static_cast(int16s)); + COMMAND_FOOTER(); +} + +/* + * Attribute Int32s + */ +PacketBufferHandle encodeTestClusterClusterReadInt32sAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadTestClusterInt32s", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0010); + COMMAND_FOOTER(); +} + +PacketBufferHandle encodeTestClusterClusterWriteInt32sAttribute(uint8_t seqNum, EndpointId destinationEndpoint, int32_t int32s) +{ + COMMAND_HEADER("WriteTestClusterInt32s", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand) + .Put8(seqNum) + .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID) + .Put16(0x0010) + .Put8(43) + .Put32(static_cast(int32s)); + COMMAND_FOOTER(); +} + +/* + * Attribute Int64s + */ +PacketBufferHandle encodeTestClusterClusterReadInt64sAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadTestClusterInt64s", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0014); + COMMAND_FOOTER(); +} + +PacketBufferHandle encodeTestClusterClusterWriteInt64sAttribute(uint8_t seqNum, EndpointId destinationEndpoint, int64_t int64s) +{ + COMMAND_HEADER("WriteTestClusterInt64s", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand) + .Put8(seqNum) + .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID) + .Put16(0x0014) + .Put8(47) + .Put64(static_cast(int64s)); + COMMAND_FOOTER(); +} + +/* + * Attribute Enum8 + */ +PacketBufferHandle encodeTestClusterClusterReadEnum8Attribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadTestClusterEnum8", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0015); + COMMAND_FOOTER(); +} + +PacketBufferHandle encodeTestClusterClusterWriteEnum8Attribute(uint8_t seqNum, EndpointId destinationEndpoint, uint8_t enum8) +{ + COMMAND_HEADER("WriteTestClusterEnum8", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand) + .Put8(seqNum) + .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID) + .Put16(0x0015) + .Put8(48) + .Put8(static_cast(enum8)); + COMMAND_FOOTER(); +} + +/* + * Attribute Enum16 + */ +PacketBufferHandle encodeTestClusterClusterReadEnum16Attribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadTestClusterEnum16", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0016); + COMMAND_FOOTER(); +} + +PacketBufferHandle encodeTestClusterClusterWriteEnum16Attribute(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t enum16) +{ + COMMAND_HEADER("WriteTestClusterEnum16", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand) + .Put8(seqNum) + .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID) + .Put16(0x0016) + .Put8(49) + .Put16(static_cast(enum16)); + COMMAND_FOOTER(); +} + +/* + * Attribute OctetString + */ +PacketBufferHandle encodeTestClusterClusterReadOctetStringAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadTestClusterOctetString", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0019); + COMMAND_FOOTER(); +} + +PacketBufferHandle encodeTestClusterClusterWriteOctetStringAttribute(uint8_t seqNum, EndpointId destinationEndpoint, + chip::ByteSpan octetString) +{ + COMMAND_HEADER("WriteTestClusterOctetString", TEST_CLUSTER_ID); + size_t octetStringStrLen = octetString.size(); + if (!CanCastTo(octetStringStrLen)) + { + ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, octetStringStrLen); + return PacketBufferHandle(); + } + + buf.Put8(kFrameControlGlobalCommand) + .Put8(seqNum) + .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID) + .Put16(0x0019) + .Put8(65) + .Put(static_cast(octetStringStrLen)) + .Put(octetString.data(), octetStringStrLen); + COMMAND_FOOTER(); +} + +/* + * Attribute ListInt8u + */ +PacketBufferHandle encodeTestClusterClusterReadListInt8uAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadTestClusterListInt8u", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x001A); + COMMAND_FOOTER(); +} + +/* + * Attribute ClusterRevision + */ +PacketBufferHandle encodeTestClusterClusterReadClusterRevisionAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadTestClusterClusterRevision", TEST_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0xFFFD); + COMMAND_FOOTER(); +} + /*----------------------------------------------------------------------------*\ | Cluster Thermostat | 0x0201 | |------------------------------------------------------------------------------| diff --git a/src/app/util/util.cpp b/src/app/util/util.cpp index a32f29dc50163e..9f7477a4eeb1f2 100644 --- a/src/app/util/util.cpp +++ b/src/app/util/util.cpp @@ -145,6 +145,9 @@ void emberAfPluginDoorLockServerInitCallback(void); #ifdef ZCL_USING_DESCRIPTOR_CLUSTER_SERVER void emberAfPluginDescriptorServerInitCallback(void); #endif +#ifdef ZCL_USING_TEST_CLUSTER_SERVER +void emberAfPluginTestClusterServerInitCallback(void); +#endif #ifdef EMBER_AF_GENERATED_PLUGIN_TICK_FUNCTION_DECLARATIONS EMBER_AF_GENERATED_PLUGIN_TICK_FUNCTION_DECLARATIONS @@ -309,6 +312,9 @@ void emberAfInit(chip::Messaging::ExchangeManager * exchangeMgr) #ifdef ZCL_USING_DESCRIPTOR_CLUSTER_SERVER emberAfPluginDescriptorServerInitCallback(); #endif +#ifdef ZCL_USING_TEST_CLUSTER_SERVER + emberAfPluginTestClusterServerInitCallback(); +#endif emAfCallInits(); } diff --git a/src/app/zap-templates/templates/app/CHIPClustersObjc-src.zapt b/src/app/zap-templates/templates/app/CHIPClustersObjc-src.zapt index 8bc8e0aed4a014..d508ef872ebc67 100644 --- a/src/app/zap-templates/templates/app/CHIPClustersObjc-src.zapt +++ b/src/app/zap-templates/templates/app/CHIPClustersObjc-src.zapt @@ -251,6 +251,39 @@ private: bool mKeepAlive; }; +class CHIPInt16sAttributeCallbackBridge : public Callback::Callback { +public: + CHIPInt16sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + , mKeepAlive(keepAlive) + { + } + + ~CHIPInt16sAttributeCallbackBridge() {}; + + static void CallbackFn(void * context, int16_t value) + { + CHIPInt16sAttributeCallbackBridge * callback = reinterpret_cast(context); + if (callback && callback->mQueue) { + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @{ @"value": [NSNumber numberWithShort:value] }); + if (!callback->mKeepAlive) + { + callback->Cancel(); + delete callback; + } + }); + } + }; + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; + bool mKeepAlive; +}; + class CHIPInt32uAttributeCallbackBridge : public Callback::Callback { public: CHIPInt32uAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false) @@ -284,6 +317,39 @@ private: bool mKeepAlive; }; +class CHIPInt32sAttributeCallbackBridge : public Callback::Callback { +public: + CHIPInt32sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + , mKeepAlive(keepAlive) + { + } + + ~CHIPInt32sAttributeCallbackBridge() {}; + + static void CallbackFn(void * context, int32_t value) + { + CHIPInt32sAttributeCallbackBridge * callback = reinterpret_cast(context); + if (callback && callback->mQueue) { + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @{ @"value": [NSNumber numberWithLong:value] }); + if (!callback->mKeepAlive) + { + callback->Cancel(); + delete callback; + } + }); + } + }; + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; + bool mKeepAlive; +}; + class CHIPInt64uAttributeCallbackBridge : public Callback::Callback { public: CHIPInt64uAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false) @@ -317,24 +383,24 @@ private: bool mKeepAlive; }; -class CHIPInt16sAttributeCallbackBridge : public Callback::Callback { +class CHIPInt64sAttributeCallbackBridge : public Callback::Callback { public: - CHIPInt16sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false) - : Callback::Callback(CallbackFn, this) + CHIPInt64sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false) + : Callback::Callback(CallbackFn, this) , mHandler(handler) , mQueue(queue) , mKeepAlive(keepAlive) { } - ~CHIPInt16sAttributeCallbackBridge() {}; + ~CHIPInt64sAttributeCallbackBridge() {}; - static void CallbackFn(void * context, int16_t value) + static void CallbackFn(void * context, int64_t value) { - CHIPInt16sAttributeCallbackBridge * callback = reinterpret_cast(context); + CHIPInt64sAttributeCallbackBridge * callback = reinterpret_cast(context); if (callback && callback->mQueue) { dispatch_async(callback->mQueue, ^{ - callback->mHandler(nil, @{ @"value": [NSNumber numberWithShort:value] }); + callback->mHandler(nil, @{ @"value": [NSNumber numberWithLongLong:value] }); if (!callback->mKeepAlive) { callback->Cancel(); diff --git a/src/app/zap-templates/zcl/test-cluster.xml b/src/app/zap-templates/zcl/test-cluster.xml new file mode 100644 index 00000000000000..3d187797f57a69 --- /dev/null +++ b/src/app/zap-templates/zcl/test-cluster.xml @@ -0,0 +1,82 @@ + + + + + + CHIP + Test Cluster + 0x050F + TEST_CLUSTER + The Test Cluster is meant to validate the generated code + + boolean + bitmap8 + bitmap16 + bitmap32 + bitmap64 + int8u + int16u + + int32u + + + + int64u + int8s + int16s + + int32s + + + + int64s + enum8 + enum16 + + + octet_string + list_int8u + + + + + + Simple command without any parameters and without a specific response + + + + + + Simple command without any parameters and without a specific response not handled by the server + + + + + + Simple command without any parameters and with a specific response + + + + + + Simple response for TestWithResponse with a simple return value + + + + + + diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index 8cca8614ef1eaa..034ebf849b158f 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -2,6 +2,7 @@ "version": "ZCL Test Data", "xmlRoot": [".", "./data-model/silabs/"], "xmlFile": [ + "test-cluster.xml", "account-login-cluster.xml", "application-launcher-cluster.xml", "audio-output-cluster.xml", diff --git a/src/app/zap_cluster_list.py b/src/app/zap_cluster_list.py index cf0e31cafacd2c..f0c49b7ccd26ee 100755 --- a/src/app/zap_cluster_list.py +++ b/src/app/zap_cluster_list.py @@ -46,6 +46,7 @@ 'SWITCH_CLUSTER': [], 'TARGET_NAVIGATOR_CLUSTER': ['target-navigator-server'], 'TEMP_MEASUREMENT_CLUSTER': ['temperature-measurement-server'], + 'TEST_CLUSTER': ['test-cluster-server'], 'TV_CHANNEL_CLUSTER': ['tv-channel-server'], 'THERMOSTAT_CLUSTER': [], 'WINDOW_COVERING_CLUSTER': [], @@ -92,6 +93,7 @@ 'SWITCH_CLUSTER': [], 'TARGET_NAVIGATOR_CLUSTER': [], 'TEMP_MEASUREMENT_CLUSTER': [], + 'TEST_CLUSTER': [], 'TV_CHANNEL_CLUSTER': [], 'THERMOSTAT_CLUSTER': ['thermostat-client'], 'WINDOW_COVERING_CLUSTER': [], diff --git a/src/controller/controller-clusters.zap b/src/controller/controller-clusters.zap index ab732451451b3f..ea6130657d280f 100644 --- a/src/controller/controller-clusters.zap +++ b/src/controller/controller-clusters.zap @@ -5616,6 +5616,347 @@ } ] }, + { + "name": "Test Cluster", + "code": 1295, + "mfgCode": null, + "define": "TEST_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "Test", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "TestNotHandled", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "TestSpecific", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Test Cluster", + "code": 1295, + "mfgCode": null, + "define": "TEST_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "TestSpecificResponse", + "code": 0, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "boolean", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "false", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "bitmap8", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "bitmap16", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "bitmap32", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "bitmap64", + "code": 4, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int8u", + "code": 5, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int16u", + "code": 6, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int32u", + "code": 8, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int64u", + "code": 12, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int8s", + "code": 13, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int16s", + "code": 14, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int32s", + "code": 16, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int64s", + "code": 20, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "enum8", + "code": 21, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "enum16", + "code": 22, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "octet_string", + "code": 25, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "list_int8u", + "code": 26, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, { "name": "Binding", "code": 61440, @@ -8653,4 +8994,4 @@ } ], "log": [] -} \ No newline at end of file +} diff --git a/src/controller/python/chip/clusters/CHIPClusters.cpp b/src/controller/python/chip/clusters/CHIPClusters.cpp index 5ad212116dabd0..bb4f98bafe8304 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.cpp +++ b/src/controller/python/chip/clusters/CHIPClusters.cpp @@ -2612,6 +2612,186 @@ CHIP_ERROR chip_ime_ReadAttribute_TemperatureMeasurement_ClusterRevision(chip::C } // End of Cluster TemperatureMeasurement +// Cluster TestCluster + +CHIP_ERROR chip_ime_AppendCommand_TestCluster_Test(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.Test(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} +CHIP_ERROR chip_ime_AppendCommand_TestCluster_TestNotHandled(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.TestNotHandled(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} +CHIP_ERROR chip_ime_AppendCommand_TestCluster_TestSpecific(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.TestSpecific(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_TestCluster_Boolean(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.ReadAttributeBoolean(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_TestCluster_Bitmap8(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.ReadAttributeBitmap8(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_TestCluster_Bitmap16(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.ReadAttributeBitmap16(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_TestCluster_Bitmap32(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.ReadAttributeBitmap32(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_TestCluster_Bitmap64(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.ReadAttributeBitmap64(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_TestCluster_Int8u(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.ReadAttributeInt8u(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_TestCluster_Int16u(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.ReadAttributeInt16u(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_TestCluster_Int32u(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.ReadAttributeInt32u(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_TestCluster_Int64u(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.ReadAttributeInt64u(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_TestCluster_Int8s(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.ReadAttributeInt8s(gInt8sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_TestCluster_Int16s(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.ReadAttributeInt16s(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_TestCluster_Int32s(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.ReadAttributeInt32s(gInt32sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_TestCluster_Int64s(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.ReadAttributeInt64s(gInt64sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_TestCluster_Enum8(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.ReadAttributeEnum8(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_TestCluster_Enum16(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.ReadAttributeEnum16(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_TestCluster_OctetString(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.ReadAttributeOctetString(gStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_TestCluster_ClusterRevision(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.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +// End of Cluster TestCluster // Cluster Thermostat CHIP_ERROR chip_ime_AppendCommand_Thermostat_ClearWeeklySchedule(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index b05b05929ff321..98261141946fe9 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -550,6 +550,14 @@ def ListClusterCommands(self): }, "TemperatureMeasurement": { }, + "TestCluster": { + "Test": { + }, + "TestNotHandled": { + }, + "TestSpecific": { + }, + }, "Thermostat": { "ClearWeeklySchedule": { }, @@ -796,6 +804,25 @@ def ListClusterAttributes(self): "MaxMeasuredValue", "ClusterRevision", ], + "TestCluster": [ + "Boolean", + "Bitmap8", + "Bitmap16", + "Bitmap32", + "Bitmap64", + "Int8u", + "Int16u", + "Int32u", + "Int64u", + "Int8s", + "Int16s", + "Int32s", + "Int64s", + "Enum8", + "Enum16", + "OctetString", + "ClusterRevision", + ], "Thermostat": [ "LocalTemperature", "OccupiedCoolingSetpoint", @@ -1311,6 +1338,18 @@ def ClusterTargetNavigator_CommandNavigateTarget(self, device: ctypes.c_void_p, return self._chipLib.chip_ime_AppendCommand_TargetNavigator_NavigateTarget( device, ZCLendpoint, ZCLgroupid, target, data, len(data) ) + def ClusterTestCluster_CommandTest(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_AppendCommand_TestCluster_Test( + device, ZCLendpoint, ZCLgroupid + ) + def ClusterTestCluster_CommandTestNotHandled(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_AppendCommand_TestCluster_TestNotHandled( + device, ZCLendpoint, ZCLgroupid + ) + def ClusterTestCluster_CommandTestSpecific(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_AppendCommand_TestCluster_TestSpecific( + device, ZCLendpoint, ZCLgroupid + ) def ClusterThermostat_CommandClearWeeklySchedule(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): return self._chipLib.chip_ime_AppendCommand_Thermostat_ClearWeeklySchedule( device, ZCLendpoint, ZCLgroupid @@ -1668,6 +1707,40 @@ def ClusterTemperatureMeasurement_ReadAttributeMaxMeasuredValue(self, device: ct return self._chipLib.chip_ime_ReadAttribute_TemperatureMeasurement_MaxMeasuredValue(device, ZCLendpoint, ZCLgroupid) def ClusterTemperatureMeasurement_ReadAttributeClusterRevision(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): return self._chipLib.chip_ime_ReadAttribute_TemperatureMeasurement_ClusterRevision(device, ZCLendpoint, ZCLgroupid) + def ClusterTestCluster_ReadAttributeBoolean(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_Boolean(device, ZCLendpoint, ZCLgroupid) + def ClusterTestCluster_ReadAttributeBitmap8(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_Bitmap8(device, ZCLendpoint, ZCLgroupid) + def ClusterTestCluster_ReadAttributeBitmap16(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_Bitmap16(device, ZCLendpoint, ZCLgroupid) + def ClusterTestCluster_ReadAttributeBitmap32(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_Bitmap32(device, ZCLendpoint, ZCLgroupid) + def ClusterTestCluster_ReadAttributeBitmap64(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_Bitmap64(device, ZCLendpoint, ZCLgroupid) + def ClusterTestCluster_ReadAttributeInt8u(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_Int8u(device, ZCLendpoint, ZCLgroupid) + def ClusterTestCluster_ReadAttributeInt16u(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_Int16u(device, ZCLendpoint, ZCLgroupid) + def ClusterTestCluster_ReadAttributeInt32u(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_Int32u(device, ZCLendpoint, ZCLgroupid) + def ClusterTestCluster_ReadAttributeInt64u(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_Int64u(device, ZCLendpoint, ZCLgroupid) + def ClusterTestCluster_ReadAttributeInt8s(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_Int8s(device, ZCLendpoint, ZCLgroupid) + def ClusterTestCluster_ReadAttributeInt16s(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_Int16s(device, ZCLendpoint, ZCLgroupid) + def ClusterTestCluster_ReadAttributeInt32s(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_Int32s(device, ZCLendpoint, ZCLgroupid) + def ClusterTestCluster_ReadAttributeInt64s(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_Int64s(device, ZCLendpoint, ZCLgroupid) + def ClusterTestCluster_ReadAttributeEnum8(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_Enum8(device, ZCLendpoint, ZCLgroupid) + def ClusterTestCluster_ReadAttributeEnum16(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_Enum16(device, ZCLendpoint, ZCLgroupid) + def ClusterTestCluster_ReadAttributeOctetString(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_OctetString(device, ZCLendpoint, ZCLgroupid) + 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): return self._chipLib.chip_ime_ReadAttribute_Thermostat_LocalTemperature(device, ZCLendpoint, ZCLgroupid) def ClusterThermostat_ConfigureAttributeLocalTemperature(self, device: ctypes.c_void_p, ZCLendpoint: int, minInterval: int, maxInterval: int, change: int): @@ -2545,6 +2618,67 @@ def InitLib(self, chipLib): # Cluster TemperatureMeasurement ReadAttribute ClusterRevision self._chipLib.chip_ime_ReadAttribute_TemperatureMeasurement_ClusterRevision.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] self._chipLib.chip_ime_ReadAttribute_TemperatureMeasurement_ClusterRevision.restype = ctypes.c_uint32 + # Cluster TestCluster + # Cluster TestCluster Command Test + self._chipLib.chip_ime_AppendCommand_TestCluster_Test.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_AppendCommand_TestCluster_Test.restype = ctypes.c_uint32 + # Cluster TestCluster Command TestNotHandled + self._chipLib.chip_ime_AppendCommand_TestCluster_TestNotHandled.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_AppendCommand_TestCluster_TestNotHandled.restype = ctypes.c_uint32 + # Cluster TestCluster Command TestSpecific + self._chipLib.chip_ime_AppendCommand_TestCluster_TestSpecific.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_AppendCommand_TestCluster_TestSpecific.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute Boolean + self._chipLib.chip_ime_ReadAttribute_TestCluster_Boolean.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_Boolean.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute Bitmap8 + self._chipLib.chip_ime_ReadAttribute_TestCluster_Bitmap8.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_Bitmap8.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute Bitmap16 + self._chipLib.chip_ime_ReadAttribute_TestCluster_Bitmap16.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_Bitmap16.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute Bitmap32 + self._chipLib.chip_ime_ReadAttribute_TestCluster_Bitmap32.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_Bitmap32.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute Bitmap64 + self._chipLib.chip_ime_ReadAttribute_TestCluster_Bitmap64.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_Bitmap64.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute Int8u + self._chipLib.chip_ime_ReadAttribute_TestCluster_Int8u.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_Int8u.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute Int16u + self._chipLib.chip_ime_ReadAttribute_TestCluster_Int16u.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_Int16u.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute Int32u + self._chipLib.chip_ime_ReadAttribute_TestCluster_Int32u.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_Int32u.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute Int64u + self._chipLib.chip_ime_ReadAttribute_TestCluster_Int64u.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_Int64u.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute Int8s + self._chipLib.chip_ime_ReadAttribute_TestCluster_Int8s.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_Int8s.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute Int16s + self._chipLib.chip_ime_ReadAttribute_TestCluster_Int16s.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_Int16s.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute Int32s + self._chipLib.chip_ime_ReadAttribute_TestCluster_Int32s.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_Int32s.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute Int64s + self._chipLib.chip_ime_ReadAttribute_TestCluster_Int64s.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_Int64s.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute Enum8 + self._chipLib.chip_ime_ReadAttribute_TestCluster_Enum8.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_Enum8.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute Enum16 + self._chipLib.chip_ime_ReadAttribute_TestCluster_Enum16.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_Enum16.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute OctetString + self._chipLib.chip_ime_ReadAttribute_TestCluster_OctetString.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_OctetString.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 # Cluster Thermostat # Cluster Thermostat Command ClearWeeklySchedule self._chipLib.chip_ime_AppendCommand_Thermostat_ClearWeeklySchedule.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] diff --git a/src/controller/python/gen/CHIPClientCallbacks.cpp b/src/controller/python/gen/CHIPClientCallbacks.cpp index 70a488cb90df99..84abd16b2426bb 100644 --- a/src/controller/python/gen/CHIPClientCallbacks.cpp +++ b/src/controller/python/gen/CHIPClientCallbacks.cpp @@ -506,6 +506,26 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag } } break; + case 0x050F: + switch (attributeId) + { + case 0x001A: // INT8U + { + uint8_t data[count]; + for (size_t i = 0; i < count; i++) + { + data[i] = emberAfGetInt8u(message, 0, messageLen); + message += 1; + CHECK_MESSAGE_LENGTH(1); + } + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, count, data); + break; + } + } + break; } break; } @@ -2052,6 +2072,19 @@ bool emberAfTargetNavigatorClusterNavigateTargetResponseCallback(chip::app::Comm return true; } +bool emberAfTestClusterClusterTestSpecificResponseCallback(chip::app::Command * commandObj, uint8_t returnValue) +{ + ChipLogProgress(Zcl, "TestSpecificResponse:"); + ChipLogProgress(Zcl, " returnValue: %" PRIu8 "", returnValue); + + GET_RESPONSE_CALLBACKS("TestClusterClusterTestSpecificResponseCallback"); + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, returnValue); + return true; +} + bool emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * message, uint16_t messageLen) { ChipLogProgress(Zcl, "emberAfReportAttributeCallback:"); diff --git a/src/controller/python/gen/CHIPClientCallbacks.h b/src/controller/python/gen/CHIPClientCallbacks.h index b06c6463af03ed..72855168d14220 100644 --- a/src/controller/python/gen/CHIPClientCallbacks.h +++ b/src/controller/python/gen/CHIPClientCallbacks.h @@ -125,6 +125,7 @@ typedef void (*TvChannelClusterChangeChannelResponseCallback)(void * context, /* TYPE WARNING: array array defaults to */ uint8_t * ChannelMatch, uint8_t ErrorType); typedef void (*TargetNavigatorClusterNavigateTargetResponseCallback)(void * context, uint8_t * data); +typedef void (*TestClusterClusterTestSpecificResponseCallback)(void * context, uint8_t returnValue); // List specific responses typedef void (*DescriptorDeviceListListAttributeCallback)(void * context, uint16_t count, _DeviceType * entries); @@ -134,3 +135,4 @@ typedef void (*DescriptorPartsListListAttributeCallback)(void * context, uint16_ typedef void (*GroupKeyManagementGroupsListAttributeCallback)(void * context, uint16_t count, _GroupState * entries); typedef void (*GroupKeyManagementGroupKeysListAttributeCallback)(void * context, uint16_t count, _GroupKey * entries); typedef void (*OperationalCredentialsFabricsListListAttributeCallback)(void * context, uint16_t count, _FabricDescriptor * entries); +typedef void (*TestClusterListInt8uListAttributeCallback)(void * context, uint16_t count, uint8_t * entries); diff --git a/src/controller/python/gen/CHIPClusters.cpp b/src/controller/python/gen/CHIPClusters.cpp index 1f7a7bc15002dc..0edde18b28d8d6 100644 --- a/src/controller/python/gen/CHIPClusters.cpp +++ b/src/controller/python/gen/CHIPClusters.cpp @@ -5303,6 +5303,362 @@ CHIP_ERROR TemperatureMeasurementCluster::ReadAttributeClusterRevision(Callback: return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); } +// TestCluster Cluster Commands +CHIP_ERROR TestClusterCluster::Test(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kTestCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + // Command takes no arguments. + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterTestCommand(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + +CHIP_ERROR TestClusterCluster::TestNotHandled(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kTestNotHandledCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + // Command takes no arguments. + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterTestNotHandledCommand(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + +CHIP_ERROR TestClusterCluster::TestSpecific(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kTestSpecificCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + // Command takes no arguments. + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterTestSpecificCommand(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + +// TestCluster Cluster Attributes +CHIP_ERROR TestClusterCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterDiscoverAttributes(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} +CHIP_ERROR TestClusterCluster::ReadAttributeBoolean(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadBooleanAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeBoolean(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint8_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteBooleanAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeBitmap8(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadBitmap8Attribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeBitmap8(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint8_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteBitmap8Attribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeBitmap16(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadBitmap16Attribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeBitmap16(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteBitmap16Attribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeBitmap32(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadBitmap32Attribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeBitmap32(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint32_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteBitmap32Attribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeBitmap64(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadBitmap64Attribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeBitmap64(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint64_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteBitmap64Attribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeInt8u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadInt8uAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeInt8u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint8_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteInt8uAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeInt16u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadInt16uAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeInt16u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteInt16uAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeInt32u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadInt32uAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeInt32u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint32_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteInt32uAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeInt64u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadInt64uAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeInt64u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint64_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteInt64uAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeInt8s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadInt8sAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeInt8s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, int8_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteInt8sAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeInt16s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadInt16sAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeInt16s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, int16_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteInt16sAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeInt32s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadInt32sAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeInt32s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, int32_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteInt32sAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeInt64s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadInt64sAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeInt64s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, int64_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteInt64sAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeEnum8(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadEnum8Attribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeEnum8(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint8_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteEnum8Attribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeEnum16(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadEnum16Attribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeEnum16(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteEnum16Attribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeOctetString(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadOctetStringAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeOctetString(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, chip::ByteSpan value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteOctetStringAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeListInt8u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadListInt8uAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadClusterRevisionAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + // Thermostat Cluster Commands CHIP_ERROR ThermostatCluster::ClearWeeklySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) diff --git a/src/controller/python/gen/CHIPClusters.h b/src/controller/python/gen/CHIPClusters.h index 8b9bbc2de89127..0639794a52d6cc 100644 --- a/src/controller/python/gen/CHIPClusters.h +++ b/src/controller/python/gen/CHIPClusters.h @@ -56,6 +56,7 @@ constexpr ClusterId kSwitchClusterId = 0x003B; constexpr ClusterId kTvChannelClusterId = 0x0504; constexpr ClusterId kTargetNavigatorClusterId = 0x0505; constexpr ClusterId kTemperatureMeasurementClusterId = 0x0402; +constexpr ClusterId kTestClusterClusterId = 0x050F; constexpr ClusterId kThermostatClusterId = 0x0201; constexpr ClusterId kWakeOnLanClusterId = 0x0503; constexpr ClusterId kWindowCoveringClusterId = 0x0102; @@ -979,6 +980,76 @@ class DLL_EXPORT TemperatureMeasurementCluster : public ClusterBase CHIP_ERROR ReportAttributeMeasuredValue(Callback::Cancelable * onReportCallback); }; +class DLL_EXPORT TestClusterCluster : public ClusterBase +{ +public: + TestClusterCluster() : ClusterBase(kTestClusterClusterId) {} + ~TestClusterCluster() {} + + // Cluster Commands + CHIP_ERROR Test(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR TestNotHandled(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR TestSpecific(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + + // Cluster Attributes + CHIP_ERROR DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeBoolean(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeBitmap8(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeBitmap16(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeBitmap32(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeBitmap64(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeInt8u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeInt16u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeInt32u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeInt64u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeInt8s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeInt16s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeInt32s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeInt64s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeEnum8(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeEnum16(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeOctetString(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeListInt8u(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); + CHIP_ERROR WriteAttributeBitmap8(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t value); + CHIP_ERROR WriteAttributeBitmap16(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t value); + CHIP_ERROR WriteAttributeBitmap32(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint32_t value); + CHIP_ERROR WriteAttributeBitmap64(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint64_t value); + CHIP_ERROR WriteAttributeInt8u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t value); + CHIP_ERROR WriteAttributeInt16u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t value); + CHIP_ERROR WriteAttributeInt32u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint32_t value); + CHIP_ERROR WriteAttributeInt64u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint64_t value); + CHIP_ERROR WriteAttributeInt8s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + int8_t value); + CHIP_ERROR WriteAttributeInt16s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + int16_t value); + CHIP_ERROR WriteAttributeInt32s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + int32_t value); + CHIP_ERROR WriteAttributeInt64s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + int64_t value); + CHIP_ERROR WriteAttributeEnum8(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t value); + CHIP_ERROR WriteAttributeEnum16(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t value); + CHIP_ERROR WriteAttributeOctetString(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + chip::ByteSpan value); + +private: + static constexpr CommandId kTestCommandId = 0x00; + static constexpr CommandId kTestNotHandledCommandId = 0x01; + static constexpr CommandId kTestSpecificCommandId = 0x02; +}; + class DLL_EXPORT ThermostatCluster : public ClusterBase { public: diff --git a/src/controller/python/gen/CHIPClustersObjc.h b/src/controller/python/gen/CHIPClustersObjc.h index f8f112a2baa762..e099d7c65f431a 100644 --- a/src/controller/python/gen/CHIPClustersObjc.h +++ b/src/controller/python/gen/CHIPClustersObjc.h @@ -827,6 +827,53 @@ NS_ASSUME_NONNULL_BEGIN @end +/** + * Cluster Test Cluster + * + */ +@interface CHIPTestCluster : CHIPCluster + +- (void)test:(ResponseHandler)completionHandler; +- (void)testNotHandled:(ResponseHandler)completionHandler; +- (void)testSpecific:(ResponseHandler)completionHandler; + +- (void)readAttributeBoolean:(ResponseHandler)completionHandler; +- (void)writeAttributeBoolean:(uint8_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeBitmap8:(ResponseHandler)completionHandler; +- (void)writeAttributeBitmap8:(uint8_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeBitmap16:(ResponseHandler)completionHandler; +- (void)writeAttributeBitmap16:(uint16_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeBitmap32:(ResponseHandler)completionHandler; +- (void)writeAttributeBitmap32:(uint32_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeBitmap64:(ResponseHandler)completionHandler; +- (void)writeAttributeBitmap64:(uint64_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeInt8u:(ResponseHandler)completionHandler; +- (void)writeAttributeInt8u:(uint8_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeInt16u:(ResponseHandler)completionHandler; +- (void)writeAttributeInt16u:(uint16_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeInt32u:(ResponseHandler)completionHandler; +- (void)writeAttributeInt32u:(uint32_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeInt64u:(ResponseHandler)completionHandler; +- (void)writeAttributeInt64u:(uint64_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeInt8s:(ResponseHandler)completionHandler; +- (void)writeAttributeInt8s:(int8_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeInt16s:(ResponseHandler)completionHandler; +- (void)writeAttributeInt16s:(int16_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeInt32s:(ResponseHandler)completionHandler; +- (void)writeAttributeInt32s:(int32_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeInt64s:(ResponseHandler)completionHandler; +- (void)writeAttributeInt64s:(int64_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeEnum8:(ResponseHandler)completionHandler; +- (void)writeAttributeEnum8:(uint8_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeEnum16:(ResponseHandler)completionHandler; +- (void)writeAttributeEnum16:(uint16_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeOctetString:(ResponseHandler)completionHandler; +- (void)writeAttributeOctetString:(NSData *)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeListInt8u:(ResponseHandler)completionHandler; +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler; + +@end + /** * Cluster Thermostat * diff --git a/src/controller/python/gen/CHIPClustersObjc.mm b/src/controller/python/gen/CHIPClustersObjc.mm index b3cb96342b06a7..131bc5900f3a16 100644 --- a/src/controller/python/gen/CHIPClustersObjc.mm +++ b/src/controller/python/gen/CHIPClustersObjc.mm @@ -259,6 +259,38 @@ static void CallbackFn(void * context, uint16_t value) bool mKeepAlive; }; +class CHIPInt16sAttributeCallbackBridge : public Callback::Callback { +public: + CHIPInt16sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + , mKeepAlive(keepAlive) + { + } + + ~CHIPInt16sAttributeCallbackBridge() {}; + + static void CallbackFn(void * context, int16_t value) + { + CHIPInt16sAttributeCallbackBridge * callback = reinterpret_cast(context); + if (callback && callback->mQueue) { + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { @"value" : [NSNumber numberWithShort:value] }); + if (!callback->mKeepAlive) { + callback->Cancel(); + delete callback; + } + }); + } + }; + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; + bool mKeepAlive; +}; + class CHIPInt32uAttributeCallbackBridge : public Callback::Callback { public: CHIPInt32uAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false) @@ -291,6 +323,38 @@ static void CallbackFn(void * context, uint32_t value) bool mKeepAlive; }; +class CHIPInt32sAttributeCallbackBridge : public Callback::Callback { +public: + CHIPInt32sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + , mKeepAlive(keepAlive) + { + } + + ~CHIPInt32sAttributeCallbackBridge() {}; + + static void CallbackFn(void * context, int32_t value) + { + CHIPInt32sAttributeCallbackBridge * callback = reinterpret_cast(context); + if (callback && callback->mQueue) { + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { @"value" : [NSNumber numberWithLong:value] }); + if (!callback->mKeepAlive) { + callback->Cancel(); + delete callback; + } + }); + } + }; + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; + bool mKeepAlive; +}; + class CHIPInt64uAttributeCallbackBridge : public Callback::Callback { public: CHIPInt64uAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false) @@ -323,24 +387,24 @@ static void CallbackFn(void * context, uint64_t value) bool mKeepAlive; }; -class CHIPInt16sAttributeCallbackBridge : public Callback::Callback { +class CHIPInt64sAttributeCallbackBridge : public Callback::Callback { public: - CHIPInt16sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false) - : Callback::Callback(CallbackFn, this) + CHIPInt64sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false) + : Callback::Callback(CallbackFn, this) , mHandler(handler) , mQueue(queue) , mKeepAlive(keepAlive) { } - ~CHIPInt16sAttributeCallbackBridge() {}; + ~CHIPInt64sAttributeCallbackBridge() {}; - static void CallbackFn(void * context, int16_t value) + static void CallbackFn(void * context, int64_t value) { - CHIPInt16sAttributeCallbackBridge * callback = reinterpret_cast(context); + CHIPInt64sAttributeCallbackBridge * callback = reinterpret_cast(context); if (callback && callback->mQueue) { dispatch_async(callback->mQueue, ^{ - callback->mHandler(nil, @ { @"value" : [NSNumber numberWithShort:value] }); + callback->mHandler(nil, @ { @"value" : [NSNumber numberWithLongLong:value] }); if (!callback->mKeepAlive) { callback->Cancel(); delete callback; @@ -2419,6 +2483,38 @@ static void CallbackFn(void * context, uint8_t * data) dispatch_queue_t mQueue; }; +class CHIPTestClusterClusterTestSpecificResponseCallbackBridge + : public Callback::Callback { +public: + CHIPTestClusterClusterTestSpecificResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPTestClusterClusterTestSpecificResponseCallbackBridge() {}; + + static void CallbackFn(void * context, uint8_t returnValue) + { + CHIPTestClusterClusterTestSpecificResponseCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { + @"returnValue" : [NSNumber numberWithUnsignedChar:returnValue], + }); + callback->Cancel(); + delete callback; + }); + } + }; + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + class CHIPDescriptorDeviceListAttributeCallbackBridge : public Callback::Callback { public: CHIPDescriptorDeviceListAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) @@ -2680,6 +2776,41 @@ static void CallbackFn(void * context, uint16_t count, _FabricDescriptor * entri dispatch_queue_t mQueue; }; +class CHIPTestClusterListInt8uAttributeCallbackBridge : public Callback::Callback { +public: + CHIPTestClusterListInt8uAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPTestClusterListInt8uAttributeCallbackBridge() {}; + + static void CallbackFn(void * context, uint16_t count, uint8_t * entries) + { + CHIPTestClusterListInt8uAttributeCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + id values[count]; + for (uint16_t i = 0; i < count; i++) { + values[i] = [NSNumber numberWithUnsignedChar:entries[i]]; + } + + id array = [NSArray arrayWithObjects:values count:count]; + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { @"value" : array }); + callback->Cancel(); + delete callback; + }); + } + } + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + @interface CHIPCluster () @property (readonly, nonatomic) dispatch_queue_t callbackQueue; @property (readonly, nonatomic) dispatch_queue_t chipWorkQueue; @@ -11433,6 +11564,1021 @@ - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler @end +@interface CHIPTestCluster () +@property (readonly) Controller::TestClusterCluster cppCluster; +@end + +@implementation CHIPTestCluster + +- (Controller::ClusterBase *)getCluster +{ + return &_cppCluster; +} + +- (void)test:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.Test(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)testNotHandled:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.TestNotHandled(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)testSpecific:(ResponseHandler)completionHandler +{ + CHIPTestClusterClusterTestSpecificResponseCallbackBridge * onSuccess + = new CHIPTestClusterClusterTestSpecificResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.TestSpecific(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeBoolean:(ResponseHandler)completionHandler +{ + CHIPBooleanAttributeCallbackBridge * onSuccess + = new CHIPBooleanAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeBoolean(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeBoolean:(uint8_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeBoolean(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeBitmap8:(ResponseHandler)completionHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeBitmap8(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeBitmap8:(uint8_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeBitmap8(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeBitmap16:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeBitmap16(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeBitmap16:(uint16_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeBitmap16(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeBitmap32:(ResponseHandler)completionHandler +{ + CHIPInt32uAttributeCallbackBridge * onSuccess = new CHIPInt32uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeBitmap32(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeBitmap32:(uint32_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeBitmap32(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeBitmap64:(ResponseHandler)completionHandler +{ + CHIPInt64uAttributeCallbackBridge * onSuccess = new CHIPInt64uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeBitmap64(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeBitmap64:(uint64_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeBitmap64(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeInt8u:(ResponseHandler)completionHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeInt8u(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeInt8u:(uint8_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeInt8u(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeInt16u:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeInt16u(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeInt16u:(uint16_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeInt16u(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeInt32u:(ResponseHandler)completionHandler +{ + CHIPInt32uAttributeCallbackBridge * onSuccess = new CHIPInt32uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeInt32u(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeInt32u:(uint32_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeInt32u(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeInt64u:(ResponseHandler)completionHandler +{ + CHIPInt64uAttributeCallbackBridge * onSuccess = new CHIPInt64uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeInt64u(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeInt64u:(uint64_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeInt64u(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeInt8s:(ResponseHandler)completionHandler +{ + CHIPInt8sAttributeCallbackBridge * onSuccess = new CHIPInt8sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeInt8s(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeInt8s:(int8_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeInt8s(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeInt16s:(ResponseHandler)completionHandler +{ + CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeInt16s(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeInt16s:(int16_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeInt16s(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeInt32s:(ResponseHandler)completionHandler +{ + CHIPInt32sAttributeCallbackBridge * onSuccess = new CHIPInt32sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeInt32s(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeInt32s:(int32_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeInt32s(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeInt64s:(ResponseHandler)completionHandler +{ + CHIPInt64sAttributeCallbackBridge * onSuccess = new CHIPInt64sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeInt64s(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeInt64s:(int64_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeInt64s(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeEnum8:(ResponseHandler)completionHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeEnum8(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeEnum8:(uint8_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeEnum8(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeEnum16:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeEnum16(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeEnum16:(uint16_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeEnum16(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeOctetString:(ResponseHandler)completionHandler +{ + CHIPStringAttributeCallbackBridge * onSuccess + = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], true); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeOctetString(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeOctetString:(NSData *)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeOctetString( + onSuccess->Cancel(), onFailure->Cancel(), chip::ByteSpan((const uint8_t *) value.bytes, value.length)); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeListInt8u:(ResponseHandler)completionHandler +{ + CHIPTestClusterListInt8uAttributeCallbackBridge * onSuccess + = new CHIPTestClusterListInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeListInt8u(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +@end + @interface CHIPThermostat () @property (readonly) Controller::ThermostatCluster cppCluster; @end diff --git a/src/controller/python/gen/IMClusterCommandHandler.cpp b/src/controller/python/gen/IMClusterCommandHandler.cpp index 67a1ba05e47c91..5e52280a1eba6e 100644 --- a/src/controller/python/gen/IMClusterCommandHandler.cpp +++ b/src/controller/python/gen/IMClusterCommandHandler.cpp @@ -5744,6 +5744,93 @@ void DispatchClientCommand(app::Command * apCommandObj, CommandId aCommandId, En } // namespace TargetNavigator +namespace TestCluster { + +void DispatchClientCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) +{ + { + switch (aCommandId) + { + case ZCL_TEST_SPECIFIC_RESPONSE_COMMAND_ID: { + // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV + // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. + // Any error value TLVUnpackError means we have received an illegal value. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t returnValue; + bool returnValueExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(aDataTlv.GetTag())) + { + case 0: + if (returnValueExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(returnValue); + if (CHIP_NO_ERROR == TLVUnpackError) + { + returnValueExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(aDataTlv.GetTag()), TLVUnpackError); + break; + } + } + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfTestClusterClusterTestSpecificResponseCallback(apCommandObj, returnValue); + } + else + { + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kBadRequest, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogProgress( + Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, + 1, validArgumentCount, TLVError, TLVUnpackError); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_TEST_CLUSTER_ID); + break; + } + } + } +} + +} // namespace TestCluster + } // namespace clusters void DispatchSingleClusterCommand(chip::ClusterId aClusterId, chip::CommandId aCommandId, chip::EndpointId aEndPointId, diff --git a/src/controller/python/gen/attribute-id.h b/src/controller/python/gen/attribute-id.h index 8e7aa393464caf..e4691450f06d9c 100644 --- a/src/controller/python/gen/attribute-id.h +++ b/src/controller/python/gen/attribute-id.h @@ -1240,6 +1240,29 @@ // Server attributes +// Attribute ids for cluster: Test Cluster + +// Client attributes + +// Server attributes +#define ZCL_BOOLEAN_ATTRIBUTE_ID (0x0000) +#define ZCL_BITMAP8_ATTRIBUTE_ID (0x0001) +#define ZCL_BITMAP16_ATTRIBUTE_ID (0x0002) +#define ZCL_BITMAP32_ATTRIBUTE_ID (0x0003) +#define ZCL_BITMAP64_ATTRIBUTE_ID (0x0004) +#define ZCL_INT8_U_ATTRIBUTE_ID (0x0005) +#define ZCL_INT16_U_ATTRIBUTE_ID (0x0006) +#define ZCL_INT32_U_ATTRIBUTE_ID (0x0008) +#define ZCL_INT64_U_ATTRIBUTE_ID (0x000C) +#define ZCL_INT8_S_ATTRIBUTE_ID (0x000D) +#define ZCL_INT16_S_ATTRIBUTE_ID (0x000E) +#define ZCL_INT32_S_ATTRIBUTE_ID (0x0010) +#define ZCL_INT64_S_ATTRIBUTE_ID (0x0014) +#define ZCL_ENUM8_ATTRIBUTE_ID (0x0015) +#define ZCL_ENUM16_ATTRIBUTE_ID (0x0016) +#define ZCL_OCTET_STRING_ATTRIBUTE_ID (0x0019) +#define ZCL_LIST_ATTRIBUTE_ID (0x001A) + // Attribute ids for cluster: Generic Tunnel // Client attributes diff --git a/src/controller/python/gen/call-command-handler.cpp b/src/controller/python/gen/call-command-handler.cpp index 73e9df19068857..9f4438c1700029 100644 --- a/src/controller/python/gen/call-command-handler.cpp +++ b/src/controller/python/gen/call-command-handler.cpp @@ -57,6 +57,7 @@ EmberAfStatus emberAfSwitchClusterClientCommandParse(EmberAfClusterCommand * cmd EmberAfStatus emberAfTvChannelClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfTargetNavigatorClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfTemperatureMeasurementClusterClientCommandParse(EmberAfClusterCommand * cmd); +EmberAfStatus emberAfTestClusterClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfThermostatClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfWakeOnLanClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfWindowCoveringClusterClientCommandParse(EmberAfClusterCommand * cmd); @@ -192,6 +193,9 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd) // No commands are enabled for cluster Temperature Measurement result = status(false, true, cmd->mfgSpecific); break; + case ZCL_TEST_CLUSTER_ID: + result = emberAfTestClusterClusterClientCommandParse(cmd); + break; case ZCL_THERMOSTAT_CLUSTER_ID: // No commands are enabled for cluster Thermostat result = status(false, true, cmd->mfgSpecific); @@ -1772,3 +1776,32 @@ EmberAfStatus emberAfTargetNavigatorClusterClientCommandParse(EmberAfClusterComm } return status(wasHandled, true, cmd->mfgSpecific); } +EmberAfStatus emberAfTestClusterClusterClientCommandParse(EmberAfClusterCommand * cmd) +{ + bool wasHandled = false; + + if (!cmd->mfgSpecific) + { + switch (cmd->commandId) + { + case ZCL_TEST_SPECIFIC_RESPONSE_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t returnValue; + + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + returnValue = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfTestClusterClusterTestSpecificResponseCallback(nullptr, returnValue); + break; + } + default: { + // Unrecognized command ID, error status will apply. + break; + } + } + } + return status(wasHandled, true, cmd->mfgSpecific); +} diff --git a/src/controller/python/gen/callback-stub.cpp b/src/controller/python/gen/callback-stub.cpp index 9ebbcf0a7d606f..857fb342e54abf 100644 --- a/src/controller/python/gen/callback-stub.cpp +++ b/src/controller/python/gen/callback-stub.cpp @@ -116,6 +116,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case ZCL_TEMP_MEASUREMENT_CLUSTER_ID: emberAfTemperatureMeasurementClusterInitCallback(endpoint); break; + case ZCL_TEST_CLUSTER_ID: + emberAfTestClusterClusterInitCallback(endpoint); + break; case ZCL_THERMOSTAT_CLUSTER_ID: emberAfThermostatClusterInitCallback(endpoint); break; @@ -276,6 +279,11 @@ void __attribute__((weak)) emberAfTemperatureMeasurementClusterInitCallback(Endp // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfTestClusterClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfThermostatClusterInitCallback(EndpointId endpoint) { // To prevent warning diff --git a/src/controller/python/gen/callback.h b/src/controller/python/gen/callback.h index 17c89be4d98fc7..5f3c5701391605 100644 --- a/src/controller/python/gen/callback.h +++ b/src/controller/python/gen/callback.h @@ -272,6 +272,14 @@ void emberAfTargetNavigatorClusterInitCallback(chip::EndpointId endpoint); */ void emberAfTemperatureMeasurementClusterInitCallback(chip::EndpointId endpoint); +/** @brief Test Cluster Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfTestClusterClusterInitCallback(chip::EndpointId endpoint); + /** @brief Thermostat Cluster Init * * Cluster Init @@ -2335,6 +2343,76 @@ EmberAfStatus emberAfTemperatureMeasurementClusterClientPreAttributeChangedCallb */ void emberAfTemperatureMeasurementClusterClientTickCallback(chip::EndpointId endpoint); +// +// Test Cluster Cluster client +// + +/** @brief Test Cluster Cluster Client Init + * + * Client Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfTestClusterClusterClientInitCallback(chip::EndpointId endpoint); + +/** @brief Test Cluster Cluster Client Attribute Changed + * + * Client Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + */ +void emberAfTestClusterClusterClientAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); + +/** @brief Test Cluster Cluster Client Manufacturer Specific Attribute Changed + * + * Client Manufacturer Specific Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + * @param manufacturerCode Manufacturer Code of the attribute that changed + */ +void emberAfTestClusterClusterClientManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + uint16_t manufacturerCode); + +/** @brief Test Cluster Cluster Client Message Sent + * + * Client Message Sent + * + * @param type The type of message sent + * @param indexOrDestination The destination or address to which the message was sent + * @param apsFrame The APS frame for the message + * @param msgLen The length of the message + * @param message The message that was sent + * @param status The status of the sent message + */ +void emberAfTestClusterClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, + EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, + EmberStatus status); + +/** @brief Test Cluster Cluster Client Pre Attribute Changed + * + * client Pre Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +EmberAfStatus emberAfTestClusterClusterClientPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, + EmberAfAttributeType attributeType, uint8_t size, + uint8_t * value); + +/** @brief Test Cluster Cluster Client Tick + * + * client Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfTestClusterClusterClientTickCallback(chip::EndpointId endpoint); + // // Thermostat Cluster client // @@ -3099,6 +3177,13 @@ bool emberAfTvChannelClusterChangeChannelResponseCallback(chip::app::Command * c bool emberAfTargetNavigatorClusterNavigateTargetResponseCallback(chip::app::Command * commandObj, uint8_t status, uint8_t * data); +/** + * @brief Test Cluster Cluster TestSpecificResponse Command callback + * @param returnValue + */ + +bool emberAfTestClusterClusterTestSpecificResponseCallback(chip::app::Command * commandObj, uint8_t returnValue); + // // Non-Cluster Related Callbacks // diff --git a/src/controller/python/gen/client-command-macro.h b/src/controller/python/gen/client-command-macro.h index 1cfc06d80ce7c2..c8666bc5678d12 100644 --- a/src/controller/python/gen/client-command-macro.h +++ b/src/controller/python/gen/client-command-macro.h @@ -3629,6 +3629,34 @@ \ ZCL_LOGIN_COMMAND_ID, "uu", tempAccountIdentifier, setupPIN); +/** @brief Command description for Test + * + * Command: Test + * @param returnValue INT8U + */ +#define emberAfFillCommandTest \ + ClusterClusterTest(returnValue) emberAfFillExternalBuffer(mask, \ + \ + ZCL_TEST_COMMAND_ID, "u", returnValue); + +/** @brief Command description for TestNotHandled + * + * Command: TestNotHandled + */ +#define emberAfFillCommandTest \ + ClusterClusterTestNotHandled() emberAfFillExternalBuffer(mask, \ + \ + ZCL_TEST_NOT_HANDLED_COMMAND_ID, "", ); + +/** @brief Command description for TestSpecific + * + * Command: TestSpecific + */ +#define emberAfFillCommandTest \ + ClusterClusterTestSpecific() emberAfFillExternalBuffer(mask, \ + \ + ZCL_TEST_SPECIFIC_COMMAND_ID, "", ); + /** @brief Command description for MatchProtocolAddress * * Command: MatchProtocolAddress diff --git a/src/controller/python/gen/cluster-id.h b/src/controller/python/gen/cluster-id.h index b8d9a9f7ed09bf..7f71ea5976846c 100644 --- a/src/controller/python/gen/cluster-id.h +++ b/src/controller/python/gen/cluster-id.h @@ -293,6 +293,9 @@ // Definitions for cluster: Account Login #define ZCL_ACCOUNT_LOGIN_CLUSTER_ID (0x050E) +// Definitions for cluster: Test Cluster +#define ZCL_TEST_CLUSTER_ID (0x050F) + // Definitions for cluster: Generic Tunnel #define ZCL_GENERIC_TUNNEL_CLUSTER_ID (0x0600) diff --git a/src/controller/python/gen/command-id.h b/src/controller/python/gen/command-id.h index 25ee08826f030c..8e97e911e0a423 100644 --- a/src/controller/python/gen/command-id.h +++ b/src/controller/python/gen/command-id.h @@ -470,6 +470,12 @@ #define ZCL_GET_SETUP_PIN_RESPONSE_COMMAND_ID (0x00) #define ZCL_LOGIN_COMMAND_ID (0x01) +// Commands for cluster: Test Cluster +#define ZCL_TEST_COMMAND_ID (0x00) +#define ZCL_TEST_SPECIFIC_RESPONSE_COMMAND_ID (0x00) +#define ZCL_TEST_NOT_HANDLED_COMMAND_ID (0x01) +#define ZCL_TEST_SPECIFIC_COMMAND_ID (0x02) + // Commands for cluster: Generic Tunnel #define ZCL_MATCH_PROTOCOL_ADDRESS_COMMAND_ID (0x00) #define ZCL_MATCH_PROTOCOL_ADDRESS_RESPONSE_COMMAND_ID (0x00) diff --git a/src/controller/python/gen/endpoint_config.h b/src/controller/python/gen/endpoint_config.h index 57dd0d20ae339f..79ba2a6aca84ac 100644 --- a/src/controller/python/gen/endpoint_config.h +++ b/src/controller/python/gen/endpoint_config.h @@ -63,7 +63,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 32 +#define GENERATED_ATTRIBUTE_COUNT 33 #define GENERATED_ATTRIBUTES \ { \ \ @@ -156,6 +156,9 @@ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ /* Endpoint: 1, Cluster: Account Login (client) */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ + \ + /* Endpoint: 1, Cluster: Test Cluster (client) */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ /* Endpoint: 1, Cluster: Binding (client) */ \ @@ -172,7 +175,7 @@ #define GENERATED_FUNCTION_ARRAYS #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask -#define GENERATED_CLUSTER_COUNT 32 +#define GENERATED_CLUSTER_COUNT 33 #define GENERATED_CLUSTERS \ { \ { 0x0003, ZAP_ATTRIBUTE_INDEX(0), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Identify (client) */ \ @@ -254,10 +257,13 @@ 0x050E, ZAP_ATTRIBUTE_INDEX(29), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Account Login (client) */ \ { \ - 0xF000, ZAP_ATTRIBUTE_INDEX(30), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x050F, ZAP_ATTRIBUTE_INDEX(30), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + }, /* Endpoint: 1, Cluster: Test Cluster (client) */ \ + { \ + 0xF000, ZAP_ATTRIBUTE_INDEX(31), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Binding (client) */ \ { \ - 0xF004, ZAP_ATTRIBUTE_INDEX(31), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0xF004, ZAP_ATTRIBUTE_INDEX(32), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Group Key Management (client) */ \ } @@ -266,7 +272,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 32, 64 }, \ + { ZAP_CLUSTER_INDEX(0), 33, 66 }, \ } // Largest attribute size is needed for various buffers @@ -276,7 +282,7 @@ #define ATTRIBUTE_SINGLETONS_SIZE (2) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (64) +#define ATTRIBUTE_MAX_SIZE (66) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (1) @@ -320,7 +326,7 @@ // Array of EmberAfCommandMetadata structs. #define ZAP_COMMAND_MASK(mask) COMMAND_MASK_##mask -#define EMBER_AF_GENERATED_COMMAND_COUNT (194) +#define EMBER_AF_GENERATED_COMMAND_COUNT (198) #define GENERATED_COMMANDS \ { \ \ @@ -575,6 +581,12 @@ { 0x050E, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* GetSetupPINResponse */ \ { 0x050E, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Login */ \ \ + /* Endpoint: 1, Cluster: Test Cluster (client) */ \ + { 0x050F, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Test */ \ + { 0x050F, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* TestSpecificResponse */ \ + { 0x050F, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* TestNotHandled */ \ + { 0x050F, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* TestSpecific */ \ + \ /* Endpoint: 1, Cluster: Binding (client) */ \ { 0xF000, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Bind */ \ { 0xF000, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Unbind */ \ diff --git a/src/controller/python/gen/gen_config.h b/src/controller/python/gen/gen_config.h index ffc44e1bcc0f80..49990103d919cb 100644 --- a/src/controller/python/gen/gen_config.h +++ b/src/controller/python/gen/gen_config.h @@ -58,6 +58,7 @@ #define EMBER_AF_TV_CHANNEL_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_TARGET_NAVIGATOR_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_TEMP_MEASUREMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_TEST_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_THERMOSTAT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_WAKE_ON_LAN_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_WINDOW_COVERING_CLUSTER_CLIENT_ENDPOINT_COUNT (1) @@ -180,6 +181,10 @@ #define ZCL_USING_TEMP_MEASUREMENT_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_TEMPERATURE_MEASUREMENT_CLIENT +// Use this macro to check if the client side of the Test Cluster cluster is included +#define ZCL_USING_TEST_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_TEST_CLUSTER_CLIENT + // Use this macro to check if the client side of the Thermostat cluster is included #define ZCL_USING_THERMOSTAT_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_THERMOSTAT_CLIENT diff --git a/src/controller/python/gen/print-cluster.h b/src/controller/python/gen/print-cluster.h index 9c879d94a9390d..886dad371554b7 100644 --- a/src/controller/python/gen/print-cluster.h +++ b/src/controller/python/gen/print-cluster.h @@ -634,6 +634,12 @@ #define CHIP_PRINTCLUSTER_ACCOUNT_LOGIN_CLUSTER #endif +#if defined(ZCL_USING_TEST_CLUSTER_SERVER) || defined(ZCL_USING_TEST_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_TEST_CLUSTER { ZCL_TEST_CLUSTER_ID, 1295, "Test Cluster" }, +#else +#define CHIP_PRINTCLUSTER_TEST_CLUSTER +#endif + #if defined(ZCL_USING_GENERIC_TUNNEL_CLUSTER_SERVER) || defined(ZCL_USING_GENERIC_TUNNEL_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_GENERIC_TUNNEL_CLUSTER { ZCL_GENERIC_TUNNEL_CLUSTER_ID, 1536, "Generic Tunnel" }, #else @@ -965,6 +971,7 @@ CHIP_PRINTCLUSTER_APPLICATION_LAUNCHER_CLUSTER \ CHIP_PRINTCLUSTER_APPLICATION_BASIC_CLUSTER \ CHIP_PRINTCLUSTER_ACCOUNT_LOGIN_CLUSTER \ + CHIP_PRINTCLUSTER_TEST_CLUSTER \ CHIP_PRINTCLUSTER_GENERIC_TUNNEL_CLUSTER \ CHIP_PRINTCLUSTER_BACNET_PROTOCOL_TUNNEL_CLUSTER \ CHIP_PRINTCLUSTER_11073_PROTOCOL_TUNNEL_CLUSTER \ diff --git a/src/controller/python/local-clusters.zap b/src/controller/python/local-clusters.zap index 0b5717d0c4a3e5..0b072d62b5b24b 100644 --- a/src/controller/python/local-clusters.zap +++ b/src/controller/python/local-clusters.zap @@ -5770,6 +5770,347 @@ } ] }, + { + "name": "Test Cluster", + "code": 1295, + "mfgCode": null, + "define": "TEST_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [ + { + "name": "Test", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "TestNotHandled", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "TestSpecific", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Test Cluster", + "code": 1295, + "mfgCode": null, + "define": "TEST_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [ + { + "name": "TestSpecificResponse", + "code": 0, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 0 + } + ], + "attributes": [ + { + "name": "boolean", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "false", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "bitmap8", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "bitmap16", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "bitmap32", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "bitmap64", + "code": 4, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int8u", + "code": 5, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int16u", + "code": 6, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int32u", + "code": 8, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int64u", + "code": 12, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int8s", + "code": 13, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int16s", + "code": 14, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int32s", + "code": 16, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int64s", + "code": 20, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "enum8", + "code": 21, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "enum16", + "code": 22, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "octet_string", + "code": 25, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "list_int8u", + "code": 26, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, { "name": "Binding", "code": 61440, @@ -5936,4 +6277,4 @@ } ], "log": [] -} \ No newline at end of file +} diff --git a/src/darwin/Framework/CHIP/chip-tool.zap b/src/darwin/Framework/CHIP/chip-tool.zap index 81a5a29338aeae..5b4977e1735510 100644 --- a/src/darwin/Framework/CHIP/chip-tool.zap +++ b/src/darwin/Framework/CHIP/chip-tool.zap @@ -1,5 +1,5 @@ { - "featureLevel": 26, + "featureLevel": 29, "creator": "zap", "keyValuePairs": [ { @@ -18,13 +18,13 @@ "package": [ { "pathRelativity": "relativeToZap", - "path": "../../src/app/zap-templates/zcl/zcl.json", + "path": "../../../app/zap-templates/zcl/zcl.json", "version": "ZCL Test Data", "type": "zcl-properties" }, { "pathRelativity": "relativeToZap", - "path": "../../src/app/zap-templates/app-templates.json", + "path": "../../../app/zap-templates/app-templates.json", "version": "chip-v1", "type": "gen-templates-json" } @@ -4480,6 +4480,347 @@ } ] }, + { + "name": "Test Cluster", + "code": 1295, + "mfgCode": null, + "define": "TEST_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [ + { + "name": "Test", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "TestNotHandled", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "TestSpecific", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Test Cluster", + "code": 1295, + "mfgCode": null, + "define": "TEST_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [ + { + "name": "TestSpecificResponse", + "code": 0, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 0 + } + ], + "attributes": [ + { + "name": "boolean", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "false", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "bitmap8", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "bitmap16", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "bitmap32", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "bitmap64", + "code": 4, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int8u", + "code": 5, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int16u", + "code": 6, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int32u", + "code": 8, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int64u", + "code": 12, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int8s", + "code": 13, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int16s", + "code": 14, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int32s", + "code": 16, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "int64s", + "code": 20, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "enum8", + "code": 21, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "enum16", + "code": 22, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "octet_string", + "code": 25, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "list_int8u", + "code": 26, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, { "name": "Binding", "code": 61440, @@ -4640,8 +4981,10 @@ "endpointTypeIndex": 0, "profileId": "0x0103", "endpointId": 1, - "networkId": 0 + "networkId": 0, + "endpointVersion": null, + "deviceIdentifier": null } ], "log": [] -} \ No newline at end of file +} diff --git a/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.cpp b/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.cpp index 3e531c9fa498fc..64caca3e311ade 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.cpp +++ b/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.cpp @@ -506,6 +506,26 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag } } break; + case 0x050F: + switch (attributeId) + { + case 0x001A: // INT8U + { + uint8_t data[count]; + for (size_t i = 0; i < count; i++) + { + data[i] = emberAfGetInt8u(message, 0, messageLen); + message += 1; + CHECK_MESSAGE_LENGTH(1); + } + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, count, data); + break; + } + } + break; } break; } @@ -1785,6 +1805,19 @@ bool emberAfScenesClusterViewSceneResponseCallback(chip::app::Command * commandO return true; } +bool emberAfTestClusterClusterTestSpecificResponseCallback(chip::app::Command * commandObj, uint8_t returnValue) +{ + ChipLogProgress(Zcl, "TestSpecificResponse:"); + ChipLogProgress(Zcl, " returnValue: %" PRIu8 "", returnValue); + + GET_RESPONSE_CALLBACKS("TestClusterClusterTestSpecificResponseCallback"); + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, returnValue); + return true; +} + bool emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * message, uint16_t messageLen) { ChipLogProgress(Zcl, "emberAfReportAttributeCallback:"); diff --git a/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.h b/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.h index 8bb5691a5e5d10..d2c56fe3e0efee 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.h +++ b/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.h @@ -105,6 +105,7 @@ typedef void (*ScenesClusterStoreSceneResponseCallback)(void * context, uint16_t typedef void (*ScenesClusterViewSceneResponseCallback)(void * context, uint16_t groupId, uint8_t sceneId, uint16_t transitionTime, uint8_t * sceneName, /* TYPE WARNING: array array defaults to */ uint8_t * extensionFieldSets); +typedef void (*TestClusterClusterTestSpecificResponseCallback)(void * context, uint8_t returnValue); // List specific responses typedef void (*DescriptorDeviceListListAttributeCallback)(void * context, uint16_t count, _DeviceType * entries); @@ -114,3 +115,4 @@ typedef void (*DescriptorPartsListListAttributeCallback)(void * context, uint16_ typedef void (*GroupKeyManagementGroupsListAttributeCallback)(void * context, uint16_t count, _GroupState * entries); typedef void (*GroupKeyManagementGroupKeysListAttributeCallback)(void * context, uint16_t count, _GroupKey * entries); typedef void (*OperationalCredentialsFabricsListListAttributeCallback)(void * context, uint16_t count, _FabricDescriptor * entries); +typedef void (*TestClusterListInt8uListAttributeCallback)(void * context, uint16_t count, uint8_t * entries); diff --git a/src/darwin/Framework/CHIP/gen/CHIPClusters.cpp b/src/darwin/Framework/CHIP/gen/CHIPClusters.cpp index a5db71393871a4..d2a3c21c50bdb1 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClusters.cpp +++ b/src/darwin/Framework/CHIP/gen/CHIPClusters.cpp @@ -4309,6 +4309,362 @@ CHIP_ERROR TemperatureMeasurementCluster::ReadAttributeClusterRevision(Callback: return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); } +// TestCluster Cluster Commands +CHIP_ERROR TestClusterCluster::Test(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kTestCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + // Command takes no arguments. + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterTestCommand(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + +CHIP_ERROR TestClusterCluster::TestNotHandled(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kTestNotHandledCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + // Command takes no arguments. + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterTestNotHandledCommand(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + +CHIP_ERROR TestClusterCluster::TestSpecific(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) +{ +#if CHIP_ENABLE_INTERACTION_MODEL + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + (void) onSuccessCallback; + (void) onFailureCallback; + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kTestSpecificCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + app::Command * ZCLcommand = mDevice->GetCommandSender(); + + ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams)); + + // Command takes no arguments. + + ReturnErrorOnFailure(ZCLcommand->FinishCommand()); + + return mDevice->SendCommands(); +#else + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterTestSpecificCommand(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +#endif +} + +// TestCluster Cluster Attributes +CHIP_ERROR TestClusterCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterDiscoverAttributes(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} +CHIP_ERROR TestClusterCluster::ReadAttributeBoolean(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadBooleanAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeBoolean(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint8_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteBooleanAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeBitmap8(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadBitmap8Attribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeBitmap8(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint8_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteBitmap8Attribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeBitmap16(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadBitmap16Attribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeBitmap16(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteBitmap16Attribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeBitmap32(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadBitmap32Attribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeBitmap32(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint32_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteBitmap32Attribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeBitmap64(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadBitmap64Attribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeBitmap64(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint64_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteBitmap64Attribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeInt8u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadInt8uAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeInt8u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint8_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteInt8uAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeInt16u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadInt16uAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeInt16u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteInt16uAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeInt32u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadInt32uAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeInt32u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint32_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteInt32uAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeInt64u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadInt64uAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeInt64u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint64_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteInt64uAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeInt8s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadInt8sAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeInt8s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, int8_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteInt8sAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeInt16s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadInt16sAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeInt16s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, int16_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteInt16sAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeInt32s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadInt32sAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeInt32s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, int32_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteInt32sAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeInt64s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadInt64sAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeInt64s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, int64_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteInt64sAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeEnum8(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadEnum8Attribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeEnum8(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint8_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteEnum8Attribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeEnum16(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadEnum16Attribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeEnum16(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteEnum16Attribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeOctetString(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadOctetStringAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeOctetString(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, chip::ByteSpan value) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterWriteOctetStringAttribute(seqNum, mEndpoint, value); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeListInt8u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadListInt8uAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeTestClusterClusterReadClusterRevisionAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + // Thermostat Cluster Commands CHIP_ERROR ThermostatCluster::ClearWeeklySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) diff --git a/src/darwin/Framework/CHIP/gen/CHIPClusters.h b/src/darwin/Framework/CHIP/gen/CHIPClusters.h index 751c92ab71403b..d2b819408e5deb 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClusters.h +++ b/src/darwin/Framework/CHIP/gen/CHIPClusters.h @@ -47,6 +47,7 @@ constexpr ClusterId kPumpConfigurationAndControlClusterId = 0x0200; constexpr ClusterId kScenesClusterId = 0x0005; constexpr ClusterId kSwitchClusterId = 0x003B; constexpr ClusterId kTemperatureMeasurementClusterId = 0x0402; +constexpr ClusterId kTestClusterClusterId = 0x050F; constexpr ClusterId kThermostatClusterId = 0x0201; class DLL_EXPORT ApplicationBasicCluster : public ClusterBase @@ -756,6 +757,76 @@ class DLL_EXPORT TemperatureMeasurementCluster : public ClusterBase CHIP_ERROR ReportAttributeMeasuredValue(Callback::Cancelable * onReportCallback); }; +class DLL_EXPORT TestClusterCluster : public ClusterBase +{ +public: + TestClusterCluster() : ClusterBase(kTestClusterClusterId) {} + ~TestClusterCluster() {} + + // Cluster Commands + CHIP_ERROR Test(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR TestNotHandled(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR TestSpecific(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + + // Cluster Attributes + CHIP_ERROR DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeBoolean(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeBitmap8(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeBitmap16(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeBitmap32(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeBitmap64(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeInt8u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeInt16u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeInt32u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeInt64u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeInt8s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeInt16s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeInt32s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeInt64s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeEnum8(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeEnum16(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeOctetString(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeListInt8u(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); + CHIP_ERROR WriteAttributeBitmap8(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t value); + CHIP_ERROR WriteAttributeBitmap16(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t value); + CHIP_ERROR WriteAttributeBitmap32(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint32_t value); + CHIP_ERROR WriteAttributeBitmap64(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint64_t value); + CHIP_ERROR WriteAttributeInt8u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t value); + CHIP_ERROR WriteAttributeInt16u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t value); + CHIP_ERROR WriteAttributeInt32u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint32_t value); + CHIP_ERROR WriteAttributeInt64u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint64_t value); + CHIP_ERROR WriteAttributeInt8s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + int8_t value); + CHIP_ERROR WriteAttributeInt16s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + int16_t value); + CHIP_ERROR WriteAttributeInt32s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + int32_t value); + CHIP_ERROR WriteAttributeInt64s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + int64_t value); + CHIP_ERROR WriteAttributeEnum8(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t value); + CHIP_ERROR WriteAttributeEnum16(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t value); + CHIP_ERROR WriteAttributeOctetString(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + chip::ByteSpan value); + +private: + static constexpr CommandId kTestCommandId = 0x00; + static constexpr CommandId kTestNotHandledCommandId = 0x01; + static constexpr CommandId kTestSpecificCommandId = 0x02; +}; + class DLL_EXPORT ThermostatCluster : public ClusterBase { public: diff --git a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h index c4ca0d9d92515b..a4519bdf6fb0c7 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h +++ b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h @@ -685,6 +685,53 @@ NS_ASSUME_NONNULL_BEGIN @end +/** + * Cluster Test Cluster + * + */ +@interface CHIPTestCluster : CHIPCluster + +- (void)test:(ResponseHandler)completionHandler; +- (void)testNotHandled:(ResponseHandler)completionHandler; +- (void)testSpecific:(ResponseHandler)completionHandler; + +- (void)readAttributeBoolean:(ResponseHandler)completionHandler; +- (void)writeAttributeBoolean:(uint8_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeBitmap8:(ResponseHandler)completionHandler; +- (void)writeAttributeBitmap8:(uint8_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeBitmap16:(ResponseHandler)completionHandler; +- (void)writeAttributeBitmap16:(uint16_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeBitmap32:(ResponseHandler)completionHandler; +- (void)writeAttributeBitmap32:(uint32_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeBitmap64:(ResponseHandler)completionHandler; +- (void)writeAttributeBitmap64:(uint64_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeInt8u:(ResponseHandler)completionHandler; +- (void)writeAttributeInt8u:(uint8_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeInt16u:(ResponseHandler)completionHandler; +- (void)writeAttributeInt16u:(uint16_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeInt32u:(ResponseHandler)completionHandler; +- (void)writeAttributeInt32u:(uint32_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeInt64u:(ResponseHandler)completionHandler; +- (void)writeAttributeInt64u:(uint64_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeInt8s:(ResponseHandler)completionHandler; +- (void)writeAttributeInt8s:(int8_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeInt16s:(ResponseHandler)completionHandler; +- (void)writeAttributeInt16s:(int16_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeInt32s:(ResponseHandler)completionHandler; +- (void)writeAttributeInt32s:(int32_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeInt64s:(ResponseHandler)completionHandler; +- (void)writeAttributeInt64s:(int64_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeEnum8:(ResponseHandler)completionHandler; +- (void)writeAttributeEnum8:(uint8_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeEnum16:(ResponseHandler)completionHandler; +- (void)writeAttributeEnum16:(uint16_t)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeOctetString:(ResponseHandler)completionHandler; +- (void)writeAttributeOctetString:(NSData *)value completionHandler:(ResponseHandler)completionHandler; +- (void)readAttributeListInt8u:(ResponseHandler)completionHandler; +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler; + +@end + /** * Cluster Thermostat * diff --git a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm index 7506e21b230198..ea1b7c2606ec06 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm @@ -259,6 +259,38 @@ static void CallbackFn(void * context, uint16_t value) bool mKeepAlive; }; +class CHIPInt16sAttributeCallbackBridge : public Callback::Callback { +public: + CHIPInt16sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + , mKeepAlive(keepAlive) + { + } + + ~CHIPInt16sAttributeCallbackBridge() {}; + + static void CallbackFn(void * context, int16_t value) + { + CHIPInt16sAttributeCallbackBridge * callback = reinterpret_cast(context); + if (callback && callback->mQueue) { + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { @"value" : [NSNumber numberWithShort:value] }); + if (!callback->mKeepAlive) { + callback->Cancel(); + delete callback; + } + }); + } + }; + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; + bool mKeepAlive; +}; + class CHIPInt32uAttributeCallbackBridge : public Callback::Callback { public: CHIPInt32uAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false) @@ -291,6 +323,38 @@ static void CallbackFn(void * context, uint32_t value) bool mKeepAlive; }; +class CHIPInt32sAttributeCallbackBridge : public Callback::Callback { +public: + CHIPInt32sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + , mKeepAlive(keepAlive) + { + } + + ~CHIPInt32sAttributeCallbackBridge() {}; + + static void CallbackFn(void * context, int32_t value) + { + CHIPInt32sAttributeCallbackBridge * callback = reinterpret_cast(context); + if (callback && callback->mQueue) { + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { @"value" : [NSNumber numberWithLong:value] }); + if (!callback->mKeepAlive) { + callback->Cancel(); + delete callback; + } + }); + } + }; + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; + bool mKeepAlive; +}; + class CHIPInt64uAttributeCallbackBridge : public Callback::Callback { public: CHIPInt64uAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false) @@ -323,24 +387,24 @@ static void CallbackFn(void * context, uint64_t value) bool mKeepAlive; }; -class CHIPInt16sAttributeCallbackBridge : public Callback::Callback { +class CHIPInt64sAttributeCallbackBridge : public Callback::Callback { public: - CHIPInt16sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false) - : Callback::Callback(CallbackFn, this) + CHIPInt64sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false) + : Callback::Callback(CallbackFn, this) , mHandler(handler) , mQueue(queue) , mKeepAlive(keepAlive) { } - ~CHIPInt16sAttributeCallbackBridge() {}; + ~CHIPInt64sAttributeCallbackBridge() {}; - static void CallbackFn(void * context, int16_t value) + static void CallbackFn(void * context, int64_t value) { - CHIPInt16sAttributeCallbackBridge * callback = reinterpret_cast(context); + CHIPInt64sAttributeCallbackBridge * callback = reinterpret_cast(context); if (callback && callback->mQueue) { dispatch_async(callback->mQueue, ^{ - callback->mHandler(nil, @ { @"value" : [NSNumber numberWithShort:value] }); + callback->mHandler(nil, @ { @"value" : [NSNumber numberWithLongLong:value] }); if (!callback->mKeepAlive) { callback->Cancel(); delete callback; @@ -1842,6 +1906,38 @@ static void CallbackFn(void * context, uint16_t groupId, uint8_t sceneId, uint16 dispatch_queue_t mQueue; }; +class CHIPTestClusterClusterTestSpecificResponseCallbackBridge + : public Callback::Callback { +public: + CHIPTestClusterClusterTestSpecificResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPTestClusterClusterTestSpecificResponseCallbackBridge() {}; + + static void CallbackFn(void * context, uint8_t returnValue) + { + CHIPTestClusterClusterTestSpecificResponseCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { + @"returnValue" : [NSNumber numberWithUnsignedChar:returnValue], + }); + callback->Cancel(); + delete callback; + }); + } + }; + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + class CHIPDescriptorDeviceListAttributeCallbackBridge : public Callback::Callback { public: CHIPDescriptorDeviceListAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) @@ -2103,6 +2199,41 @@ static void CallbackFn(void * context, uint16_t count, _FabricDescriptor * entri dispatch_queue_t mQueue; }; +class CHIPTestClusterListInt8uAttributeCallbackBridge : public Callback::Callback { +public: + CHIPTestClusterListInt8uAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPTestClusterListInt8uAttributeCallbackBridge() {}; + + static void CallbackFn(void * context, uint16_t count, uint8_t * entries) + { + CHIPTestClusterListInt8uAttributeCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + id values[count]; + for (uint16_t i = 0; i < count; i++) { + values[i] = [NSNumber numberWithUnsignedChar:entries[i]]; + } + + id array = [NSArray arrayWithObjects:values count:count]; + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { @"value" : array }); + callback->Cancel(); + delete callback; + }); + } + } + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + @interface CHIPCluster () @property (readonly, nonatomic) dispatch_queue_t callbackQueue; @property (readonly, nonatomic) dispatch_queue_t chipWorkQueue; @@ -9483,6 +9614,1021 @@ - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler @end +@interface CHIPTestCluster () +@property (readonly) Controller::TestClusterCluster cppCluster; +@end + +@implementation CHIPTestCluster + +- (Controller::ClusterBase *)getCluster +{ + return &_cppCluster; +} + +- (void)test:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.Test(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)testNotHandled:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.TestNotHandled(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)testSpecific:(ResponseHandler)completionHandler +{ + CHIPTestClusterClusterTestSpecificResponseCallbackBridge * onSuccess + = new CHIPTestClusterClusterTestSpecificResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.TestSpecific(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeBoolean:(ResponseHandler)completionHandler +{ + CHIPBooleanAttributeCallbackBridge * onSuccess + = new CHIPBooleanAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeBoolean(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeBoolean:(uint8_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeBoolean(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeBitmap8:(ResponseHandler)completionHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeBitmap8(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeBitmap8:(uint8_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeBitmap8(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeBitmap16:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeBitmap16(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeBitmap16:(uint16_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeBitmap16(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeBitmap32:(ResponseHandler)completionHandler +{ + CHIPInt32uAttributeCallbackBridge * onSuccess = new CHIPInt32uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeBitmap32(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeBitmap32:(uint32_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeBitmap32(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeBitmap64:(ResponseHandler)completionHandler +{ + CHIPInt64uAttributeCallbackBridge * onSuccess = new CHIPInt64uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeBitmap64(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeBitmap64:(uint64_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeBitmap64(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeInt8u:(ResponseHandler)completionHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeInt8u(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeInt8u:(uint8_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeInt8u(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeInt16u:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeInt16u(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeInt16u:(uint16_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeInt16u(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeInt32u:(ResponseHandler)completionHandler +{ + CHIPInt32uAttributeCallbackBridge * onSuccess = new CHIPInt32uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeInt32u(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeInt32u:(uint32_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeInt32u(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeInt64u:(ResponseHandler)completionHandler +{ + CHIPInt64uAttributeCallbackBridge * onSuccess = new CHIPInt64uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeInt64u(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeInt64u:(uint64_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeInt64u(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeInt8s:(ResponseHandler)completionHandler +{ + CHIPInt8sAttributeCallbackBridge * onSuccess = new CHIPInt8sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeInt8s(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeInt8s:(int8_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeInt8s(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeInt16s:(ResponseHandler)completionHandler +{ + CHIPInt16sAttributeCallbackBridge * onSuccess = new CHIPInt16sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeInt16s(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeInt16s:(int16_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeInt16s(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeInt32s:(ResponseHandler)completionHandler +{ + CHIPInt32sAttributeCallbackBridge * onSuccess = new CHIPInt32sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeInt32s(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeInt32s:(int32_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeInt32s(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeInt64s:(ResponseHandler)completionHandler +{ + CHIPInt64sAttributeCallbackBridge * onSuccess = new CHIPInt64sAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeInt64s(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeInt64s:(int64_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeInt64s(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeEnum8:(ResponseHandler)completionHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeEnum8(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeEnum8:(uint8_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeEnum8(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeEnum16:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeEnum16(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeEnum16:(uint16_t)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeEnum16(onSuccess->Cancel(), onFailure->Cancel(), value); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeOctetString:(ResponseHandler)completionHandler +{ + CHIPStringAttributeCallbackBridge * onSuccess + = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], true); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeOctetString(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)writeAttributeOctetString:(NSData *)value completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.WriteAttributeOctetString( + onSuccess->Cancel(), onFailure->Cancel(), chip::ByteSpan((const uint8_t *) value.bytes, value.length)); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeListInt8u:(ResponseHandler)completionHandler +{ + CHIPTestClusterListInt8uAttributeCallbackBridge * onSuccess + = new CHIPTestClusterListInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeListInt8u(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +@end + @interface CHIPThermostat () @property (readonly) Controller::ThermostatCluster cppCluster; @end diff --git a/src/darwin/Framework/CHIP/gen/IMClusterCommandHandler.cpp b/src/darwin/Framework/CHIP/gen/IMClusterCommandHandler.cpp index 934fb34f6b2abf..01f14340b6428e 100644 --- a/src/darwin/Framework/CHIP/gen/IMClusterCommandHandler.cpp +++ b/src/darwin/Framework/CHIP/gen/IMClusterCommandHandler.cpp @@ -4310,6 +4310,93 @@ void DispatchClientCommand(app::Command * apCommandObj, CommandId aCommandId, En } // namespace Scenes +namespace TestCluster { + +void DispatchClientCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) +{ + { + switch (aCommandId) + { + case ZCL_TEST_SPECIFIC_RESPONSE_COMMAND_ID: { + // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV + // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. + // Any error value TLVUnpackError means we have received an illegal value. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t returnValue; + bool returnValueExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(aDataTlv.GetTag())) + { + case 0: + if (returnValueExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(returnValue); + if (CHIP_NO_ERROR == TLVUnpackError) + { + returnValueExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(aDataTlv.GetTag()), TLVUnpackError); + break; + } + } + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfTestClusterClusterTestSpecificResponseCallback(apCommandObj, returnValue); + } + else + { + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kBadRequest, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogProgress( + Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, + 1, validArgumentCount, TLVError, TLVUnpackError); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_TEST_CLUSTER_ID); + break; + } + } + } +} + +} // namespace TestCluster + } // namespace clusters void DispatchSingleClusterCommand(chip::ClusterId aClusterId, chip::CommandId aCommandId, chip::EndpointId aEndPointId, diff --git a/src/darwin/Framework/CHIP/gen/attribute-id.h b/src/darwin/Framework/CHIP/gen/attribute-id.h index 8e7aa393464caf..e4691450f06d9c 100644 --- a/src/darwin/Framework/CHIP/gen/attribute-id.h +++ b/src/darwin/Framework/CHIP/gen/attribute-id.h @@ -1240,6 +1240,29 @@ // Server attributes +// Attribute ids for cluster: Test Cluster + +// Client attributes + +// Server attributes +#define ZCL_BOOLEAN_ATTRIBUTE_ID (0x0000) +#define ZCL_BITMAP8_ATTRIBUTE_ID (0x0001) +#define ZCL_BITMAP16_ATTRIBUTE_ID (0x0002) +#define ZCL_BITMAP32_ATTRIBUTE_ID (0x0003) +#define ZCL_BITMAP64_ATTRIBUTE_ID (0x0004) +#define ZCL_INT8_U_ATTRIBUTE_ID (0x0005) +#define ZCL_INT16_U_ATTRIBUTE_ID (0x0006) +#define ZCL_INT32_U_ATTRIBUTE_ID (0x0008) +#define ZCL_INT64_U_ATTRIBUTE_ID (0x000C) +#define ZCL_INT8_S_ATTRIBUTE_ID (0x000D) +#define ZCL_INT16_S_ATTRIBUTE_ID (0x000E) +#define ZCL_INT32_S_ATTRIBUTE_ID (0x0010) +#define ZCL_INT64_S_ATTRIBUTE_ID (0x0014) +#define ZCL_ENUM8_ATTRIBUTE_ID (0x0015) +#define ZCL_ENUM16_ATTRIBUTE_ID (0x0016) +#define ZCL_OCTET_STRING_ATTRIBUTE_ID (0x0019) +#define ZCL_LIST_ATTRIBUTE_ID (0x001A) + // Attribute ids for cluster: Generic Tunnel // Client attributes diff --git a/src/darwin/Framework/CHIP/gen/call-command-handler.cpp b/src/darwin/Framework/CHIP/gen/call-command-handler.cpp index 8a2ac614c4bc67..a0a60ecc16014e 100644 --- a/src/darwin/Framework/CHIP/gen/call-command-handler.cpp +++ b/src/darwin/Framework/CHIP/gen/call-command-handler.cpp @@ -48,6 +48,7 @@ EmberAfStatus emberAfPumpConfigurationAndControlClusterClientCommandParse(EmberA EmberAfStatus emberAfScenesClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfSwitchClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfTemperatureMeasurementClusterClientCommandParse(EmberAfClusterCommand * cmd); +EmberAfStatus emberAfTestClusterClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfThermostatClusterClientCommandParse(EmberAfClusterCommand * cmd); static EmberAfStatus status(bool wasHandled, bool clusterExists, bool mfgSpecific) @@ -152,6 +153,9 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd) // No commands are enabled for cluster Temperature Measurement result = status(false, true, cmd->mfgSpecific); break; + case ZCL_TEST_CLUSTER_ID: + result = emberAfTestClusterClusterClientCommandParse(cmd); + break; case ZCL_THERMOSTAT_CLUSTER_ID: // No commands are enabled for cluster Thermostat result = status(false, true, cmd->mfgSpecific); @@ -1348,3 +1352,32 @@ EmberAfStatus emberAfScenesClusterClientCommandParse(EmberAfClusterCommand * cmd } return status(wasHandled, true, cmd->mfgSpecific); } +EmberAfStatus emberAfTestClusterClusterClientCommandParse(EmberAfClusterCommand * cmd) +{ + bool wasHandled = false; + + if (!cmd->mfgSpecific) + { + switch (cmd->commandId) + { + case ZCL_TEST_SPECIFIC_RESPONSE_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t returnValue; + + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + returnValue = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfTestClusterClusterTestSpecificResponseCallback(nullptr, returnValue); + break; + } + default: { + // Unrecognized command ID, error status will apply. + break; + } + } + } + return status(wasHandled, true, cmd->mfgSpecific); +} diff --git a/src/darwin/Framework/CHIP/gen/callback-stub.cpp b/src/darwin/Framework/CHIP/gen/callback-stub.cpp index 692e2845326d6d..de7b7758bd5a8a 100644 --- a/src/darwin/Framework/CHIP/gen/callback-stub.cpp +++ b/src/darwin/Framework/CHIP/gen/callback-stub.cpp @@ -89,6 +89,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case ZCL_TEMP_MEASUREMENT_CLUSTER_ID: emberAfTemperatureMeasurementClusterInitCallback(endpoint); break; + case ZCL_TEST_CLUSTER_ID: + emberAfTestClusterClusterInitCallback(endpoint); + break; case ZCL_THERMOSTAT_CLUSTER_ID: emberAfThermostatClusterInitCallback(endpoint); break; @@ -198,6 +201,11 @@ void __attribute__((weak)) emberAfTemperatureMeasurementClusterInitCallback(Endp // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfTestClusterClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfThermostatClusterInitCallback(EndpointId endpoint) { // To prevent warning diff --git a/src/darwin/Framework/CHIP/gen/callback.h b/src/darwin/Framework/CHIP/gen/callback.h index 427396801eb7a0..a73a115fd733bf 100644 --- a/src/darwin/Framework/CHIP/gen/callback.h +++ b/src/darwin/Framework/CHIP/gen/callback.h @@ -200,6 +200,14 @@ void emberAfSwitchClusterInitCallback(chip::EndpointId endpoint); */ void emberAfTemperatureMeasurementClusterInitCallback(chip::EndpointId endpoint); +/** @brief Test Cluster Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfTestClusterClusterInitCallback(chip::EndpointId endpoint); + /** @brief Thermostat Cluster Init * * Cluster Init @@ -1615,6 +1623,76 @@ EmberAfStatus emberAfTemperatureMeasurementClusterClientPreAttributeChangedCallb */ void emberAfTemperatureMeasurementClusterClientTickCallback(chip::EndpointId endpoint); +// +// Test Cluster Cluster client +// + +/** @brief Test Cluster Cluster Client Init + * + * Client Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfTestClusterClusterClientInitCallback(chip::EndpointId endpoint); + +/** @brief Test Cluster Cluster Client Attribute Changed + * + * Client Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + */ +void emberAfTestClusterClusterClientAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); + +/** @brief Test Cluster Cluster Client Manufacturer Specific Attribute Changed + * + * Client Manufacturer Specific Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + * @param manufacturerCode Manufacturer Code of the attribute that changed + */ +void emberAfTestClusterClusterClientManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + uint16_t manufacturerCode); + +/** @brief Test Cluster Cluster Client Message Sent + * + * Client Message Sent + * + * @param type The type of message sent + * @param indexOrDestination The destination or address to which the message was sent + * @param apsFrame The APS frame for the message + * @param msgLen The length of the message + * @param message The message that was sent + * @param status The status of the sent message + */ +void emberAfTestClusterClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, + EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, + EmberStatus status); + +/** @brief Test Cluster Cluster Client Pre Attribute Changed + * + * client Pre Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +EmberAfStatus emberAfTestClusterClusterClientPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, + EmberAfAttributeType attributeType, uint8_t size, + uint8_t * value); + +/** @brief Test Cluster Cluster Client Tick + * + * client Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfTestClusterClusterClientTickCallback(chip::EndpointId endpoint); + // // Thermostat Cluster client // @@ -2103,6 +2181,13 @@ bool emberAfScenesClusterViewSceneResponseCallback(chip::app::Command * commandO uint8_t sceneId, uint16_t transitionTime, uint8_t * sceneName, /* TYPE WARNING: array array defaults to */ uint8_t * extensionFieldSets); +/** + * @brief Test Cluster Cluster TestSpecificResponse Command callback + * @param returnValue + */ + +bool emberAfTestClusterClusterTestSpecificResponseCallback(chip::app::Command * commandObj, uint8_t returnValue); + // // Non-Cluster Related Callbacks // diff --git a/src/darwin/Framework/CHIP/gen/client-command-macro.h b/src/darwin/Framework/CHIP/gen/client-command-macro.h index 1cfc06d80ce7c2..c8666bc5678d12 100644 --- a/src/darwin/Framework/CHIP/gen/client-command-macro.h +++ b/src/darwin/Framework/CHIP/gen/client-command-macro.h @@ -3629,6 +3629,34 @@ \ ZCL_LOGIN_COMMAND_ID, "uu", tempAccountIdentifier, setupPIN); +/** @brief Command description for Test + * + * Command: Test + * @param returnValue INT8U + */ +#define emberAfFillCommandTest \ + ClusterClusterTest(returnValue) emberAfFillExternalBuffer(mask, \ + \ + ZCL_TEST_COMMAND_ID, "u", returnValue); + +/** @brief Command description for TestNotHandled + * + * Command: TestNotHandled + */ +#define emberAfFillCommandTest \ + ClusterClusterTestNotHandled() emberAfFillExternalBuffer(mask, \ + \ + ZCL_TEST_NOT_HANDLED_COMMAND_ID, "", ); + +/** @brief Command description for TestSpecific + * + * Command: TestSpecific + */ +#define emberAfFillCommandTest \ + ClusterClusterTestSpecific() emberAfFillExternalBuffer(mask, \ + \ + ZCL_TEST_SPECIFIC_COMMAND_ID, "", ); + /** @brief Command description for MatchProtocolAddress * * Command: MatchProtocolAddress diff --git a/src/darwin/Framework/CHIP/gen/cluster-id.h b/src/darwin/Framework/CHIP/gen/cluster-id.h index b8d9a9f7ed09bf..7f71ea5976846c 100644 --- a/src/darwin/Framework/CHIP/gen/cluster-id.h +++ b/src/darwin/Framework/CHIP/gen/cluster-id.h @@ -293,6 +293,9 @@ // Definitions for cluster: Account Login #define ZCL_ACCOUNT_LOGIN_CLUSTER_ID (0x050E) +// Definitions for cluster: Test Cluster +#define ZCL_TEST_CLUSTER_ID (0x050F) + // Definitions for cluster: Generic Tunnel #define ZCL_GENERIC_TUNNEL_CLUSTER_ID (0x0600) diff --git a/src/darwin/Framework/CHIP/gen/command-id.h b/src/darwin/Framework/CHIP/gen/command-id.h index 25ee08826f030c..8e97e911e0a423 100644 --- a/src/darwin/Framework/CHIP/gen/command-id.h +++ b/src/darwin/Framework/CHIP/gen/command-id.h @@ -470,6 +470,12 @@ #define ZCL_GET_SETUP_PIN_RESPONSE_COMMAND_ID (0x00) #define ZCL_LOGIN_COMMAND_ID (0x01) +// Commands for cluster: Test Cluster +#define ZCL_TEST_COMMAND_ID (0x00) +#define ZCL_TEST_SPECIFIC_RESPONSE_COMMAND_ID (0x00) +#define ZCL_TEST_NOT_HANDLED_COMMAND_ID (0x01) +#define ZCL_TEST_SPECIFIC_COMMAND_ID (0x02) + // Commands for cluster: Generic Tunnel #define ZCL_MATCH_PROTOCOL_ADDRESS_COMMAND_ID (0x00) #define ZCL_MATCH_PROTOCOL_ADDRESS_RESPONSE_COMMAND_ID (0x00) diff --git a/src/darwin/Framework/CHIP/gen/endpoint_config.h b/src/darwin/Framework/CHIP/gen/endpoint_config.h index 5d7aa618a861c8..64db0994ccd3a9 100644 --- a/src/darwin/Framework/CHIP/gen/endpoint_config.h +++ b/src/darwin/Framework/CHIP/gen/endpoint_config.h @@ -63,7 +63,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 21 +#define GENERATED_ATTRIBUTE_COUNT 22 #define GENERATED_ATTRIBUTES \ { \ \ @@ -123,6 +123,9 @@ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ /* Endpoint: 1, Cluster: Application Basic (client) */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ + \ + /* Endpoint: 1, Cluster: Test Cluster (client) */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ /* Endpoint: 1, Cluster: Binding (client) */ \ @@ -139,7 +142,7 @@ #define GENERATED_FUNCTION_ARRAYS #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask -#define GENERATED_CLUSTER_COUNT 21 +#define GENERATED_CLUSTER_COUNT 22 #define GENERATED_CLUSTERS \ { \ { 0x0003, ZAP_ATTRIBUTE_INDEX(0), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Identify (client) */ \ @@ -188,10 +191,13 @@ 0x050D, ZAP_ATTRIBUTE_INDEX(18), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Application Basic (client) */ \ { \ - 0xF000, ZAP_ATTRIBUTE_INDEX(19), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x050F, ZAP_ATTRIBUTE_INDEX(19), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + }, /* Endpoint: 1, Cluster: Test Cluster (client) */ \ + { \ + 0xF000, ZAP_ATTRIBUTE_INDEX(20), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Binding (client) */ \ { \ - 0xF004, ZAP_ATTRIBUTE_INDEX(20), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0xF004, ZAP_ATTRIBUTE_INDEX(21), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Group Key Management (client) */ \ } @@ -200,7 +206,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 21, 42 }, \ + { ZAP_CLUSTER_INDEX(0), 22, 44 }, \ } // Largest attribute size is needed for various buffers @@ -210,7 +216,7 @@ #define ATTRIBUTE_SINGLETONS_SIZE (2) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (42) +#define ATTRIBUTE_MAX_SIZE (44) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (1) @@ -254,7 +260,7 @@ // Array of EmberAfCommandMetadata structs. #define ZAP_COMMAND_MASK(mask) COMMAND_MASK_##mask -#define EMBER_AF_GENERATED_COMMAND_COUNT (142) +#define EMBER_AF_GENERATED_COMMAND_COUNT (146) #define GENERATED_COMMANDS \ { \ \ @@ -437,6 +443,12 @@ /* Endpoint: 1, Cluster: Low Power (client) */ \ { 0x0508, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Sleep */ \ \ + /* Endpoint: 1, Cluster: Test Cluster (client) */ \ + { 0x050F, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Test */ \ + { 0x050F, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* TestSpecificResponse */ \ + { 0x050F, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* TestNotHandled */ \ + { 0x050F, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* TestSpecific */ \ + \ /* Endpoint: 1, Cluster: Binding (client) */ \ { 0xF000, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Bind */ \ { 0xF000, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Unbind */ \ diff --git a/src/darwin/Framework/CHIP/gen/gen_config.h b/src/darwin/Framework/CHIP/gen/gen_config.h index e0854ebb074057..786770655597af 100644 --- a/src/darwin/Framework/CHIP/gen/gen_config.h +++ b/src/darwin/Framework/CHIP/gen/gen_config.h @@ -49,6 +49,7 @@ #define EMBER_AF_SCENES_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_SWITCH_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_TEMP_MEASUREMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_TEST_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_THERMOSTAT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) /**** Cluster Plugins ****/ @@ -133,6 +134,10 @@ #define ZCL_USING_TEMP_MEASUREMENT_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_TEMPERATURE_MEASUREMENT_CLIENT +// Use this macro to check if the client side of the Test Cluster cluster is included +#define ZCL_USING_TEST_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_TEST_CLUSTER_CLIENT + // Use this macro to check if the client side of the Thermostat cluster is included #define ZCL_USING_THERMOSTAT_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_THERMOSTAT_CLIENT diff --git a/src/darwin/Framework/CHIP/gen/print-cluster.h b/src/darwin/Framework/CHIP/gen/print-cluster.h index 9c879d94a9390d..886dad371554b7 100644 --- a/src/darwin/Framework/CHIP/gen/print-cluster.h +++ b/src/darwin/Framework/CHIP/gen/print-cluster.h @@ -634,6 +634,12 @@ #define CHIP_PRINTCLUSTER_ACCOUNT_LOGIN_CLUSTER #endif +#if defined(ZCL_USING_TEST_CLUSTER_SERVER) || defined(ZCL_USING_TEST_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_TEST_CLUSTER { ZCL_TEST_CLUSTER_ID, 1295, "Test Cluster" }, +#else +#define CHIP_PRINTCLUSTER_TEST_CLUSTER +#endif + #if defined(ZCL_USING_GENERIC_TUNNEL_CLUSTER_SERVER) || defined(ZCL_USING_GENERIC_TUNNEL_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_GENERIC_TUNNEL_CLUSTER { ZCL_GENERIC_TUNNEL_CLUSTER_ID, 1536, "Generic Tunnel" }, #else @@ -965,6 +971,7 @@ CHIP_PRINTCLUSTER_APPLICATION_LAUNCHER_CLUSTER \ CHIP_PRINTCLUSTER_APPLICATION_BASIC_CLUSTER \ CHIP_PRINTCLUSTER_ACCOUNT_LOGIN_CLUSTER \ + CHIP_PRINTCLUSTER_TEST_CLUSTER \ CHIP_PRINTCLUSTER_GENERIC_TUNNEL_CLUSTER \ CHIP_PRINTCLUSTER_BACNET_PROTOCOL_TUNNEL_CLUSTER \ CHIP_PRINTCLUSTER_11073_PROTOCOL_TUNNEL_CLUSTER \ diff --git a/src/darwin/Framework/CHIP/templates/clusters-tests.zapt b/src/darwin/Framework/CHIP/templates/clusters-tests.zapt index 42db26a77b4fb7..39ceb1b58aca4c 100644 --- a/src/darwin/Framework/CHIP/templates/clusters-tests.zapt +++ b/src/darwin/Framework/CHIP/templates/clusters-tests.zapt @@ -122,29 +122,60 @@ CHIPDevice * GetPairedDevice(uint64_t deviceId) XCTAssertTrue(stopped); } -{{#chip_client_clusters}} -{{#chip_server_cluster_commands}} -{{#unless (zcl_command_arguments_count this.id)}} -- (void)testSendCluster{{asCamelCased parent.name false}}{{asCamelCased name false}}Command +- (void)testSendClusterTestCommand { - XCTestExpectation * expectation = [self expectationWithDescription:@"{{asCamelCased parent.name false}}{{asCamelCased name false}}"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterTestCommand"]; CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIP{{asCamelCased parent.name false}} * cluster = [[CHIP{{asCamelCased parent.name false}} alloc] initWithDevice:device endpoint:{{asExpectedEndpointForCluster (asCamelCased parent.name false)}} queue:queue]; + CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster {{asCamelCased name}}:^(NSError * err, NSDictionary * values) { - NSLog(@"{{asCamelCased parent.name false}} {{asCamelCased name false}} Error: %@", err); - XCTAssertEqual(err.code, {{asExpectedReturnValueForCommand (asCamelCased parent.name false) (asCamelCased name false)}}); + [cluster test:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster test Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTestNotHandledCommand +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterTestNotHandledCommand"]; + + 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 testNotHandled:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster testNotHandled Error: %@", err); + XCTAssertEqual(err.code, 1); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTestSpecificCommand +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterTestSpecificCommand"]; + + 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 testSpecific:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster testSpecific Error: %@", err); + XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"returnValue"] intValue], 7); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -{{/unless}} -{{/chip_server_cluster_commands}} -{{/chip_client_clusters}} {{#chip_client_clusters}} {{#chip_server_cluster_attributes}} diff --git a/src/darwin/Framework/CHIP/templates/helper.js b/src/darwin/Framework/CHIP/templates/helper.js index 230a251ac18519..6da29f09afb4ec 100644 --- a/src/darwin/Framework/CHIP/templates/helper.js +++ b/src/darwin/Framework/CHIP/templates/helper.js @@ -40,41 +40,6 @@ function asExpectedEndpointForCluster(clusterName) return 1; } -function asExpectedReturnValueForCommand(clusterName, commandName) -{ - switch (clusterName) { - case 'GeneralCommissioning': - switch (commandName) { - // All methods are not implemented and returns `EMBER_ZCL_STATUS_FAILURE` - default: - return 1; - } - break; - - case 'OperationalCredentials': - switch (commandName) { - // All methods are not implemented and returns `EMBER_ZCL_STATUS_FAILURE` - default: - return 1; - } - break; - - case 'Thermostat': - switch (commandName) { - // All those methods are not implemented and directly returns false. So the stack returns - // `EMBER_ZCL_STATUS_UNSUP_CLUSTER_COMMAND` - case 'GetRelayStatusLog': - case 'ClearWeeklySchedule': - case 'SetWeeklySchedule': - case 'GetWeeklySchedule': - return 1; - } - break; - } - - return 0; -} - function asTestValue() { if (StringHelper.isOctetString(this.type)) { @@ -89,6 +54,5 @@ function asTestValue() // // Module exports // -exports.asExpectedEndpointForCluster = asExpectedEndpointForCluster; -exports.asExpectedReturnValueForCommand = asExpectedReturnValueForCommand; -exports.asTestValue = asTestValue; +exports.asExpectedEndpointForCluster = asExpectedEndpointForCluster; +exports.asTestValue = asTestValue; diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index 721eef6a7eb253..1e4ce429a93b10 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -123,256 +123,55 @@ - (void)testShutdownStack XCTAssertTrue(stopped); } -- (void)testSendClusterBarrierControlBarrierControlStopCommand +- (void)testSendClusterTestCommand { - XCTestExpectation * expectation = [self expectationWithDescription:@"BarrierControlBarrierControlStop"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterTestCommand"]; CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPBarrierControl * cluster = [[CHIPBarrierControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster barrierControlStop:^(NSError * err, NSDictionary * values) { - NSLog(@"BarrierControl BarrierControlStop Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterBasicMfgSpecificPingCommand -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"BasicMfgSpecificPing"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPBasic * cluster = [[CHIPBasic alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster mfgSpecificPing:^(NSError * err, NSDictionary * values) { - NSLog(@"Basic MfgSpecificPing Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterDoorLockClearAllPinsCommand -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"DoorLockClearAllPins"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPDoorLock * cluster = [[CHIPDoorLock alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster clearAllPins:^(NSError * err, NSDictionary * values) { - NSLog(@"DoorLock ClearAllPins Error: %@", err); + [cluster test:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster test Error: %@", err); XCTAssertEqual(err.code, 0); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterDoorLockClearAllRfidsCommand -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"DoorLockClearAllRfids"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPDoorLock * cluster = [[CHIPDoorLock alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster clearAllRfids:^(NSError * err, NSDictionary * values) { - NSLog(@"DoorLock ClearAllRfids Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterGeneralCommissioningCommissioningCompleteCommand +- (void)testSendClusterTestNotHandledCommand { - XCTestExpectation * expectation = [self expectationWithDescription:@"GeneralCommissioningCommissioningComplete"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterTestNotHandledCommand"]; CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPGeneralCommissioning * cluster = [[CHIPGeneralCommissioning alloc] initWithDevice:device endpoint:0 queue:queue]; + CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster commissioningComplete:^(NSError * err, NSDictionary * values) { - NSLog(@"GeneralCommissioning CommissioningComplete Error: %@", err); + [cluster testNotHandled:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster testNotHandled Error: %@", err); XCTAssertEqual(err.code, 1); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterGroupsRemoveAllGroupsCommand -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"GroupsRemoveAllGroups"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPGroups * cluster = [[CHIPGroups alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster removeAllGroups:^(NSError * err, NSDictionary * values) { - NSLog(@"Groups RemoveAllGroups Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterIdentifyIdentifyQueryCommand -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"IdentifyIdentifyQuery"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPIdentify * cluster = [[CHIPIdentify alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster identifyQuery:^(NSError * err, NSDictionary * values) { - NSLog(@"Identify IdentifyQuery Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterLevelControlStopWithOnOffCommand -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"LevelControlStopWithOnOff"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPLevelControl * cluster = [[CHIPLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster stopWithOnOff:^(NSError * err, NSDictionary * values) { - NSLog(@"LevelControl StopWithOnOff Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterLowPowerSleepCommand -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"LowPowerSleep"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPLowPower * cluster = [[CHIPLowPower alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster sleep:^(NSError * err, NSDictionary * values) { - NSLog(@"LowPower Sleep Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterOnOffOffCommand -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"OnOffOff"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster off:^(NSError * err, NSDictionary * values) { - NSLog(@"OnOff Off Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterOnOffOnCommand -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"OnOffOn"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster on:^(NSError * err, NSDictionary * values) { - NSLog(@"OnOff On Error: %@", err); - XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterOnOffToggleCommand +- (void)testSendClusterTestSpecificCommand { - XCTestExpectation * expectation = [self expectationWithDescription:@"OnOffToggle"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterTestSpecificCommand"]; CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster toggle:^(NSError * err, NSDictionary * values) { - NSLog(@"OnOff Toggle Error: %@", err); + [cluster testSpecific:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster testSpecific Error: %@", err); XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterOperationalCredentialsGetFabricIdCommand -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"OperationalCredentialsGetFabricId"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPOperationalCredentials * cluster = [[CHIPOperationalCredentials alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster getFabricId:^(NSError * err, NSDictionary * values) { - NSLog(@"OperationalCredentials GetFabricId Error: %@", err); - XCTAssertEqual(err.code, 1); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterThermostatClearWeeklyScheduleCommand -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"ThermostatClearWeeklySchedule"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPThermostat * cluster = [[CHIPThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster clearWeeklySchedule:^(NSError * err, NSDictionary * values) { - NSLog(@"Thermostat ClearWeeklySchedule Error: %@", err); - XCTAssertEqual(err.code, 1); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterThermostatGetRelayStatusLogCommand -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"ThermostatGetRelayStatusLog"]; - - CHIPDevice * device = GetPairedDevice(kDeviceId); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPThermostat * cluster = [[CHIPThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster getRelayStatusLog:^(NSError * err, NSDictionary * values) { - NSLog(@"Thermostat GetRelayStatusLog Error: %@", err); - XCTAssertEqual(err.code, 1); + XCTAssertEqual([values[@"returnValue"] intValue], 7); [expectation fulfill]; }]; @@ -3118,6 +2917,634 @@ - (void)testSendClusterTemperatureMeasurementReadAttributeClusterRevision [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTestClusterReadAttributeBoolean +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeBoolean"]; + + 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 readAttributeBoolean:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster Boolean Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTestClusterWriteAttributeBoolean +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeBoolean"]; + + 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 writeAttributeBoolean:value + completionHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster Boolean Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestClusterReadAttributeBitmap8 +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeBitmap8"]; + + 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 readAttributeBitmap8:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster Bitmap8 Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTestClusterWriteAttributeBitmap8 +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeBitmap8"]; + + 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 writeAttributeBitmap8:value + completionHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster Bitmap8 Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestClusterReadAttributeBitmap16 +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeBitmap16"]; + + 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 readAttributeBitmap16:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster Bitmap16 Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTestClusterWriteAttributeBitmap16 +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeBitmap16"]; + + 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 writeAttributeBitmap16:value + completionHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster Bitmap16 Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestClusterReadAttributeBitmap32 +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeBitmap32"]; + + 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 readAttributeBitmap32:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster Bitmap32 Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTestClusterWriteAttributeBitmap32 +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeBitmap32"]; + + 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 writeAttributeBitmap32:value + completionHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster Bitmap32 Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestClusterReadAttributeBitmap64 +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeBitmap64"]; + + 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 readAttributeBitmap64:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster Bitmap64 Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTestClusterWriteAttributeBitmap64 +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeBitmap64"]; + + 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 writeAttributeBitmap64:value + completionHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster Bitmap64 Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestClusterReadAttributeInt8u +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeInt8u"]; + + 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 readAttributeInt8u:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster Int8u Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTestClusterWriteAttributeInt8u +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeInt8u"]; + + 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 writeAttributeInt8u:value + completionHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster Int8u Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestClusterReadAttributeInt16u +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeInt16u"]; + + 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 readAttributeInt16u:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster Int16u Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTestClusterWriteAttributeInt16u +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeInt16u"]; + + 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 writeAttributeInt16u:value + completionHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster Int16u Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestClusterReadAttributeInt32u +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeInt32u"]; + + 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 readAttributeInt32u:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster Int32u Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTestClusterWriteAttributeInt32u +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeInt32u"]; + + 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 writeAttributeInt32u:value + completionHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster Int32u Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestClusterReadAttributeInt64u +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeInt64u"]; + + 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 readAttributeInt64u:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster Int64u Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTestClusterWriteAttributeInt64u +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeInt64u"]; + + 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 writeAttributeInt64u:value + completionHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster Int64u Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestClusterReadAttributeInt8s +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeInt8s"]; + + 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 readAttributeInt8s:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster Int8s Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTestClusterWriteAttributeInt8s +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeInt8s"]; + + 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 writeAttributeInt8s:value + completionHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster Int8s Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestClusterReadAttributeInt16s +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeInt16s"]; + + 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 readAttributeInt16s:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster Int16s Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTestClusterWriteAttributeInt16s +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeInt16s"]; + + 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 writeAttributeInt16s:value + completionHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster Int16s Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestClusterReadAttributeInt32s +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeInt32s"]; + + 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 readAttributeInt32s:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster Int32s Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTestClusterWriteAttributeInt32s +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeInt32s"]; + + 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 writeAttributeInt32s:value + completionHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster Int32s Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestClusterReadAttributeInt64s +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeInt64s"]; + + 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 readAttributeInt64s:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster Int64s Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTestClusterWriteAttributeInt64s +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeInt64s"]; + + 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 writeAttributeInt64s:value + completionHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster Int64s Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestClusterReadAttributeEnum8 +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeEnum8"]; + + 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 readAttributeEnum8:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster Enum8 Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTestClusterWriteAttributeEnum8 +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeEnum8"]; + + 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 writeAttributeEnum8:value + completionHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster Enum8 Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestClusterReadAttributeEnum16 +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeEnum16"]; + + 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 readAttributeEnum16:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster Enum16 Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTestClusterWriteAttributeEnum16 +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeEnum16"]; + + 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 writeAttributeEnum16:value + completionHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster Enum16 Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestClusterReadAttributeOctetString +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeOctetString"]; + + 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 readAttributeOctetString:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster OctetString Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTestClusterWriteAttributeOctetString +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterWriteAttributeOctetString"]; + + 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 writeAttributeOctetString:value + completionHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster OctetString Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestClusterReadAttributeListInt8u +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeListInt8u"]; + + 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 readAttributeListInt8u:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster ListInt8u Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTestClusterReadAttributeClusterRevision +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TestClusterReadAttributeClusterRevision"]; + + 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 readAttributeClusterRevision:^(NSError * err, NSDictionary * values) { + NSLog(@"TestCluster ClusterRevision Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + - (void)testSendClusterThermostatReadAttributeLocalTemperature { XCTestExpectation * expectation = [self expectationWithDescription:@"ThermostatReadAttributeLocalTemperature"];