From fdcba80dd10c18a6817b41b4e69ee48c23976692 Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs Date: Tue, 10 Oct 2023 16:21:23 -0400 Subject: [PATCH 1/6] Added the TableSize bit to the Scenes feature map and ensured the ScenesTableImpl would get the value from zap --- .../all-clusters-app.matter | 4 +- .../all-clusters-common/all-clusters-app.zap | 4 +- .../all-clusters-minimal-app.matter | 4 +- .../all-clusters-minimal-app.zap | 16 +- .../lighting-common/lighting-app.matter | 2 +- .../lighting-common/lighting-app.zap | 4 +- .../data_model/lighting-thread-app.matter | 2 +- .../silabs/data_model/lighting-thread-app.zap | 4 +- .../data_model/lighting-wifi-app.matter | 2 +- .../silabs/data_model/lighting-wifi-app.zap | 4 +- .../placeholder/linux/apps/app1/config.matter | 6 +- .../placeholder/linux/apps/app1/config.zap | 34 +- .../placeholder/linux/apps/app2/config.matter | 6 +- .../placeholder/linux/apps/app2/config.zap | 34 +- examples/pump-app/silabs/src/AppTask.cpp | 1 - .../zap/tests/inputs/all-clusters-app.zap | 14 +- .../app-templates/endpoint_config.h | 8 +- .../app-templates/gen_config.h | 13 +- .../clusters/scenes-server/SceneTableImpl.cpp | 2 +- .../clusters/scenes-server/SceneTableImpl.h | 5 +- .../clusters/scenes-server/scenes-server.cpp | 4 +- src/app/tests/TestSceneTable.cpp | 313 ++++++++++-------- .../suites/certification/Test_TC_S_1_1.yaml | 21 +- .../tests/suites/certification/ci-pics-values | 2 +- .../mock/include/zap-generated/gen_config.h | 1 + .../templates/app/gen_config.zapt | 45 +-- src/lib/core/CHIPConfig.h | 14 - 27 files changed, 348 insertions(+), 221 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index efd0d098cb872d..b5246c1919029d 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -6236,7 +6236,7 @@ endpoint 1 { callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - ram attribute featureMap default = 3; + ram attribute featureMap default = 7; ram attribute clusterRevision default = 5; handle command AddScene; @@ -7379,7 +7379,7 @@ endpoint 2 { callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - ram attribute featureMap default = 3; + ram attribute featureMap default = 7; ram attribute clusterRevision default = 5; handle command AddScene; 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 b05a00644b10fc..a1f092db8b44c5 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 @@ -6998,7 +6998,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "7", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -21300,7 +21300,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "7", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter index 73ac50358c13b4..6a95337d66631f 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter @@ -4377,7 +4377,7 @@ endpoint 1 { callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - ram attribute featureMap default = 3; + ram attribute featureMap default = 7; ram attribute clusterRevision default = 5; handle command AddScene; @@ -4940,7 +4940,7 @@ endpoint 2 { callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - ram attribute featureMap default = 3; + ram attribute featureMap default = 7; ram attribute clusterRevision default = 5; handle command AddScene; diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap index a900aea4ea362f..5bcfc9393e1dce 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap @@ -17,6 +17,12 @@ } ], "package": [ + { + "pathRelativity": "relativeToZap", + "path": "../../../src/app/zap-templates/app-templates.json", + "type": "gen-templates-json", + "version": "chip-v1" + }, { "pathRelativity": "relativeToZap", "path": "../../../src/app/zap-templates/zcl/zcl.json", @@ -24,12 +30,6 @@ "category": "matter", "version": 1, "description": "Matter SDK ZCL data" - }, - { - "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/app-templates.json", - "type": "gen-templates-json", - "version": "chip-v1" } ], "endpointTypes": [ @@ -4802,7 +4802,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "7", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -11082,7 +11082,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "7", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/lighting-app/lighting-common/lighting-app.matter b/examples/lighting-app/lighting-common/lighting-app.matter index 44cc85d26015dd..fc237ba9b12d58 100644 --- a/examples/lighting-app/lighting-common/lighting-app.matter +++ b/examples/lighting-app/lighting-common/lighting-app.matter @@ -2483,7 +2483,7 @@ endpoint 1 { callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute attributeList; - ram attribute featureMap default = 3; + ram attribute featureMap default = 7; ram attribute clusterRevision default = 5; handle command AddScene; diff --git a/examples/lighting-app/lighting-common/lighting-app.zap b/examples/lighting-app/lighting-common/lighting-app.zap index d59fee5200f253..4b4c4df423b066 100644 --- a/examples/lighting-app/lighting-common/lighting-app.zap +++ b/examples/lighting-app/lighting-common/lighting-app.zap @@ -4701,7 +4701,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "7", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -5976,4 +5976,4 @@ "networkId": 0 } ] -} \ No newline at end of file +} diff --git a/examples/lighting-app/silabs/data_model/lighting-thread-app.matter b/examples/lighting-app/silabs/data_model/lighting-thread-app.matter index 1ee2508f922b9a..6db7dab5e492ba 100644 --- a/examples/lighting-app/silabs/data_model/lighting-thread-app.matter +++ b/examples/lighting-app/silabs/data_model/lighting-thread-app.matter @@ -2500,7 +2500,7 @@ endpoint 1 { callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - ram attribute featureMap default = 3; + ram attribute featureMap default = 7; ram attribute clusterRevision default = 5; handle command AddScene; diff --git a/examples/lighting-app/silabs/data_model/lighting-thread-app.zap b/examples/lighting-app/silabs/data_model/lighting-thread-app.zap index 02f8e06de63acb..8e09be48c62b22 100644 --- a/examples/lighting-app/silabs/data_model/lighting-thread-app.zap +++ b/examples/lighting-app/silabs/data_model/lighting-thread-app.zap @@ -4257,7 +4257,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "7", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -5916,4 +5916,4 @@ "networkId": 0 } ] -} \ No newline at end of file +} diff --git a/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter b/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter index ccad91158a901d..93f9386bcb56fc 100644 --- a/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter +++ b/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter @@ -2340,7 +2340,7 @@ endpoint 1 { callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - ram attribute featureMap default = 3; + ram attribute featureMap default = 7; ram attribute clusterRevision default = 5; handle command AddScene; diff --git a/examples/lighting-app/silabs/data_model/lighting-wifi-app.zap b/examples/lighting-app/silabs/data_model/lighting-wifi-app.zap index e3a6e68d427d8b..411aadbeac28a3 100644 --- a/examples/lighting-app/silabs/data_model/lighting-wifi-app.zap +++ b/examples/lighting-app/silabs/data_model/lighting-wifi-app.zap @@ -3433,7 +3433,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "7", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -5092,4 +5092,4 @@ "networkId": 0 } ] -} \ No newline at end of file +} diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index 3dc67eaec358aa..d886e903bf6cd8 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -192,6 +192,8 @@ server cluster Scenes = 5 { readonly attribute group_id currentGroup = 2; readonly attribute boolean sceneValid = 3; readonly attribute bitmap8 nameSupport = 4; + readonly attribute int16u sceneTableSize = 6; + readonly attribute int8u remainingCapacity = 7; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -7365,10 +7367,12 @@ endpoint 1 { ram attribute currentGroup default = 0x0000; ram attribute sceneValid default = 0x00; ram attribute nameSupport; + ram attribute sceneTableSize default = 16; + callback attribute remainingCapacity default = 8; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute attributeList; - ram attribute featureMap default = 0; + ram attribute featureMap default = 7; ram attribute clusterRevision default = 5; handle command AddScene; diff --git a/examples/placeholder/linux/apps/app1/config.zap b/examples/placeholder/linux/apps/app1/config.zap index f4bdb87e424a67..79f0e04b8cebb7 100644 --- a/examples/placeholder/linux/apps/app1/config.zap +++ b/examples/placeholder/linux/apps/app1/config.zap @@ -11972,6 +11972,38 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "SceneTableSize", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "16", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "RemainingCapacity", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "8", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "GeneratedCommandList", "code": 65528, @@ -12030,7 +12062,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "7", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index daa24822170a95..9ca142d5b4dfbc 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -192,6 +192,8 @@ server cluster Scenes = 5 { readonly attribute group_id currentGroup = 2; readonly attribute boolean sceneValid = 3; readonly attribute bitmap8 nameSupport = 4; + readonly attribute int16u sceneTableSize = 6; + readonly attribute int8u remainingCapacity = 7; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -7329,10 +7331,12 @@ endpoint 1 { ram attribute currentGroup default = 0x0000; ram attribute sceneValid default = 0x00; ram attribute nameSupport; + ram attribute sceneTableSize default = 16; + callback attribute remainingCapacity default = 8; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute attributeList; - ram attribute featureMap default = 0; + ram attribute featureMap default = 7; ram attribute clusterRevision default = 5; handle command AddScene; diff --git a/examples/placeholder/linux/apps/app2/config.zap b/examples/placeholder/linux/apps/app2/config.zap index f2158750097edc..d005d0b309e2f6 100644 --- a/examples/placeholder/linux/apps/app2/config.zap +++ b/examples/placeholder/linux/apps/app2/config.zap @@ -12054,6 +12054,38 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "SceneTableSize", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "16", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "RemainingCapacity", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "8", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "GeneratedCommandList", "code": 65528, @@ -12112,7 +12144,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "7", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/pump-app/silabs/src/AppTask.cpp b/examples/pump-app/silabs/src/AppTask.cpp index 2dab9268a9035c..f1608b40f3325c 100644 --- a/examples/pump-app/silabs/src/AppTask.cpp +++ b/examples/pump-app/silabs/src/AppTask.cpp @@ -26,7 +26,6 @@ #include "LEDWidget.h" #include -#include #include #include #include diff --git a/scripts/tools/zap/tests/inputs/all-clusters-app.zap b/scripts/tools/zap/tests/inputs/all-clusters-app.zap index fe430bda1dbece..5e7e6d443fde8b 100644 --- a/scripts/tools/zap/tests/inputs/all-clusters-app.zap +++ b/scripts/tools/zap/tests/inputs/all-clusters-app.zap @@ -6175,7 +6175,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "16", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -6191,7 +6191,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "8", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -6271,7 +6271,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "7", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -15419,7 +15419,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "16", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -15435,7 +15435,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "8", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -15515,7 +15515,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "7", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -16665,4 +16665,4 @@ "networkId": 0 } ] -} \ No newline at end of file +} diff --git a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h index 282deca1883650..63d25b1d313ed5 100644 --- a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h +++ b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h @@ -759,9 +759,9 @@ { ZAP_SIMPLE_DEFAULT(0x0000), 0x00000002, 2, ZAP_TYPE(GROUP_ID), 0 }, /* CurrentGroup */ \ { ZAP_SIMPLE_DEFAULT(0x00), 0x00000003, 1, ZAP_TYPE(BOOLEAN), 0 }, /* SceneValid */ \ { ZAP_EMPTY_DEFAULT(), 0x00000004, 1, ZAP_TYPE(BITMAP8), 0 }, /* NameSupport */ \ - { ZAP_EMPTY_DEFAULT(), 0x00000006, 2, ZAP_TYPE(INT16U), 0 }, /* SceneTableSize */ \ + { ZAP_SIMPLE_DEFAULT(16), 0x00000006, 2, ZAP_TYPE(INT16U), 0 }, /* SceneTableSize */ \ { ZAP_EMPTY_DEFAULT(), 0x00000007, 1, ZAP_TYPE(INT8U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) }, /* RemainingCapacity */ \ - { ZAP_SIMPLE_DEFAULT(0), 0x0000FFFC, 4, ZAP_TYPE(BITMAP32), 0 }, /* FeatureMap */ \ + { ZAP_SIMPLE_DEFAULT(7), 0x0000FFFC, 4, ZAP_TYPE(BITMAP32), 0 }, /* FeatureMap */ \ { ZAP_SIMPLE_DEFAULT(5), 0x0000FFFD, 2, ZAP_TYPE(INT16U), 0 }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: On/Off (server) */ \ @@ -1425,9 +1425,9 @@ { ZAP_SIMPLE_DEFAULT(0x0000), 0x00000002, 2, ZAP_TYPE(GROUP_ID), 0 }, /* CurrentGroup */ \ { ZAP_SIMPLE_DEFAULT(0x00), 0x00000003, 1, ZAP_TYPE(BOOLEAN), 0 }, /* SceneValid */ \ { ZAP_EMPTY_DEFAULT(), 0x00000004, 1, ZAP_TYPE(BITMAP8), 0 }, /* NameSupport */ \ - { ZAP_EMPTY_DEFAULT(), 0x00000006, 2, ZAP_TYPE(INT16U), 0 }, /* SceneTableSize */ \ + { ZAP_SIMPLE_DEFAULT(16), 0x00000006, 2, ZAP_TYPE(INT16U), 0 }, /* SceneTableSize */ \ { ZAP_EMPTY_DEFAULT(), 0x00000007, 1, ZAP_TYPE(INT8U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) }, /* RemainingCapacity */ \ - { ZAP_SIMPLE_DEFAULT(0), 0x0000FFFC, 4, ZAP_TYPE(BITMAP32), 0 }, /* FeatureMap */ \ + { ZAP_SIMPLE_DEFAULT(7), 0x0000FFFC, 4, ZAP_TYPE(BITMAP32), 0 }, /* FeatureMap */ \ { ZAP_SIMPLE_DEFAULT(5), 0x0000FFFD, 2, ZAP_TYPE(INT16U), 0 }, /* ClusterRevision */ \ \ /* Endpoint: 2, Cluster: On/Off (server) */ \ diff --git a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/gen_config.h b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/gen_config.h index bf4dbc94ede3f7..fc0a4d3df39f84 100644 --- a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/gen_config.h +++ b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/gen_config.h @@ -102,17 +102,16 @@ #define EMBER_AF_PLUGIN_SCENES_SERVER #define EMBER_AF_PLUGIN_SCENES // User options for server plugin Scenes -// Cluster spec 1.4.8.2 -#ifdef CHIP_CONFIG_MAX_SCENES_PER_FABRIC -#define MATTER_SCENES_TABLE_SIZE CHIP_CONFIG_MAX_SCENES_PER_FABRIC -#else +// Cluster spec 1.4.8.7 #define MATTER_SCENES_TABLE_SIZE 16 -#endif - // Scenes FeatureMap Attribute Toggle Scenes Name feature // App cluster specs 1.4.4 #define MATTER_CLUSTER_SCENE_NAME_SUPPORT_MASK 0x0001 -#define MATTER_CLUSTER_SCENE_NAME_SUPPORT (0x0000 & MATTER_CLUSTER_SCENE_NAME_SUPPORT_MASK) +#define MATTER_CLUSTER_SCENE_NAME_SUPPORT (0x0007 & MATTER_CLUSTER_SCENE_NAME_SUPPORT_MASK) +// Scenes FeatureMap Table Size feature used for the MATTER_SCENES_TABLE_SIZE define +// App cluster specs 1.4.4.2 +#define MATTER_CLUSTER_TABLE_SIZE_SUPPORT_MASK 0x0001 +#define MATTER_CLUSTER_TABLE_SIZE_SUPPORT (0x0007 & MATTER_CLUSTER_TABLE_SIZE_SUPPORT_MASK) // Use this macro to check if the server side of the On/Off cluster is included #define ZCL_USING_ON_OFF_CLUSTER_SERVER diff --git a/src/app/clusters/scenes-server/SceneTableImpl.cpp b/src/app/clusters/scenes-server/SceneTableImpl.cpp index ea894c9d1d108c..b37ab57b5005b8 100644 --- a/src/app/clusters/scenes-server/SceneTableImpl.cpp +++ b/src/app/clusters/scenes-server/SceneTableImpl.cpp @@ -929,7 +929,7 @@ void DefaultSceneTableImpl::SetTableSize(uint16_t endpointSceneTableSize) { // Verify the endpoint passed size respects the limits of the device configuration mMaxScenesPerEndpoint = (kMaxScenesPerEndpoint < endpointSceneTableSize) ? kMaxScenesPerEndpoint : endpointSceneTableSize; - mMaxScenesPerFabric = static_cast(endpointSceneTableSize / 2); + mMaxScenesPerFabric = static_cast(mMaxScenesPerEndpoint / 2); } DefaultSceneTableImpl::SceneEntryIterator * DefaultSceneTableImpl::IterateSceneEntries(FabricIndex fabric) diff --git a/src/app/clusters/scenes-server/SceneTableImpl.h b/src/app/clusters/scenes-server/SceneTableImpl.h index 3be1dc43e48c26..96c4a962619fe3 100644 --- a/src/app/clusters/scenes-server/SceneTableImpl.h +++ b/src/app/clusters/scenes-server/SceneTableImpl.h @@ -23,12 +23,13 @@ #include #include #include +#include namespace chip { namespace scenes { -static constexpr uint16_t kMaxScenesPerFabric = CHIP_CONFIG_SCENES_MAX_PER_FABRIC; -static constexpr uint16_t kMaxScenesPerEndpoint = CHIP_CONFIG_MAX_SCENES_PER_ENDPOINT; +static constexpr uint16_t kMaxScenesPerFabric = MATTER_SCENES_TABLE_SIZE / 2; +static constexpr uint16_t kMaxScenesPerEndpoint = MATTER_SCENES_TABLE_SIZE; using clusterId = chip::ClusterId; diff --git a/src/app/clusters/scenes-server/scenes-server.cpp b/src/app/clusters/scenes-server/scenes-server.cpp index 39bdba86bd90d3..2386e2155d6722 100644 --- a/src/app/clusters/scenes-server/scenes-server.cpp +++ b/src/app/clusters/scenes-server/scenes-server.cpp @@ -136,8 +136,8 @@ CHIP_ERROR ScenesServer::Init() ChipLogDetail(Zcl, "ERR: getting the scenes FeatureMap on Endpoint %hu Status: %x", endpoint, status); } - // Explicit AttributeValuePairs is mandatory for matter so we force it here - featureMap |= to_underlying(Feature::kExplicit); + // Explicit AttributeValuePairs and TableSize features are mandatory for matter so we force-set them here + featureMap |= (to_underlying(Feature::kExplicit) | to_underlying(Feature::kTableSize)); status = Attributes::FeatureMap::Set(endpoint, featureMap); if (EMBER_ZCL_STATUS_SUCCESS != status) { diff --git a/src/app/tests/TestSceneTable.cpp b/src/app/tests/TestSceneTable.cpp index cba0ebe4e8d5f5..b7b5e47a6761ce 100644 --- a/src/app/tests/TestSceneTable.cpp +++ b/src/app/tests/TestSceneTable.cpp @@ -37,6 +37,10 @@ using TransitionTimeMs = scenes::TransitionTimeMs; namespace TestScenes { +// TestTableSize +constexpr uint8_t defaultTestTableSize = 16; +constexpr uint8_t defaultTestFabricCapacity = 8; + // Test Cluster ID constexpr chip::ClusterId kOnOffClusterId = 0x0006; constexpr chip::ClusterId kLevelControlClusterId = 0x0008; @@ -91,6 +95,9 @@ static const SceneStorageId sceneId6(kScene6, kGroup2); static const SceneStorageId sceneId7(kScene7, kGroup3); static const SceneStorageId sceneId8(kScene8, kGroup4); static const SceneStorageId sceneId9(kScene1, kGroup4); +static const SceneStorageId sceneId10(kScene4, kGroup4); +static const SceneStorageId sceneId11(kScene5, kGroup4); +static const SceneStorageId sceneId12(kScene6, kGroup4); CharSpan empty; @@ -107,6 +114,9 @@ static const SceneData sceneData9(CharSpan("Scene #9"), 3000); static const SceneData sceneData10(CharSpan("Scene #10"), 1000); static const SceneData sceneData11(CharSpan("Scene #11"), 50); static const SceneData sceneData12(CharSpan("Scene #12"), 100); +static const SceneData sceneData13(CharSpan("Scene #13"), 100); +static const SceneData sceneData14(CharSpan("Scene #14"), 100); +static const SceneData sceneData15(CharSpan("Scene #15"), 100); // Scenes SceneTableEntry scene1(sceneId1, sceneData1); @@ -121,6 +131,9 @@ SceneTableEntry scene9(sceneId9, sceneData9); SceneTableEntry scene10(sceneId1, sceneData10); SceneTableEntry scene11(sceneId5, sceneData11); SceneTableEntry scene12(sceneId8, sceneData12); +SceneTableEntry scene13(sceneId10, sceneData13); +SceneTableEntry scene14(sceneId11, sceneData14); +SceneTableEntry scene15(sceneId12, sceneData15); // Clusters EFS data static app::Clusters::Scenes::Structs::ExtensionFieldSet::Type OOextensionFieldSet; @@ -390,8 +403,7 @@ class TestSceneHandler : public scenes::DefaultSceneHandlerImpl class TestSceneTableImpl : public SceneTableImpl { public: - TestSceneTableImpl(uint16_t maxScenesPerFabric = scenes::kMaxScenesPerFabric, - uint16_t maxScenesGlobal = scenes::kMaxScenesPerEndpoint) : + TestSceneTableImpl(uint16_t maxScenesPerFabric = defaultTestFabricCapacity, uint16_t maxScenesGlobal = defaultTestTableSize) : SceneTableImpl(maxScenesPerFabric, maxScenesGlobal) {} ~TestSceneTableImpl() override {} @@ -427,7 +439,7 @@ void ResetSceneTable(SceneTable * sceneTable) void TestHandlerRegistration(nlTestSuite * aSuite, void * aContext) { - SceneTable * sceneTable = scenes::GetSceneTableImpl(); + SceneTable * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); TestSceneHandler tmpHandler[scenes::kMaxClustersPerScene]; @@ -480,7 +492,7 @@ void TestHandlerRegistration(nlTestSuite * aSuite, void * aContext) void TestHandlerFunctions(nlTestSuite * aSuite, void * aContext) { - SceneTable * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, scenes::kMaxScenesPerEndpoint); + SceneTable * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); @@ -673,16 +685,13 @@ void TestHandlerFunctions(nlTestSuite * aSuite, void * aContext) void TestStoreScenes(nlTestSuite * aSuite, void * aContext) { - SceneTable * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1); + SceneTable * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); - SceneId sceneList[scenes::kMaxScenesPerFabric]; + SceneId sceneList[defaultTestFabricCapacity]; // Reset test ResetSceneTable(sceneTable); - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); // Populate scene1's EFS (Endpoint1) NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SceneSaveEFS(scene1)); @@ -796,7 +805,7 @@ void TestStoreScenes(nlTestSuite * aSuite, void * aContext) void TestOverwriteScenes(nlTestSuite * aSuite, void * aContext) { - SceneTable * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, scenes::kMaxScenesPerEndpoint); + SceneTable * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); @@ -824,7 +833,7 @@ void TestOverwriteScenes(nlTestSuite * aSuite, void * aContext) void TestIterateScenes(nlTestSuite * aSuite, void * aContext) { - SceneTable * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, scenes::kMaxScenesPerEndpoint); + SceneTable * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); @@ -861,7 +870,7 @@ void TestIterateScenes(nlTestSuite * aSuite, void * aContext) void TestRemoveScenes(nlTestSuite * aSuite, void * aContext) { - SceneTable * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, scenes::kMaxScenesPerEndpoint); + SceneTableImpl * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); @@ -948,10 +957,9 @@ void TestRemoveScenes(nlTestSuite * aSuite, void * aContext) iterator->Release(); // Remove at empty position, shouldn't trigger error - NL_TEST_ASSERT( - aSuite, - CHIP_NO_ERROR == - sceneTable->RemoveSceneTableEntryAtPosition(kTestEndpoint1, kFabric1, chip::scenes::kMaxScenesPerFabric - 1)); + NL_TEST_ASSERT(aSuite, + CHIP_NO_ERROR == + sceneTable->RemoveSceneTableEntryAtPosition(kTestEndpoint1, kFabric1, defaultTestFabricCapacity - 1)); iterator = sceneTable->IterateSceneEntries(kFabric1); NL_TEST_ASSERT(aSuite, iterator->Count() == 0); @@ -985,26 +993,23 @@ void TestRemoveScenes(nlTestSuite * aSuite, void * aContext) void TestFabricScenes(nlTestSuite * aSuite, void * aContext) { - SceneTable * sceneTable = scenes::GetSceneTableImpl(); + SceneTable * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); // Reset test ResetSceneTable(sceneTable); - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); SceneTableEntry scene; uint8_t fabric_capacity = 0; // Verify capacities are at max NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); // Fabric 1 inserts NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene1)); @@ -1020,25 +1025,25 @@ void TestFabricScenes(nlTestSuite * aSuite, void * aContext) uint8_t scene_count = 0; NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric1, scene_count)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric == scene_count); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == scene_count); // Fabric 2 inserts NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene1)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene2)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene3)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene4)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, (scenes::kMaxScenesPerFabric - 4) == fabric_capacity); + NL_TEST_ASSERT(aSuite, (defaultTestFabricCapacity - 4) == fabric_capacity); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric2, scene_count)); NL_TEST_ASSERT(aSuite, 4 == scene_count); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(scene_count)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerEndpoint - 4 == scene_count); + NL_TEST_ASSERT(aSuite, defaultTestTableSize - 4 == scene_count); // Fabric 3 inserts, should only be 4 spaces left at this point since 12 got taken NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric - 4 == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 4 == fabric_capacity); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric3, scene1)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric3, scene2)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric3, scene3)); @@ -1046,7 +1051,7 @@ void TestFabricScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric2, scene_count)); NL_TEST_ASSERT(aSuite, 4 == scene_count); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(scene_count)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerEndpoint == scene_count); + NL_TEST_ASSERT(aSuite, defaultTestTableSize == scene_count); // Checks capacity is now 0 accross all fabrics NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); @@ -1126,11 +1131,11 @@ void TestFabricScenes(nlTestSuite * aSuite, void * aContext) // Verify capacity updated for all fabrics NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric - 4 == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 4 == fabric_capacity); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric - 4 == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 4 == fabric_capacity); // Verify we can now write more scenes in scene fabric 2 NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene5)); @@ -1150,9 +1155,9 @@ void TestFabricScenes(nlTestSuite * aSuite, void * aContext) // Verify capacity updated properly NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric - 4 == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 4 == fabric_capacity); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric - 4 == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 4 == fabric_capacity); // Verify Fabric 3 still there NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId1, scene)); @@ -1214,52 +1219,48 @@ void TestFabricScenes(nlTestSuite * aSuite, void * aContext) // Verify capacity updated for all fabrics NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); } void TestEndpointScenes(nlTestSuite * aSuite, void * aContext) { // Get Count for Endpoint 1 - SceneTable * sceneTable = scenes::GetSceneTableImpl(); + SceneTable * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); // Reset test ResetSceneTable(sceneTable); - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - SceneTableEntry scene; // Verify all endpoints are empty uint8_t endpoint_scene_count = 0; // Get Count for Endpoint 1 - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); // Get Count for Endpoint 2 - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); // Get Count for Endpoint 3 - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); // Test Scenes insertion not accessible accross all endpoints - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene1)); @@ -1269,25 +1270,25 @@ void TestEndpointScenes(nlTestSuite * aSuite, void * aContext) uint8_t fabric_capacity = 0; NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric - 1 == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 1 == fabric_capacity); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric - 1 == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 1 == fabric_capacity); // Endpoint2 - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); // Endpoint3 - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); // Check if scene present in Endpoint 1 - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); @@ -1296,13 +1297,13 @@ void TestEndpointScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, scene == scene1); // Check if scene present in Endpoint 2 - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); // Check if scene present in Endpoint 3 - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); @@ -1310,7 +1311,7 @@ void TestEndpointScenes(nlTestSuite * aSuite, void * aContext) // Test removal on different endpoints do not affect each endpoints // Insertion on Endpoint2 - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene1)); @@ -1318,14 +1319,14 @@ void TestEndpointScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, scene == scene1); // Removal on Endpoint1 - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, sceneId1)); NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); // Scene present on Endpoint2 - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); @@ -1335,7 +1336,7 @@ void TestEndpointScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, sceneId1)); // Removal on Endpoint 1 - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric2, sceneId1)); @@ -1343,13 +1344,13 @@ void TestEndpointScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); // Endpoint 2 - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); // Endpoint 3 - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); @@ -1357,7 +1358,7 @@ void TestEndpointScenes(nlTestSuite * aSuite, void * aContext) // Test the fabric capacity accross endpoint // Fill fabric 1 endpoint 1 - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene1)); @@ -1385,26 +1386,26 @@ void TestEndpointScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); // Endpoints 2 and 3 should be unaffected - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); // Verify filling Fabric on endpoint 2 does not affect on endpoint 3 despite Max per fabric being reached by adding Endpoint1 // and Endpoint2 // Fill fabric 1 endpoint 2 - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene1)); @@ -1417,7 +1418,7 @@ void TestEndpointScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene8)); // Fill fabric 2 endpoint 2 - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene1)); @@ -1430,16 +1431,16 @@ void TestEndpointScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene8)); // scene count to Endpoint - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); // Test removal of fabric clears scene fabric on all endpoints - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); sceneTable->RemoveFabric(kFabric1); @@ -1452,7 +1453,7 @@ void TestEndpointScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId8, scene)); - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); @@ -1467,17 +1468,17 @@ void TestEndpointScenes(nlTestSuite * aSuite, void * aContext) sceneTable->RemoveFabric(kFabric2); // Validate endpoints are empty - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); @@ -1486,53 +1487,53 @@ void TestEndpointScenes(nlTestSuite * aSuite, void * aContext) // Validate Fabric capacities at maximum accross all endpoints // Endpoint 1 - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); // Endpoint 2 - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); // Endpoint 3 - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); // Test of Get with changes to Endpoint capacity // Endpoint 1 - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, scenes::kMaxScenesPerEndpoint - 2); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize - 2); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric - 1 == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 1 == fabric_capacity); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric - 1 == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 1 == fabric_capacity); // Test Endpoint 2's capacity remains unaffected - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); // Test Insertion then change of capacity - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene1)); @@ -1540,22 +1541,22 @@ void TestEndpointScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene3)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene4)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric - 4 == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 4 == fabric_capacity); - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, scenes::kMaxScenesPerFabric - 2); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestFabricCapacity - 2); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric - 6 == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 6 == fabric_capacity); - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, scenes::kMaxScenesPerFabric - 4); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestFabricCapacity - 4); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); // Test making the endpoint scene table smaller than the actual number of scenes on it - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, scenes::kMaxScenesPerFabric - 5); + sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestFabricCapacity - 5); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); @@ -1564,15 +1565,12 @@ void TestEndpointScenes(nlTestSuite * aSuite, void * aContext) void TestOTAChanges(nlTestSuite * aSuite, void * aContext) { - SceneTable * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1); + SceneTable * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); NL_TEST_ASSERT(aSuite, nullptr != sceneTable); VerifyOrReturn(nullptr != sceneTable); // Reset test ResetSceneTable(sceneTable); - sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); SceneTableEntry scene; uint8_t fabric_capacity = 0; @@ -1589,8 +1587,9 @@ void TestOTAChanges(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene8)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); - auto * iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric == iterator->Count()); + uint8_t scene_table_fabric1_capacity = fabric_capacity; + auto * iterator = sceneTable->IterateSceneEntries(kFabric1); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == iterator->Count()); iterator->Release(); // Fill fabric 2 to capacity @@ -1604,14 +1603,56 @@ void TestOTAChanges(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene8)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); - iterator = sceneTable->IterateSceneEntries(kFabric2); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric == iterator->Count()); + uint8_t scene_table_fabric2_capacity = fabric_capacity; + iterator = sceneTable->IterateSceneEntries(kFabric2); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == iterator->Count()); iterator->Release(); // SceneTable should be full at this point uint8_t scene_count; NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(scene_count)); // Global count should not have been modified - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerEndpoint == scene_count); + NL_TEST_ASSERT(aSuite, defaultTestTableSize == scene_count); + + // Create a scene table with a greater capacity than the original one (Max allowed capacity from gen_config.h) + TestSceneTableImpl ExpandedSceneTable(scenes::kMaxScenesPerFabric, scenes::kMaxScenesPerEndpoint); + NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.Init(&testStorage)); + ExpandedSceneTable.SetEndpoint(kTestEndpoint1); + + NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); + NL_TEST_ASSERT(aSuite, + scene_table_fabric1_capacity + (scenes::kMaxScenesPerFabric - defaultTestFabricCapacity) == fabric_capacity); + NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.GetRemainingCapacity(kFabric2, fabric_capacity)); + NL_TEST_ASSERT(aSuite, + scene_table_fabric2_capacity + (scenes::kMaxScenesPerFabric - defaultTestFabricCapacity) == fabric_capacity); + + // We should be able to insert 4 scenes into fabric 2 + NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.SetSceneTableEntry(kFabric2, scene9)); + NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.SetSceneTableEntry(kFabric2, scene13)); + NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.SetSceneTableEntry(kFabric2, scene14)); + NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.SetSceneTableEntry(kFabric2, scene15)); + NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.GetRemainingCapacity(kFabric2, fabric_capacity)); + NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); + + // Fabric 1's capacity should have remain unchanged + NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); + NL_TEST_ASSERT(aSuite, + scene_table_fabric1_capacity + (scenes::kMaxScenesPerFabric - defaultTestFabricCapacity) == fabric_capacity); + + // Global count should have increased by (scenes::kMaxScenesPerFarbic - defaultTestFabricCapacity) + NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.GetEndpointSceneCount(scene_count)); + NL_TEST_ASSERT(aSuite, defaultTestTableSize + (scenes::kMaxScenesPerFabric - defaultTestFabricCapacity) == scene_count); + + // Same test for 4 insertion in fabric 1 + NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.SetSceneTableEntry(kFabric1, scene9)); + NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.SetSceneTableEntry(kFabric1, scene13)); + NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.SetSceneTableEntry(kFabric1, scene14)); + NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.SetSceneTableEntry(kFabric1, scene15)); + NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); + NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); + + // Global count should be at defaultTestTableSize + (scenes::kMaxScenesPerEndpoint - defaultTestTableSize) + NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.GetEndpointSceneCount(scene_count)); + NL_TEST_ASSERT(aSuite, defaultTestTableSize + (scenes::kMaxScenesPerEndpoint - defaultTestTableSize) == scene_count); // Test failure to init a SceneTable with sizes above the defined max scenes per fabric or globaly TestSceneTableImpl SceneTableTooManyPerFabric(scenes::kMaxScenesPerFabric + 1, scenes::kMaxScenesPerEndpoint); @@ -1622,8 +1663,12 @@ void TestOTAChanges(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, CHIP_ERROR_INVALID_INTEGER_VALUE == SceneTableTooManyGlobal.Init(&testStorage)); SceneTableTooManyGlobal.Finish(); - // Create a new table with a different limit of scenes per fabric - TestSceneTableImpl ReducedSceneTable(scenes::kMaxScenesPerFabric - 1, scenes::kMaxScenesPerEndpoint - 2); + // Create a new table with a lower limit of scenes per fabric + uint8_t newCapacity = defaultTestFabricCapacity - 1; + uint8_t newTableSize = defaultTestTableSize - 2; + uint8_t capacityDifference = static_cast(scenes::kMaxScenesPerFabric - newCapacity); + uint8_t tableSizeDifference = static_cast(scenes::kMaxScenesPerEndpoint - newTableSize); + TestSceneTableImpl ReducedSceneTable(newCapacity, newTableSize); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.Init(&testStorage)); ReducedSceneTable.SetEndpoint(kTestEndpoint1); @@ -1632,6 +1677,8 @@ void TestOTAChanges(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerEndpoint == scene_count); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); + NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetRemainingCapacity(kFabric2, fabric_capacity)); + NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); // Load a scene from fabric 1, this should adjust fabric 1 scene count in flash NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetSceneTableEntry(kFabric1, sceneId1, scene)); @@ -1639,66 +1686,74 @@ void TestOTAChanges(nlTestSuite * aSuite, void * aContext) // The number count of scenes in Fabric 1 should have been adjusted here iterator = ReducedSceneTable.IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric - 1 == iterator->Count()); + NL_TEST_ASSERT(aSuite, newCapacity == iterator->Count()); iterator->Release(); - // Capacity should still be 0 + // Capacity should still be 0 in fabric 1 + NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetEndpointSceneCount(scene_count)); - // Global count should have been reduced by 1 - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerEndpoint - 1 == scene_count); + // Global count should have been reduced by the difference between the max fabric capacity of a fabric and the + // new fabric capacity since we haven't loaded from fabric 2 yet + NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerEndpoint - capacityDifference == scene_count); // Remove a Scene from the Fabric 1 - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.RemoveSceneTableEntry(kFabric1, scene.mStorageId)); + NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.RemoveSceneTableEntry(kFabric1, scene1.mStorageId)); // Check count updated for fabric iterator = ReducedSceneTable.IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric - 2 == iterator->Count()); + NL_TEST_ASSERT(aSuite, static_cast(newCapacity - 1) == iterator->Count()); iterator->Release(); // Check fabric still doesn't have capacity because fabric 2 still have a higher number of scene than allowed NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); // Remove another scene from fabric 1 NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.RemoveSceneTableEntry(kFabric1, scene2.mStorageId)); + NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.RemoveSceneTableEntry(kFabric1, scene3.mStorageId)); + NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.RemoveSceneTableEntry(kFabric1, scene4.mStorageId)); + NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.RemoveSceneTableEntry(kFabric1, scene5.mStorageId)); + NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.RemoveSceneTableEntry(kFabric1, scene6.mStorageId)); // Check count updated for fabric iterator = ReducedSceneTable.IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric - 3 == iterator->Count()); + NL_TEST_ASSERT(aSuite, static_cast(newCapacity - 6) == iterator->Count()); iterator->Release(); - // Global count should now have been adjusted + // Confirm global count has been updated NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetEndpointSceneCount(scene_count)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerEndpoint - 3 == scene_count); - // Confirm we now have capacity + NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerEndpoint - capacityDifference - 6 == scene_count); + // Confirm we now have capacity in fabric one NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); NL_TEST_ASSERT(aSuite, 1 == fabric_capacity); - // Load a scene from fabric 2, this should adjust fabric 1 scene count in flash + // Load a scene from fabric 2, this should adjust fabric 2 scene count in flash NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetSceneTableEntry(kFabric2, sceneId1, scene)); NL_TEST_ASSERT(aSuite, scene == scene1); - // The number count of scenes in Fabric 1 should have been adjusted here + // The number count of scenes in Fabric 2 should have been adjusted here iterator = ReducedSceneTable.IterateSceneEntries(kFabric2); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric - 1 == iterator->Count()); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 1 == iterator->Count()); iterator->Release(); - // Global count should now have been adjusted + // Global count should also have been adjusted NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetEndpointSceneCount(scene_count)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerEndpoint - 4 == scene_count); - // Confirm we now have capacity in the first fabric since we previously removed 2 scenes form there + // had 24 scenes, truncated 5 from both (10) and deleted 6 from fabric 1: 8 scenes left + NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerEndpoint - tableSizeDifference - 6 == scene_count); + // Confirm we now have capacity of 6 in the first fabric since we previously removed 6 scenes form there NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 2 == fabric_capacity); + NL_TEST_ASSERT(aSuite, 6 == fabric_capacity); // Fabric 2 should still be at capacity NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetRemainingCapacity(kFabric2, fabric_capacity)); NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); ReducedSceneTable.Finish(); - // The Scene 8 should now have been deleted from the memory and thus not be accessible from both fabrics in the original scene - // table + // The Scene 8 should now have been truncated from the memory and thus not be accessible from both fabrics in the + // original scene table NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId8, scene)); NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId8, scene)); // The Remaining capacity in the original scene table therefore have been modified as well - // Fabric 2 should still be at capacity + // Fabric 2 should still be almost at capacity NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 3 == fabric_capacity); + NL_TEST_ASSERT(aSuite, 7 == fabric_capacity); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + NL_TEST_ASSERT(aSuite, 1 == fabric_capacity); } diff --git a/src/app/tests/suites/certification/Test_TC_S_1_1.yaml b/src/app/tests/suites/certification/Test_TC_S_1_1.yaml index 0fdc16b325b0d7..ed3fe73f726710 100644 --- a/src/app/tests/suites/certification/Test_TC_S_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_S_1_1.yaml @@ -48,10 +48,7 @@ tests: response: constraints: type: bitmap32 - hasMasksSet: [0x1] - # This needs to be changed in the Name Support PR: https://github.com/project-chip/connectedhomeip/pull/29639 - # Issue in Test plan repo: https://github.com/CHIP-Specifications/chip-test-plans/issues/3515 - #hasMasksClear: [0x1] + hasMasksClear: [0x1] - label: "Step 3a: Read FeatureMap (global attribute 65532)" PICS: S.S.F00 @@ -62,6 +59,22 @@ tests: type: bitmap32 hasMasksSet: [0x1] + - label: "Step 3b: Read FeatureMap (global attribute 65532)" + command: "readAttribute" + attribute: "FeatureMap" + response: + constraints: + type: bitmap32 + hasMasksSet: [0x2] + + - label: "Step 3c: Read FeatureMap (global attribute 65532)" + command: "readAttribute" + attribute: "FeatureMap" + response: + constraints: + type: bitmap32 + hasMasksSet: [0x4] + - label: "Step 4: Read Mandatory attributes in AttributeList (global attribute 65531)" diff --git a/src/app/tests/suites/certification/ci-pics-values b/src/app/tests/suites/certification/ci-pics-values index 4869039cf87fef..e2f080c858c92c 100644 --- a/src/app/tests/suites/certification/ci-pics-values +++ b/src/app/tests/suites/certification/ci-pics-values @@ -679,7 +679,7 @@ S.S.AM=0 S.S.AO=0 S.S.F00=1 S.S.F01=1 -S.S.F02=0 +S.S.F02=1 S.S.F03=0 PICS_SC_RECALL_SCENE_TRANSITION_TIME=1 diff --git a/src/app/util/mock/include/zap-generated/gen_config.h b/src/app/util/mock/include/zap-generated/gen_config.h index 08d2d851b6b93d..60d57388626fa6 100644 --- a/src/app/util/mock/include/zap-generated/gen_config.h +++ b/src/app/util/mock/include/zap-generated/gen_config.h @@ -18,3 +18,4 @@ #pragma once #define EMBER_BINDING_TABLE_SIZE 20 +#define MATTER_SCENES_TABLE_SIZE 24 diff --git a/src/app/zap-templates/templates/app/gen_config.zapt b/src/app/zap-templates/templates/app/gen_config.zapt index 01048170425067..4accc4a61be151 100644 --- a/src/app/zap-templates/templates/app/gen_config.zapt +++ b/src/app/zap-templates/templates/app/gen_config.zapt @@ -5,57 +5,58 @@ /**** Cluster endpoint counts ****/ {{#all_user_clusters}} -#define EMBER_AF_{{asDelimitedMacro define}}_{{asDelimitedMacro side}}_ENDPOINT_COUNT ({{user_endpoint_count_by_cluster id side}}) +#define EMBER_AF_{{as_delimited_macro define}}_{{as_delimited_macro side}}_ENDPOINT_COUNT ({{user_endpoint_count_by_cluster id side}}) {{/all_user_clusters}} /**** Cluster Plugins ****/ {{#all_user_clusters}} // Use this macro to check if the {{side}} side of the {{name}} cluster is included -#define ZCL_USING_{{asDelimitedMacro define}}_{{asDelimitedMacro side}} -#define EMBER_AF_PLUGIN_{{asDelimitedMacro name}}_{{asDelimitedMacro side}} -{{#if (isServer side)}} -#define EMBER_AF_PLUGIN_{{asDelimitedMacro name}} +#define ZCL_USING_{{as_delimited_macro define}}_{{as_delimited_macro side}} +#define EMBER_AF_PLUGIN_{{as_delimited_macro name}}_{{as_delimited_macro side}} +{{#if (is_server side)}} +#define EMBER_AF_PLUGIN_{{as_delimited_macro name}} {{/if}} -{{#if (isStrEqual name "Color Control")}} -{{#if (isServer side)}} +{{#if (is_str_equal name "Color Control")}} +{{#if (is_server side)}} // User options for {{side}} plugin {{name}} #define EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_XY #define EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_TEMP #define EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_HSV {{/if}} -{{else if (isStrEqual name "IAS Zone")}} +{{else if (is_str_equal name "IAS Zone")}} // User options for {{side}} plugin {{name}} -{{#if (isServer side)}} +{{#if (is_server side)}} #define EMBER_AF_PLUGIN_IAS_ZONE_SERVER_ZONE_TYPE 541 {{else}} #define EMBER_AF_PLUGIN_IAS_ZONE_CLIENT_MAX_DEVICES 10 {{/if}} -{{else if (isStrEqual name "Level Control")}} -{{#if (isServer side)}} +{{else if (is_str_equal name "Level Control")}} +{{#if (is_server side)}} // User options for {{side}} plugin {{name}} #define EMBER_AF_PLUGIN_LEVEL_CONTROL_MAXIMUM_LEVEL 254 #define EMBER_AF_PLUGIN_LEVEL_CONTROL_MINIMUM_LEVEL 0 #define EMBER_AF_PLUGIN_LEVEL_CONTROL_RATE 0 {{/if}} -{{else if (isStrEqual name "Scenes")}} -{{#if (isServer side)}} +{{else if (is_str_equal name "Scenes")}} +{{#if (is_server side)}} // User options for {{side}} plugin {{name}} -// Cluster spec 1.4.8.2 -#ifdef CHIP_CONFIG_MAX_SCENES_PER_FABRIC -#define MATTER_SCENES_TABLE_SIZE CHIP_CONFIG_MAX_SCENES_PER_FABRIC -#else -#define MATTER_SCENES_TABLE_SIZE 16 -#endif {{/if}} {{#all_user_cluster_generated_attributes}} -{{#if (isStrEqual ../name clusterName)}} -{{#if (isStrEqual name "FeatureMap")}} - +{{#if (is_str_equal ../name clusterName)}} +{{#if (is_str_equal name "FeatureMap")}} // Scenes FeatureMap Attribute Toggle Scenes Name feature // App cluster specs 1.4.4 #define MATTER_CLUSTER_SCENE_NAME_SUPPORT_MASK 0x0001 #define MATTER_CLUSTER_SCENE_NAME_SUPPORT ({{asHex defaultValue 4}} & MATTER_CLUSTER_SCENE_NAME_SUPPORT_MASK) +// Scenes FeatureMap Table Size feature used for the MATTER_SCENES_TABLE_SIZE define +// App cluster specs 1.4.4.2 +#define MATTER_CLUSTER_TABLE_SIZE_SUPPORT_MASK 0x0001 +#define MATTER_CLUSTER_TABLE_SIZE_SUPPORT ({{asHex defaultValue 4}} & MATTER_CLUSTER_TABLE_SIZE_SUPPORT_MASK) +{{/if}} +{{#if (is_str_equal name "SceneTableSize")}} +// Cluster spec 1.4.8.7 +#define MATTER_SCENES_TABLE_SIZE {{defaultValue}} {{/if}} {{/if}} {{/all_user_cluster_generated_attributes}} diff --git a/src/lib/core/CHIPConfig.h b/src/lib/core/CHIPConfig.h index 30d6d6b8a65b36..5ef55d3ff2239a 100644 --- a/src/lib/core/CHIPConfig.h +++ b/src/lib/core/CHIPConfig.h @@ -1403,13 +1403,6 @@ extern const char CHIP_NON_PRODUCTION_MARKER[]; #define CHIP_CONFIG_MAX_SUBSCRIPTION_RESUMPTION_STORAGE_CONCURRENT_ITERATORS 2 #endif -/** - * @brief The minimum number of scenes to support according to spec - */ -#ifndef CHIP_CONFIG_MAX_SCENES_PER_ENDPOINT -#define CHIP_CONFIG_MAX_SCENES_PER_ENDPOINT 16 -#endif - /** * @brief Maximum length of Scene names */ @@ -1417,13 +1410,6 @@ extern const char CHIP_NON_PRODUCTION_MARKER[]; #define CHIP_CONFIG_SCENES_CLUSTER_MAXIMUM_NAME_LENGTH 16 #endif -/** - * @brief The maximum number of scenes allowed on a single fabric - */ -#ifndef CHIP_CONFIG_SCENES_MAX_PER_FABRIC -#define CHIP_CONFIG_SCENES_MAX_PER_FABRIC (CHIP_CONFIG_MAX_SCENES_PER_ENDPOINT / 2) -#endif - /** * @brief The maximum number of attribute value pairs in an extension field set. */ From 641842f9141249a68bee71e6fb7c82340097e216 Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs Date: Mon, 16 Oct 2023 17:24:49 -0400 Subject: [PATCH 2/6] Updated Fabric capacity rule to apply less than half of SceneTableSize and adapted the tests --- .../clusters/scenes-server/SceneTableImpl.cpp | 2 +- .../clusters/scenes-server/SceneTableImpl.h | 2 +- src/app/tests/TestSceneTable.cpp | 120 +++++++----------- 3 files changed, 50 insertions(+), 74 deletions(-) diff --git a/src/app/clusters/scenes-server/SceneTableImpl.cpp b/src/app/clusters/scenes-server/SceneTableImpl.cpp index b37ab57b5005b8..ce890247be29bb 100644 --- a/src/app/clusters/scenes-server/SceneTableImpl.cpp +++ b/src/app/clusters/scenes-server/SceneTableImpl.cpp @@ -929,7 +929,7 @@ void DefaultSceneTableImpl::SetTableSize(uint16_t endpointSceneTableSize) { // Verify the endpoint passed size respects the limits of the device configuration mMaxScenesPerEndpoint = (kMaxScenesPerEndpoint < endpointSceneTableSize) ? kMaxScenesPerEndpoint : endpointSceneTableSize; - mMaxScenesPerFabric = static_cast(mMaxScenesPerEndpoint / 2); + mMaxScenesPerFabric = static_cast((mMaxScenesPerEndpoint - 1) / 2); } DefaultSceneTableImpl::SceneEntryIterator * DefaultSceneTableImpl::IterateSceneEntries(FabricIndex fabric) diff --git a/src/app/clusters/scenes-server/SceneTableImpl.h b/src/app/clusters/scenes-server/SceneTableImpl.h index 96c4a962619fe3..60a378f43c3ce8 100644 --- a/src/app/clusters/scenes-server/SceneTableImpl.h +++ b/src/app/clusters/scenes-server/SceneTableImpl.h @@ -28,7 +28,7 @@ namespace chip { namespace scenes { -static constexpr uint16_t kMaxScenesPerFabric = MATTER_SCENES_TABLE_SIZE / 2; +static constexpr uint16_t kMaxScenesPerFabric = (MATTER_SCENES_TABLE_SIZE - 1) / 2; static constexpr uint16_t kMaxScenesPerEndpoint = MATTER_SCENES_TABLE_SIZE; using clusterId = chip::ClusterId; diff --git a/src/app/tests/TestSceneTable.cpp b/src/app/tests/TestSceneTable.cpp index b7b5e47a6761ce..08ada73b3729a1 100644 --- a/src/app/tests/TestSceneTable.cpp +++ b/src/app/tests/TestSceneTable.cpp @@ -39,7 +39,7 @@ namespace TestScenes { // TestTableSize constexpr uint8_t defaultTestTableSize = 16; -constexpr uint8_t defaultTestFabricCapacity = 8; +constexpr uint8_t defaultTestFabricCapacity = (defaultTestTableSize - 1) / 2; // Test Cluster ID constexpr chip::ClusterId kOnOffClusterId = 0x0006; @@ -130,7 +130,7 @@ SceneTableEntry scene8(sceneId8, sceneData8); SceneTableEntry scene9(sceneId9, sceneData9); SceneTableEntry scene10(sceneId1, sceneData10); SceneTableEntry scene11(sceneId5, sceneData11); -SceneTableEntry scene12(sceneId8, sceneData12); +SceneTableEntry scene12(sceneId7, sceneData12); SceneTableEntry scene13(sceneId10, sceneData13); SceneTableEntry scene14(sceneId11, sceneData14); SceneTableEntry scene15(sceneId12, sceneData15); @@ -731,7 +731,6 @@ void TestStoreScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene5)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene6)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene7)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene8)); // Too many scenes for 1 fabric NL_TEST_ASSERT(aSuite, CHIP_ERROR_NO_MEMORY == sceneTable->SetSceneTableEntry(kFabric1, scene9)); @@ -763,8 +762,6 @@ void TestStoreScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, scene == scene6); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); NL_TEST_ASSERT(aSuite, scene == scene7); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId8, scene)); - NL_TEST_ASSERT(aSuite, scene == scene8); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SceneApplyEFS(scene)); // Test error when list too small in a full table @@ -794,10 +791,6 @@ void TestStoreScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, 1 == sceneListSpan.size()); NL_TEST_ASSERT(aSuite, kScene7 == sceneList[0]); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup4, sceneListSpan)); - NL_TEST_ASSERT(aSuite, 1 == sceneListSpan.size()); - NL_TEST_ASSERT(aSuite, kScene8 == sceneList[0]); - uint8_t sceneCount = 0; sceneTable->GetEndpointSceneCount(sceneCount); sceneTable->GetFabricSceneCount(kFabric1, sceneCount); @@ -827,7 +820,7 @@ void TestOverwriteScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); NL_TEST_ASSERT(aSuite, scene == scene11); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId8, scene)); + NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); NL_TEST_ASSERT(aSuite, scene == scene12); } @@ -844,7 +837,7 @@ void TestIterateScenes(nlTestSuite * aSuite, void * aContext) if (iterator) { - NL_TEST_ASSERT(aSuite, iterator->Count() == 8); + NL_TEST_ASSERT(aSuite, iterator->Count() == 7); NL_TEST_ASSERT(aSuite, iterator->Next(scene)); NL_TEST_ASSERT(aSuite, scene == scene10); NL_TEST_ASSERT(aSuite, iterator->Next(scene)); @@ -858,8 +851,6 @@ void TestIterateScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, iterator->Next(scene)); NL_TEST_ASSERT(aSuite, scene == scene6); NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene7); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); NL_TEST_ASSERT(aSuite, scene == scene12); NL_TEST_ASSERT(aSuite, iterator->Next(scene) == false); @@ -882,7 +873,7 @@ void TestRemoveScenes(nlTestSuite * aSuite, void * aContext) // Remove middle NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, scene5.mStorageId)); auto * iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 7); + NL_TEST_ASSERT(aSuite, iterator->Count() == 6); NL_TEST_ASSERT(aSuite, iterator->Next(scene)); NL_TEST_ASSERT(aSuite, scene == scene10); iterator->Release(); @@ -890,7 +881,7 @@ void TestRemoveScenes(nlTestSuite * aSuite, void * aContext) // Add scene in middle, a spot should have been freed NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene9)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 8); + NL_TEST_ASSERT(aSuite, iterator->Count() == 7); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId9, scene)); NL_TEST_ASSERT(aSuite, scene == scene9); iterator->Release(); @@ -898,7 +889,7 @@ void TestRemoveScenes(nlTestSuite * aSuite, void * aContext) // Remove the recently added scene 9 NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, scene9.mStorageId)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 7); + NL_TEST_ASSERT(aSuite, iterator->Count() == 6); NL_TEST_ASSERT(aSuite, iterator->Next(scene)); NL_TEST_ASSERT(aSuite, scene == scene10); iterator->Release(); @@ -906,7 +897,7 @@ void TestRemoveScenes(nlTestSuite * aSuite, void * aContext) // Remove first NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntryAtPosition(kTestEndpoint1, kFabric1, 0)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 6); + NL_TEST_ASSERT(aSuite, iterator->Count() == 5); NL_TEST_ASSERT(aSuite, iterator->Next(scene)); NL_TEST_ASSERT(aSuite, scene == scene2); iterator->Release(); @@ -914,7 +905,7 @@ void TestRemoveScenes(nlTestSuite * aSuite, void * aContext) // Remove Next NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, scene3.mStorageId)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 5); + NL_TEST_ASSERT(aSuite, iterator->Count() == 4); NL_TEST_ASSERT(aSuite, iterator->Next(scene)); NL_TEST_ASSERT(aSuite, scene == scene2); NL_TEST_ASSERT(aSuite, iterator->Next(scene)); @@ -923,34 +914,27 @@ void TestRemoveScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, scene2.mStorageId)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 4); + NL_TEST_ASSERT(aSuite, iterator->Count() == 3); NL_TEST_ASSERT(aSuite, iterator->Next(scene)); NL_TEST_ASSERT(aSuite, scene == scene4); iterator->Release(); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, scene4.mStorageId)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 3); + NL_TEST_ASSERT(aSuite, iterator->Count() == 2); NL_TEST_ASSERT(aSuite, iterator->Next(scene)); NL_TEST_ASSERT(aSuite, scene == scene6); iterator->Release(); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, scene6.mStorageId)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 2); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene7); - iterator->Release(); - - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, scene7.mStorageId)); - iterator = sceneTable->IterateSceneEntries(kFabric1); NL_TEST_ASSERT(aSuite, iterator->Count() == 1); NL_TEST_ASSERT(aSuite, iterator->Next(scene)); NL_TEST_ASSERT(aSuite, scene == scene12); iterator->Release(); // Remove last - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, scene8.mStorageId)); + NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, scene7.mStorageId)); iterator = sceneTable->IterateSceneEntries(kFabric1); NL_TEST_ASSERT(aSuite, iterator->Count() == 0); NL_TEST_ASSERT(aSuite, iterator->Next(scene) == false); @@ -1019,7 +1003,6 @@ void TestFabricScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene5)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene6)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene7)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene8)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); @@ -1037,19 +1020,19 @@ void TestFabricScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); NL_TEST_ASSERT(aSuite, (defaultTestFabricCapacity - 4) == fabric_capacity); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric2, scene_count)); - NL_TEST_ASSERT(aSuite, 4 == scene_count); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(scene_count)); - NL_TEST_ASSERT(aSuite, defaultTestTableSize - 4 == scene_count); + NL_TEST_ASSERT(aSuite, 11 == scene_count); // Fabric 3 inserts, should only be 4 spaces left at this point since 12 got taken NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 4 == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestTableSize - 11 == fabric_capacity); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric3, scene1)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric3, scene2)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric3, scene3)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric3, scene4)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric2, scene_count)); - NL_TEST_ASSERT(aSuite, 4 == scene_count); + NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric3, scene5)); + NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric3, scene_count)); + NL_TEST_ASSERT(aSuite, 5 == scene_count); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(scene_count)); NL_TEST_ASSERT(aSuite, defaultTestTableSize == scene_count); @@ -1062,7 +1045,7 @@ void TestFabricScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); // To many scenes accross fabrics (Max scenes accross fabrics == 16) - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NO_MEMORY == sceneTable->SetSceneTableEntry(kFabric3, scene5)); + NL_TEST_ASSERT(aSuite, CHIP_ERROR_NO_MEMORY == sceneTable->SetSceneTableEntry(kFabric3, scene6)); NL_TEST_ASSERT(aSuite, CHIP_ERROR_NO_MEMORY == sceneTable->SetSceneTableEntry(kFabric2, scene5)); // Verifying all inserted scenes are accessible @@ -1080,8 +1063,6 @@ void TestFabricScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, scene == scene6); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); NL_TEST_ASSERT(aSuite, scene == scene7); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId8, scene)); - NL_TEST_ASSERT(aSuite, scene == scene8); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); NL_TEST_ASSERT(aSuite, scene == scene1); @@ -1100,6 +1081,8 @@ void TestFabricScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, scene == scene3); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId4, scene)); NL_TEST_ASSERT(aSuite, scene == scene4); + NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId5, scene)); + NL_TEST_ASSERT(aSuite, scene == scene5); // Remove Fabric 1 NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveFabric(kFabric1)); @@ -1107,7 +1090,7 @@ void TestFabricScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric1, scene_count)); NL_TEST_ASSERT(aSuite, 0 == scene_count); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(scene_count)); - NL_TEST_ASSERT(aSuite, 8 == scene_count); + NL_TEST_ASSERT(aSuite, 9 == scene_count); NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); @@ -1135,29 +1118,26 @@ void TestFabricScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 4 == fabric_capacity); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 4 == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 5 == fabric_capacity); // Verify we can now write more scenes in scene fabric 2 NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene5)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene6)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene7)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene8)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId5, scene)); NL_TEST_ASSERT(aSuite, scene == scene5); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId6, scene)); NL_TEST_ASSERT(aSuite, scene == scene6); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId7, scene)); NL_TEST_ASSERT(aSuite, scene == scene7); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId8, scene)); - NL_TEST_ASSERT(aSuite, scene == scene8); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric2, scene_count)); - NL_TEST_ASSERT(aSuite, 8 == scene_count); + NL_TEST_ASSERT(aSuite, 7 == scene_count); // Verify capacity updated properly NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 4 == fabric_capacity); + NL_TEST_ASSERT(aSuite, 4 == fabric_capacity); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 4 == fabric_capacity); + NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 5 == fabric_capacity); // Verify Fabric 3 still there NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId1, scene)); @@ -1168,6 +1148,8 @@ void TestFabricScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, scene == scene3); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId4, scene)); NL_TEST_ASSERT(aSuite, scene == scene4); + NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId5, scene)); + NL_TEST_ASSERT(aSuite, scene == scene5); // Remove Fabric 2 NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveFabric(kFabric2)); @@ -1175,7 +1157,7 @@ void TestFabricScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric2, scene_count)); NL_TEST_ASSERT(aSuite, 0 == scene_count); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(scene_count)); - NL_TEST_ASSERT(aSuite, 4 == scene_count); + NL_TEST_ASSERT(aSuite, 5 == scene_count); NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId2, scene)); NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId3, scene)); @@ -1183,11 +1165,10 @@ void TestFabricScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId5, scene)); NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId6, scene)); NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId7, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId8, scene)); // Verify Fabric 3 still there NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric3, scene_count)); - NL_TEST_ASSERT(aSuite, 4 == scene_count); + NL_TEST_ASSERT(aSuite, 5 == scene_count); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId1, scene)); NL_TEST_ASSERT(aSuite, scene == scene1); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId2, scene)); @@ -1196,6 +1177,8 @@ void TestFabricScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, scene == scene3); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId4, scene)); NL_TEST_ASSERT(aSuite, scene == scene4); + NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId5, scene)); + NL_TEST_ASSERT(aSuite, scene == scene5); // Remove Fabric 3 NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveFabric(kFabric3)); @@ -1208,6 +1191,7 @@ void TestFabricScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric3, sceneId2, scene)); NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric3, sceneId3, scene)); NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric3, sceneId4, scene)); + NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric3, sceneId5, scene)); // Confirm all counts are at 0 NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric1, scene_count)); @@ -1368,7 +1352,6 @@ void TestEndpointScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene5)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene6)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene7)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene8)); // Fill fabric 2 endpoint 1 NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene1)); @@ -1378,7 +1361,6 @@ void TestEndpointScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene5)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene6)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene7)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene8)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); @@ -1415,7 +1397,6 @@ void TestEndpointScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene5)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene6)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene7)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene8)); // Fill fabric 2 endpoint 2 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); @@ -1428,7 +1409,6 @@ void TestEndpointScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene5)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene6)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene7)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene8)); // scene count to Endpoint sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3, defaultTestTableSize); @@ -1573,7 +1553,8 @@ void TestOTAChanges(nlTestSuite * aSuite, void * aContext) ResetSceneTable(sceneTable); SceneTableEntry scene; - uint8_t fabric_capacity = 0; + uint8_t fabric_capacity = 0; + uint8_t fabricsFullCount = defaultTestTableSize - 2; // Fill scene table // Fill fabric 1 to capacity @@ -1584,7 +1565,6 @@ void TestOTAChanges(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene5)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene6)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene7)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene8)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); uint8_t scene_table_fabric1_capacity = fabric_capacity; @@ -1600,7 +1580,6 @@ void TestOTAChanges(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene5)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene6)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene7)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene8)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); uint8_t scene_table_fabric2_capacity = fabric_capacity; @@ -1611,7 +1590,7 @@ void TestOTAChanges(nlTestSuite * aSuite, void * aContext) uint8_t scene_count; NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(scene_count)); // Global count should not have been modified - NL_TEST_ASSERT(aSuite, defaultTestTableSize == scene_count); + NL_TEST_ASSERT(aSuite, fabricsFullCount == scene_count); // Create a scene table with a greater capacity than the original one (Max allowed capacity from gen_config.h) TestSceneTableImpl ExpandedSceneTable(scenes::kMaxScenesPerFabric, scenes::kMaxScenesPerEndpoint); @@ -1640,7 +1619,7 @@ void TestOTAChanges(nlTestSuite * aSuite, void * aContext) // Global count should have increased by (scenes::kMaxScenesPerFarbic - defaultTestFabricCapacity) NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.GetEndpointSceneCount(scene_count)); - NL_TEST_ASSERT(aSuite, defaultTestTableSize + (scenes::kMaxScenesPerFabric - defaultTestFabricCapacity) == scene_count); + NL_TEST_ASSERT(aSuite, fabricsFullCount + (scenes::kMaxScenesPerFabric - defaultTestFabricCapacity) == scene_count); // Same test for 4 insertion in fabric 1 NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.SetSceneTableEntry(kFabric1, scene9)); @@ -1652,7 +1631,7 @@ void TestOTAChanges(nlTestSuite * aSuite, void * aContext) // Global count should be at defaultTestTableSize + (scenes::kMaxScenesPerEndpoint - defaultTestTableSize) NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.GetEndpointSceneCount(scene_count)); - NL_TEST_ASSERT(aSuite, defaultTestTableSize + (scenes::kMaxScenesPerEndpoint - defaultTestTableSize) == scene_count); + NL_TEST_ASSERT(aSuite, fabricsFullCount + (scenes::kMaxScenesPerEndpoint - defaultTestTableSize) == scene_count); // Test failure to init a SceneTable with sizes above the defined max scenes per fabric or globaly TestSceneTableImpl SceneTableTooManyPerFabric(scenes::kMaxScenesPerFabric + 1, scenes::kMaxScenesPerEndpoint); @@ -1664,17 +1643,16 @@ void TestOTAChanges(nlTestSuite * aSuite, void * aContext) SceneTableTooManyGlobal.Finish(); // Create a new table with a lower limit of scenes per fabric - uint8_t newCapacity = defaultTestFabricCapacity - 1; - uint8_t newTableSize = defaultTestTableSize - 2; - uint8_t capacityDifference = static_cast(scenes::kMaxScenesPerFabric - newCapacity); - uint8_t tableSizeDifference = static_cast(scenes::kMaxScenesPerEndpoint - newTableSize); + uint8_t newCapacity = defaultTestFabricCapacity - 1; + uint8_t newTableSize = defaultTestTableSize - 2; + uint8_t capacityDifference = static_cast(scenes::kMaxScenesPerFabric - newCapacity); TestSceneTableImpl ReducedSceneTable(newCapacity, newTableSize); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.Init(&testStorage)); ReducedSceneTable.SetEndpoint(kTestEndpoint1); // Global count should not have been modified NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetEndpointSceneCount(scene_count)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerEndpoint == scene_count); + NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerEndpoint - 2 == scene_count); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetRemainingCapacity(kFabric2, fabric_capacity)); @@ -1694,7 +1672,7 @@ void TestOTAChanges(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetEndpointSceneCount(scene_count)); // Global count should have been reduced by the difference between the max fabric capacity of a fabric and the // new fabric capacity since we haven't loaded from fabric 2 yet - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerEndpoint - capacityDifference == scene_count); + NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerEndpoint - 2 - capacityDifference == scene_count); // Remove a Scene from the Fabric 1 NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.RemoveSceneTableEntry(kFabric1, scene1.mStorageId)); @@ -1709,16 +1687,14 @@ void TestOTAChanges(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.RemoveSceneTableEntry(kFabric1, scene2.mStorageId)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.RemoveSceneTableEntry(kFabric1, scene3.mStorageId)); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.RemoveSceneTableEntry(kFabric1, scene4.mStorageId)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.RemoveSceneTableEntry(kFabric1, scene5.mStorageId)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.RemoveSceneTableEntry(kFabric1, scene6.mStorageId)); // Check count updated for fabric iterator = ReducedSceneTable.IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, static_cast(newCapacity - 6) == iterator->Count()); + NL_TEST_ASSERT(aSuite, 2 == iterator->Count()); iterator->Release(); // Confirm global count has been updated NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetEndpointSceneCount(scene_count)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerEndpoint - capacityDifference - 6 == scene_count); + NL_TEST_ASSERT(aSuite, 13 == scene_count); // Confirm we now have capacity in fabric one NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); NL_TEST_ASSERT(aSuite, 1 == fabric_capacity); @@ -1733,11 +1709,11 @@ void TestOTAChanges(nlTestSuite * aSuite, void * aContext) iterator->Release(); // Global count should also have been adjusted NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetEndpointSceneCount(scene_count)); - // had 24 scenes, truncated 5 from both (10) and deleted 6 from fabric 1: 8 scenes left - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerEndpoint - tableSizeDifference - 6 == scene_count); + // had 22 scenes, truncated 5 from both (10) and deleted 4 from fabric 1: 8 scenes left + NL_TEST_ASSERT(aSuite, 8 == scene_count); // Confirm we now have capacity of 6 in the first fabric since we previously removed 6 scenes form there NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 6 == fabric_capacity); + NL_TEST_ASSERT(aSuite, 4 == fabric_capacity); // Fabric 2 should still be at capacity NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetRemainingCapacity(kFabric2, fabric_capacity)); NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); @@ -1751,7 +1727,7 @@ void TestOTAChanges(nlTestSuite * aSuite, void * aContext) // The Remaining capacity in the original scene table therefore have been modified as well // Fabric 2 should still be almost at capacity NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 7 == fabric_capacity); + NL_TEST_ASSERT(aSuite, 5 == fabric_capacity); NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); NL_TEST_ASSERT(aSuite, 1 == fabric_capacity); From d7b4b4dd3e4ef31bc82da264765ef5890a5dcf26 Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs Date: Tue, 17 Oct 2023 10:39:55 -0400 Subject: [PATCH 3/6] Generated Zap --- .../zap-generated/test/Commands.h | 160 ++++++++++++------ 1 file changed, 106 insertions(+), 54 deletions(-) diff --git a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h index 9b2b20b3229423..87844518d8b1e9 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -171491,112 +171491,120 @@ class Test_TC_S_1_1 : public TestCommandBridge { err = TestStep3aReadFeatureMapGlobalAttribute65532_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Step 4: Read Mandatory attributes in AttributeList (global attribute 65531)\n"); + ChipLogProgress(chipTool, " ***** Test Step 4 : Step 3b: Read FeatureMap (global attribute 65532)\n"); + err = TestStep3bReadFeatureMapGlobalAttribute65532_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Step 3c: Read FeatureMap (global attribute 65532)\n"); + err = TestStep3cReadFeatureMapGlobalAttribute65532_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Step 4: Read Mandatory attributes in AttributeList (global attribute 65531)\n"); if (ShouldSkip("S.S")) { NextTest(); return; } - err = TestStep4ReadMandatoryAttributesInAttributeListGlobalAttribute65531_4(); + err = TestStep4ReadMandatoryAttributesInAttributeListGlobalAttribute65531_6(); break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Step 4b: Read optional attributes(SceneCount, CurrentScene, CurrentGroup, SceneValid) in AttributeList (global attribute 65531)\n"); + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Step 4b: Read optional attributes(SceneCount, CurrentScene, CurrentGroup, SceneValid) in AttributeList (global attribute 65531)\n"); if (ShouldSkip("(!S.S.F03)")) { NextTest(); return; } - err = TestStep4bReadOptionalAttributesSceneCountCurrentSceneCurrentGroupSceneValidInAttributeListGlobalAttribute65531_5(); + err = TestStep4bReadOptionalAttributesSceneCountCurrentSceneCurrentGroupSceneValidInAttributeListGlobalAttribute65531_7(); break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Step 4c: Read optinnal attribute(LastConfiguredBy) in AttributeList (global attribute 65531)\n"); + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Step 4c: Read optinnal attribute(LastConfiguredBy) in AttributeList (global attribute 65531)\n"); if (ShouldSkip("S.S.A0005")) { NextTest(); return; } - err = TestStep4cReadOptinnalAttributeLastConfiguredByInAttributeListGlobalAttribute65531_6(); + err = TestStep4cReadOptinnalAttributeLastConfiguredByInAttributeListGlobalAttribute65531_8(); break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Step 4d: Read optionnal attribute(SceneTableSize) in AttributeList (global attribute 65531)\n"); + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Step 4d: Read optionnal attribute(SceneTableSize) in AttributeList (global attribute 65531)\n"); if (ShouldSkip("S.S.F02")) { NextTest(); return; } - err = TestStep4dReadOptionnalAttributeSceneTableSizeInAttributeListGlobalAttribute65531_7(); + err = TestStep4dReadOptionnalAttributeSceneTableSizeInAttributeListGlobalAttribute65531_9(); break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Step 4e: Read optional attribute(FabricSceneInfo) in AttributeList (global attribute 65531)\n"); + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Step 4e: Read optional attribute(FabricSceneInfo) in AttributeList (global attribute 65531)\n"); if (ShouldSkip("S.S.F03")) { NextTest(); return; } - err = TestStep4eReadOptionalAttributeFabricSceneInfoInAttributeListGlobalAttribute65531_8(); + err = TestStep4eReadOptionalAttributeFabricSceneInfoInAttributeListGlobalAttribute65531_10(); break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Step 5: Read EventList (global attribute 65530)\n"); + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Step 5: Read EventList (global attribute 65530)\n"); if (ShouldSkip("PICS_EVENT_LIST_ENABLED")) { NextTest(); return; } NextTest(); return; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Step 6a: Read Mandatory commands in AcceptedCommandList (global attribute 65529)\n"); + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Step 6a: Read Mandatory commands in AcceptedCommandList (global attribute 65529)\n"); if (ShouldSkip("S.S")) { NextTest(); return; } - err = TestStep6aReadMandatoryCommandsInAcceptedCommandListGlobalAttribute65529_10(); + err = TestStep6aReadMandatoryCommandsInAcceptedCommandListGlobalAttribute65529_12(); break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Step 6b: Read optional command(EnhancedAddSceneResponse) AcceptedCommandList (global attribute 65529)\n"); + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Step 6b: Read optional command(EnhancedAddSceneResponse) AcceptedCommandList (global attribute 65529)\n"); if (ShouldSkip("S.S.C40.Rsp")) { NextTest(); return; } - err = TestStep6bReadOptionalCommandEnhancedAddSceneResponseAcceptedCommandListGlobalAttribute65529_11(); + err = TestStep6bReadOptionalCommandEnhancedAddSceneResponseAcceptedCommandListGlobalAttribute65529_13(); break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Step 6c: Read optional command(EnhancedViewSceneResponse) AcceptedCommandList (global attribute 65529)\n"); + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Step 6c: Read optional command(EnhancedViewSceneResponse) AcceptedCommandList (global attribute 65529)\n"); if (ShouldSkip("S.S.C41.Rsp")) { NextTest(); return; } - err = TestStep6cReadOptionalCommandEnhancedViewSceneResponseAcceptedCommandListGlobalAttribute65529_12(); + err = TestStep6cReadOptionalCommandEnhancedViewSceneResponseAcceptedCommandListGlobalAttribute65529_14(); break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Step 6d: Read optional command(CopySceneResponse) AcceptedCommandList (global attribute 65529)\n"); + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Step 6d: Read optional command(CopySceneResponse) AcceptedCommandList (global attribute 65529)\n"); if (ShouldSkip("S.S.C42.Rsp")) { NextTest(); return; } - err = TestStep6dReadOptionalCommandCopySceneResponseAcceptedCommandListGlobalAttribute65529_13(); + err = TestStep6dReadOptionalCommandCopySceneResponseAcceptedCommandListGlobalAttribute65529_15(); break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Step 7a: Read GeneratedCommandList (global attribute 65528)\n"); - err = TestStep7aReadGeneratedCommandListGlobalAttribute65528_14(); + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Step 7a: Read GeneratedCommandList (global attribute 65528)\n"); + err = TestStep7aReadGeneratedCommandListGlobalAttribute65528_16(); break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Step 7b: Read optional command(EnhancedAddSceneResponse) in GeneratedCommandList (global attribute 65528)\n"); + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : Step 7b: Read optional command(EnhancedAddSceneResponse) in GeneratedCommandList (global attribute 65528)\n"); if (ShouldSkip("S.S.C40.Rsp")) { NextTest(); return; } - err = TestStep7bReadOptionalCommandEnhancedAddSceneResponseInGeneratedCommandListGlobalAttribute65528_15(); + err = TestStep7bReadOptionalCommandEnhancedAddSceneResponseInGeneratedCommandListGlobalAttribute65528_17(); break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Step 7c: Read optional command(EnhancedViewSceneResponse) in GeneratedCommandList (global attribute 65528)\n"); + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : Step 7c: Read optional command(EnhancedViewSceneResponse) in GeneratedCommandList (global attribute 65528)\n"); if (ShouldSkip("S.S.C41.Rsp")) { NextTest(); return; } - err = TestStep7cReadOptionalCommandEnhancedViewSceneResponseInGeneratedCommandListGlobalAttribute65528_16(); + err = TestStep7cReadOptionalCommandEnhancedViewSceneResponseInGeneratedCommandListGlobalAttribute65528_18(); break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Step 7d: Read optional command(CopySceneResponse) in GeneratedCommandList (global attribute 65528)\n"); + case 19: + ChipLogProgress(chipTool, " ***** Test Step 19 : Step 7d: Read optional command(CopySceneResponse) in GeneratedCommandList (global attribute 65528)\n"); if (ShouldSkip("S.S.C42.Rsp")) { NextTest(); return; } - err = TestStep7dReadOptionalCommandCopySceneResponseInGeneratedCommandListGlobalAttribute65528_17(); + err = TestStep7dReadOptionalCommandCopySceneResponseInGeneratedCommandListGlobalAttribute65528_19(); break; } @@ -171663,6 +171671,12 @@ class Test_TC_S_1_1 : public TestCommandBridge { case 17: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; } // Go on to the next test. @@ -171673,7 +171687,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 18; + const uint16_t mTestCount = 20; chip::Optional mNodeId; chip::Optional mCluster; @@ -171750,7 +171764,45 @@ class Test_TC_S_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep4ReadMandatoryAttributesInAttributeListGlobalAttribute65531_4() + CHIP_ERROR TestStep3bReadFeatureMapGlobalAttribute65532_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 3b: Read FeatureMap (global attribute 65532) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep3cReadFeatureMapGlobalAttribute65532_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 3c: Read FeatureMap (global attribute 65532) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep4ReadMandatoryAttributesInAttributeListGlobalAttribute65531_6() { MTRBaseDevice * device = GetDevice("alpha"); @@ -171776,7 +171828,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep4bReadOptionalAttributesSceneCountCurrentSceneCurrentGroupSceneValidInAttributeListGlobalAttribute65531_5() + CHIP_ERROR TestStep4bReadOptionalAttributesSceneCountCurrentSceneCurrentGroupSceneValidInAttributeListGlobalAttribute65531_7() { MTRBaseDevice * device = GetDevice("alpha"); @@ -171800,7 +171852,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep4cReadOptinnalAttributeLastConfiguredByInAttributeListGlobalAttribute65531_6() + CHIP_ERROR TestStep4cReadOptinnalAttributeLastConfiguredByInAttributeListGlobalAttribute65531_8() { MTRBaseDevice * device = GetDevice("alpha"); @@ -171821,7 +171873,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep4dReadOptionnalAttributeSceneTableSizeInAttributeListGlobalAttribute65531_7() + CHIP_ERROR TestStep4dReadOptionnalAttributeSceneTableSizeInAttributeListGlobalAttribute65531_9() { MTRBaseDevice * device = GetDevice("alpha"); @@ -171842,7 +171894,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep4eReadOptionalAttributeFabricSceneInfoInAttributeListGlobalAttribute65531_8() + CHIP_ERROR TestStep4eReadOptionalAttributeFabricSceneInfoInAttributeListGlobalAttribute65531_10() { MTRBaseDevice * device = GetDevice("alpha"); @@ -171863,7 +171915,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep6aReadMandatoryCommandsInAcceptedCommandListGlobalAttribute65529_10() + CHIP_ERROR TestStep6aReadMandatoryCommandsInAcceptedCommandListGlobalAttribute65529_12() { MTRBaseDevice * device = GetDevice("alpha"); @@ -171890,7 +171942,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep6bReadOptionalCommandEnhancedAddSceneResponseAcceptedCommandListGlobalAttribute65529_11() + CHIP_ERROR TestStep6bReadOptionalCommandEnhancedAddSceneResponseAcceptedCommandListGlobalAttribute65529_13() { MTRBaseDevice * device = GetDevice("alpha"); @@ -171911,7 +171963,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep6cReadOptionalCommandEnhancedViewSceneResponseAcceptedCommandListGlobalAttribute65529_12() + CHIP_ERROR TestStep6cReadOptionalCommandEnhancedViewSceneResponseAcceptedCommandListGlobalAttribute65529_14() { MTRBaseDevice * device = GetDevice("alpha"); @@ -171932,7 +171984,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep6dReadOptionalCommandCopySceneResponseAcceptedCommandListGlobalAttribute65529_13() + CHIP_ERROR TestStep6dReadOptionalCommandCopySceneResponseAcceptedCommandListGlobalAttribute65529_15() { MTRBaseDevice * device = GetDevice("alpha"); @@ -171953,7 +172005,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep7aReadGeneratedCommandListGlobalAttribute65528_14() + CHIP_ERROR TestStep7aReadGeneratedCommandListGlobalAttribute65528_16() { MTRBaseDevice * device = GetDevice("alpha"); @@ -171979,7 +172031,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep7bReadOptionalCommandEnhancedAddSceneResponseInGeneratedCommandListGlobalAttribute65528_15() + CHIP_ERROR TestStep7bReadOptionalCommandEnhancedAddSceneResponseInGeneratedCommandListGlobalAttribute65528_17() { MTRBaseDevice * device = GetDevice("alpha"); @@ -172000,7 +172052,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep7cReadOptionalCommandEnhancedViewSceneResponseInGeneratedCommandListGlobalAttribute65528_16() + CHIP_ERROR TestStep7cReadOptionalCommandEnhancedViewSceneResponseInGeneratedCommandListGlobalAttribute65528_18() { MTRBaseDevice * device = GetDevice("alpha"); @@ -172021,7 +172073,7 @@ class Test_TC_S_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep7dReadOptionalCommandCopySceneResponseInGeneratedCommandListGlobalAttribute65528_17() + CHIP_ERROR TestStep7dReadOptionalCommandCopySceneResponseInGeneratedCommandListGlobalAttribute65528_19() { MTRBaseDevice * device = GetDevice("alpha"); From ad1f9db50794a5ff46dfd1bc9c7349af734cd297 Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs Date: Tue, 17 Oct 2023 11:40:13 -0400 Subject: [PATCH 4/6] Adapted the tests to handle new Capacity in spec and regenerated Darwin tests --- .../suites/certification/Test_TC_S_2_2.yaml | 46 ++- .../suites/certification/Test_TC_S_2_3.yaml | 36 ++- .../zap-generated/test/Commands.h | 280 ++++++++++++------ 3 files changed, 253 insertions(+), 109 deletions(-) diff --git a/src/app/tests/suites/certification/Test_TC_S_2_2.yaml b/src/app/tests/suites/certification/Test_TC_S_2_2.yaml index f084d75cdc5370..16780a7e9c0353 100644 --- a/src/app/tests/suites/certification/Test_TC_S_2_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_S_2_2.yaml @@ -47,6 +47,36 @@ tests: - name: "SceneTableSize" saveAs: maxScenes + - label: "Arithmetic operation to get the maxScenes - 1" + cluster: "Unit Testing" + command: "TestAddArguments" + arguments: + values: + - name: "arg1" + value: maxScenes - 1 + - name: "arg2" + value: 0 + response: + values: + - name: "returnValue" + saveAs: maxScenesMinusOne + value: maxScenes - 1 + + - label: "Arithmetic operation to get the fabric Capacity" + cluster: "Unit Testing" + command: "TestAddArguments" + arguments: + values: + - name: "arg1" + value: maxScenesMinusOne / 2 + - name: "arg2" + value: 0 + response: + values: + - name: "returnValue" + saveAs: fabricCapacity + value: maxScenesMinusOne / 2 + - label: "Step 0a: preparation step for using commands from Groups cluster: Add KeySet" @@ -137,7 +167,7 @@ tests: - name: "Status" value: 0x00 - name: "Capacity" - value: ( maxScenes / 2 ) + value: fabricCapacity - name: "GroupID" value: G1 @@ -526,7 +556,7 @@ tests: - name: "Status" value: 0x00 - name: "Capacity" - value: ( maxScenes / 2 ) - 1 + value: fabricCapacity - 1 - name: "GroupID" value: G1 - name: "SceneList" @@ -563,7 +593,7 @@ tests: value: 0x00 - name: "Capacity" constraints: - anyOf: [( maxScenes / 2 ), 0xfe, 0x89] + anyOf: [fabricCapacity, 0xfe, 0x89] - name: "GroupID" value: G1 @@ -683,7 +713,7 @@ tests: value: 0x00 - name: "Capacity" constraints: - anyOf: [( maxScenes / 2 ) - 1, 0xfe, 0x89] + anyOf: [fabricCapacity - 1, 0xfe, 0x89] - name: "GroupID" value: G1 - name: "SceneList" @@ -724,7 +754,7 @@ tests: value: 0x00 - name: "Capacity" constraints: - anyOf: [( maxScenes / 2 ), 0xfe, 0x89] + anyOf: [fabricCapacity, 0xfe, 0x89] - name: "GroupID" value: G1 @@ -917,7 +947,7 @@ tests: - name: "Status" value: 0x00 - name: "Capacity" - value: ( maxScenes / 2 ) - 2 + value: fabricCapacity - 2 - name: "GroupID" value: G1 - name: "SceneList" @@ -975,7 +1005,7 @@ tests: - name: "Status" value: 0x00 - name: "Capacity" - value: ( maxScenes / 2 ) - 2 + value: fabricCapacity - 2 - name: "GroupID" value: G2 @@ -1070,7 +1100,7 @@ tests: - name: "Status" value: 0x00 - name: "Capacity" - value: ( maxScenes / 2 ) - 3 + value: fabricCapacity - 3 - name: "GroupID" value: G2 - name: "SceneList" diff --git a/src/app/tests/suites/certification/Test_TC_S_2_3.yaml b/src/app/tests/suites/certification/Test_TC_S_2_3.yaml index 5e0b5d21fa41ad..eb1637fdf563cf 100644 --- a/src/app/tests/suites/certification/Test_TC_S_2_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_S_2_3.yaml @@ -44,6 +44,36 @@ tests: - name: "SceneTableSize" saveAs: maxScenes + - label: "Arithmetic operation to get the maxScenes - 1" + cluster: "Unit Testing" + command: "TestAddArguments" + arguments: + values: + - name: "arg1" + value: maxScenes - 1 + - name: "arg2" + value: 0 + response: + values: + - name: "returnValue" + saveAs: maxScenesMinusOne + value: maxScenes - 1 + + - label: "Arithmetic operation to get the fabric Capacity" + cluster: "Unit Testing" + command: "TestAddArguments" + arguments: + values: + - name: "arg1" + value: maxScenesMinusOne / 2 + - name: "arg2" + value: 0 + response: + values: + - name: "returnValue" + saveAs: fabricCapacity + value: maxScenesMinusOne / 2 + - label: "Step 0a: preparation step for using commands from Groups cluster: Add KeySet" @@ -149,7 +179,7 @@ tests: - name: "Status" value: 0x00 - name: "Capacity" - value: maxScenes / 2 + value: fabricCapacity - name: "GroupID" value: G1 - name: "SceneList" @@ -505,7 +535,7 @@ tests: - name: "Status" value: 0x00 - name: "Capacity" - value: ( maxScenes / 2 ) - 1 + value: fabricCapacity - 1 - name: "GroupID" value: G1 - name: "SceneList" @@ -632,7 +662,7 @@ tests: - name: "Status" value: 0x00 - name: "Capacity" - value: ( maxScenes / 2 ) - 2 + value: fabricCapacity - 2 - name: "GroupID" value: G1 - name: "SceneList" diff --git a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h index 87844518d8b1e9..410bf7eeb90329 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -172517,180 +172517,188 @@ class Test_TC_S_2_3 : public TestCommandBridge { err = TestThReadsFromTheDutThe0x0006SceneTableSizeAttribute_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Step 0a: preparation step for using commands from Groups cluster: Add KeySet\n"); - err = TestStep0aPreparationStepForUsingCommandsFromGroupsClusterAddKeySet_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Arithmetic operation to get the maxScenes - 1\n"); + err = TestArithmeticOperationToGetTheMaxScenes1_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Step 0b: Preparation step for using commands from Groups cluster: Write Group Keys\n"); - err = TestStep0bPreparationStepForUsingCommandsFromGroupsClusterWriteGroupKeys_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Arithmetic operation to get the fabric Capacity\n"); + err = TestArithmeticOperationToGetTheFabricCapacity_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Step 1a: TH sends a AddGroup command to DUT with the GroupID field set to G1.\n"); + ChipLogProgress(chipTool, " ***** Test Step 4 : Step 0a: preparation step for using commands from Groups cluster: Add KeySet\n"); + err = TestStep0aPreparationStepForUsingCommandsFromGroupsClusterAddKeySet_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Step 0b: Preparation step for using commands from Groups cluster: Write Group Keys\n"); + err = TestStep0bPreparationStepForUsingCommandsFromGroupsClusterWriteGroupKeys_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Step 1a: TH sends a AddGroup command to DUT with the GroupID field set to G1.\n"); if (ShouldSkip("G.S.C00.Rsp")) { NextTest(); return; } - err = TestStep1aThSendsAAddGroupCommandToDutWithTheGroupIDFieldSetToG1_4(); + err = TestStep1aThSendsAAddGroupCommandToDutWithTheGroupIDFieldSetToG1_6(); break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Install ACLs\n"); - err = TestInstallACLs_5(); + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Install ACLs\n"); + err = TestInstallACLs_7(); break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Step 1b: TH sends a RemoveAllScenes command to DUT with the GroupID field set to G1.\n"); + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Step 1b: TH sends a RemoveAllScenes command to DUT with the GroupID field set to G1.\n"); if (ShouldSkip("S.S.C03.Rsp")) { NextTest(); return; } - err = TestStep1bThSendsARemoveAllScenesCommandToDutWithTheGroupIDFieldSetToG1_6(); + err = TestStep1bThSendsARemoveAllScenesCommandToDutWithTheGroupIDFieldSetToG1_8(); break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Step 1c: TH sends a GetSceneMembership command to DUT with the GroupID field set to G1.\n"); + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Step 1c: TH sends a GetSceneMembership command to DUT with the GroupID field set to G1.\n"); if (ShouldSkip("S.S.C06.Rsp")) { NextTest(); return; } - err = TestStep1cThSendsAGetSceneMembershipCommandToDutWithTheGroupIDFieldSetToG1_7(); + err = TestStep1cThSendsAGetSceneMembershipCommandToDutWithTheGroupIDFieldSetToG1_9(); break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Step 2a: TH sends a EnhancedAddScene command to DUT with the GroupID field set to G1, the SceneID field set to 0x01, the TransitionTime field set to 0x000a (1s) and a set of extension fields appropriate to AC1.\n"); + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Step 2a: TH sends a EnhancedAddScene command to DUT with the GroupID field set to G1, the SceneID field set to 0x01, the TransitionTime field set to 0x000a (1s) and a set of extension fields appropriate to AC1.\n"); if (ShouldSkip("S.S.C40.Rsp && PICS_SDK_CI_ONLY")) { NextTest(); return; } - err = TestStep2aThSendsAEnhancedAddSceneCommandToDutWithTheGroupIDFieldSetToG1TheSceneIDFieldSetTo0x01TheTransitionTimeFieldSetTo0x000a1sAndASetOfExtensionFieldsAppropriateToAc1_8(); + err = TestStep2aThSendsAEnhancedAddSceneCommandToDutWithTheGroupIDFieldSetToG1TheSceneIDFieldSetTo0x01TheTransitionTimeFieldSetTo0x000a1sAndASetOfExtensionFieldsAppropriateToAc1_10(); break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Step 2b: TH sends a AddScene command to DUT with the GroupID field set to G1, the SceneID field set to 0x01, the TransitionTime field set to 0x0001 (1s) and a set of extension fields appropriate to AC1.\n"); + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Step 2b: TH sends a AddScene command to DUT with the GroupID field set to G1, the SceneID field set to 0x01, the TransitionTime field set to 0x0001 (1s) and a set of extension fields appropriate to AC1.\n"); if (ShouldSkip("S.S.C00.Rsp && PICS_SDK_CI_ONLY")) { NextTest(); return; } - err = TestStep2bThSendsAAddSceneCommandToDutWithTheGroupIDFieldSetToG1TheSceneIDFieldSetTo0x01TheTransitionTimeFieldSetTo0x00011sAndASetOfExtensionFieldsAppropriateToAc1_9(); + err = TestStep2bThSendsAAddSceneCommandToDutWithTheGroupIDFieldSetToG1TheSceneIDFieldSetTo0x01TheTransitionTimeFieldSetTo0x00011sAndASetOfExtensionFieldsAppropriateToAc1_11(); break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Step 2a: TH sends a EnhancedAddScene command to DUT with the GroupID field set to G1, the SceneID field set to 0x01, the TransitionTime field set to 0x000a and a set of extension fields appropriate to AC1.\n"); + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Step 2a: TH sends a EnhancedAddScene command to DUT with the GroupID field set to G1, the SceneID field set to 0x01, the TransitionTime field set to 0x000a and a set of extension fields appropriate to AC1.\n"); if (ShouldSkip("S.S.C40.Rsp && PICS_SKIP_SAMPLE_APP")) { NextTest(); return; } - err = TestStep2aThSendsAEnhancedAddSceneCommandToDutWithTheGroupIDFieldSetToG1TheSceneIDFieldSetTo0x01TheTransitionTimeFieldSetTo0x000aAndASetOfExtensionFieldsAppropriateToAc1_10(); + err = TestStep2aThSendsAEnhancedAddSceneCommandToDutWithTheGroupIDFieldSetToG1TheSceneIDFieldSetTo0x01TheTransitionTimeFieldSetTo0x000aAndASetOfExtensionFieldsAppropriateToAc1_12(); break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Step 2b: TH sends a AddScene command to DUT with the GroupID field set to G1, the SceneID field set to 0x01, the TransitionTime field set to G1 and a set of extension fields appropriate to AC1.\n"); + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Step 2b: TH sends a AddScene command to DUT with the GroupID field set to G1, the SceneID field set to 0x01, the TransitionTime field set to G1 and a set of extension fields appropriate to AC1.\n"); if (ShouldSkip("S.S.C00.Rsp && PICS_SKIP_SAMPLE_APP")) { NextTest(); return; } - err = TestStep2bThSendsAAddSceneCommandToDutWithTheGroupIDFieldSetToG1TheSceneIDFieldSetTo0x01TheTransitionTimeFieldSetToG1AndASetOfExtensionFieldsAppropriateToAc1_11(); + err = TestStep2bThSendsAAddSceneCommandToDutWithTheGroupIDFieldSetToG1TheSceneIDFieldSetTo0x01TheTransitionTimeFieldSetToG1AndASetOfExtensionFieldsAppropriateToAc1_13(); break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Step 3a: TH sends a EnhancedViewScene command to DUT with the GroupID field set to G1 and the SceneID field set to 0x01.\n"); + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Step 3a: TH sends a EnhancedViewScene command to DUT with the GroupID field set to G1 and the SceneID field set to 0x01.\n"); if (ShouldSkip("S.S.C41.Rsp && PICS_SDK_CI_ONLY")) { NextTest(); return; } - err = TestStep3aThSendsAEnhancedViewSceneCommandToDutWithTheGroupIDFieldSetToG1AndTheSceneIDFieldSetTo0x01_12(); + err = TestStep3aThSendsAEnhancedViewSceneCommandToDutWithTheGroupIDFieldSetToG1AndTheSceneIDFieldSetTo0x01_14(); break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Step 3b: TH sends a ViewScene command to DUT with the GroupID field set to G1 and the SceneID field set to 0x01.\n"); + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Step 3b: TH sends a ViewScene command to DUT with the GroupID field set to G1 and the SceneID field set to 0x01.\n"); if (ShouldSkip("S.S.C01.Rsp && PICS_SDK_CI_ONLY")) { NextTest(); return; } - err = TestStep3bThSendsAViewSceneCommandToDutWithTheGroupIDFieldSetToG1AndTheSceneIDFieldSetTo0x01_13(); + err = TestStep3bThSendsAViewSceneCommandToDutWithTheGroupIDFieldSetToG1AndTheSceneIDFieldSetTo0x01_15(); break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Step 3a: TH sends a EnhancedViewScene command to DUT with the GroupID field set to G1 and the SceneID field set to 0x01.\n"); + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Step 3a: TH sends a EnhancedViewScene command to DUT with the GroupID field set to G1 and the SceneID field set to 0x01.\n"); if (ShouldSkip("S.S.C41.Rsp && PICS_SKIP_SAMPLE_APP")) { NextTest(); return; } - err = TestStep3aThSendsAEnhancedViewSceneCommandToDutWithTheGroupIDFieldSetToG1AndTheSceneIDFieldSetTo0x01_14(); + err = TestStep3aThSendsAEnhancedViewSceneCommandToDutWithTheGroupIDFieldSetToG1AndTheSceneIDFieldSetTo0x01_16(); break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Step 3b: TH sends a ViewScene command to DUT with the GroupID field set to G1 and the SceneID field set to 0x01.\n"); + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : Step 3b: TH sends a ViewScene command to DUT with the GroupID field set to G1 and the SceneID field set to 0x01.\n"); if (ShouldSkip("S.S.C01.Rsp && PICS_SKIP_SAMPLE_APP")) { NextTest(); return; } - err = TestStep3bThSendsAViewSceneCommandToDutWithTheGroupIDFieldSetToG1AndTheSceneIDFieldSetTo0x01_15(); + err = TestStep3bThSendsAViewSceneCommandToDutWithTheGroupIDFieldSetToG1AndTheSceneIDFieldSetTo0x01_17(); break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Step 4: TH sends a GetSceneMembership command to DUT with the GroupID field set to G1.\n"); + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : Step 4: TH sends a GetSceneMembership command to DUT with the GroupID field set to G1.\n"); if (ShouldSkip("S.S.C06.Rsp")) { NextTest(); return; } - err = TestStep4ThSendsAGetSceneMembershipCommandToDutWithTheGroupIDFieldSetToG1_16(); + err = TestStep4ThSendsAGetSceneMembershipCommandToDutWithTheGroupIDFieldSetToG1_18(); break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Step 5a: TH configures AC2 on DUT for all implemented application clusters supporting scenes.\n"); + case 19: + ChipLogProgress(chipTool, " ***** Test Step 19 : Step 5a: TH configures AC2 on DUT for all implemented application clusters supporting scenes.\n"); if (ShouldSkip("PICS_SDK_CI_ONLY")) { NextTest(); return; } - err = TestStep5aThConfiguresAc2OnDutForAllImplementedApplicationClustersSupportingScenes_17(); + err = TestStep5aThConfiguresAc2OnDutForAllImplementedApplicationClustersSupportingScenes_19(); break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Step 5a: TH configures AC2 on DUT for all implemented application clusters supporting scenes.\n"); + case 20: + ChipLogProgress(chipTool, " ***** Test Step 20 : Step 5a: TH configures AC2 on DUT for all implemented application clusters supporting scenes.\n"); if (ShouldSkip("PICS_SKIP_SAMPLE_APP")) { NextTest(); return; } - err = TestStep5aThConfiguresAc2OnDutForAllImplementedApplicationClustersSupportingScenes_18(); + err = TestStep5aThConfiguresAc2OnDutForAllImplementedApplicationClustersSupportingScenes_20(); break; - case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Step 5b: TH sends a RecallScene command to group G1 with the GroupID field set to G1 and the scene ID field set to 0x01.\n"); + case 21: + ChipLogProgress(chipTool, " ***** Test Step 21 : Step 5b: TH sends a RecallScene command to group G1 with the GroupID field set to G1 and the scene ID field set to 0x01.\n"); if (ShouldSkip("S.S.C05.Rsp")) { NextTest(); return; } - err = TestStep5bThSendsARecallSceneCommandToGroupG1WithTheGroupIDFieldSetToG1AndTheSceneIdFieldSetTo0x01_19(); + err = TestStep5bThSendsARecallSceneCommandToGroupG1WithTheGroupIDFieldSetToG1AndTheSceneIdFieldSetTo0x01_21(); break; - case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : Wait 1s\n"); + case 22: + ChipLogProgress(chipTool, " ***** Test Step 22 : Wait 1s\n"); if (ShouldSkip("PICS_SDK_CI_ONLY")) { NextTest(); return; } - err = TestWait1s_20(); + err = TestWait1s_22(); break; - case 21: - ChipLogProgress(chipTool, " ***** Test Step 21 : TH confirm the DUT reached AC1 (on level control cluster) after 1s\n"); + case 23: + ChipLogProgress(chipTool, " ***** Test Step 23 : TH confirm the DUT reached AC1 (on level control cluster) after 1s\n"); if (ShouldSkip("PICS_SDK_CI_ONLY && S.S.C05.Rsp")) { NextTest(); return; } - err = TestThConfirmTheDutReachedAc1OnLevelControlClusterAfter1s_21(); + err = TestThConfirmTheDutReachedAc1OnLevelControlClusterAfter1s_23(); break; - case 22: - ChipLogProgress(chipTool, " ***** Test Step 22 : Verify DUT returns to AC1.\n"); + case 24: + ChipLogProgress(chipTool, " ***** Test Step 24 : Verify DUT returns to AC1.\n"); if (ShouldSkip("PICS_SKIP_SAMPLE_APP")) { NextTest(); return; } - err = TestVerifyDutReturnsToAc1_22(); + err = TestVerifyDutReturnsToAc1_24(); break; - case 23: - ChipLogProgress(chipTool, " ***** Test Step 23 : Step 6a: TH sends a CopyScene command to DUT with the mode field set to 0x00, the group identifier from field set to G1, the scene identifier from field set to 0x01, the group identifier to field set to G1 and the scene identifier to field set to 0x02.\n"); + case 25: + ChipLogProgress(chipTool, " ***** Test Step 25 : Step 6a: TH sends a CopyScene command to DUT with the mode field set to 0x00, the group identifier from field set to G1, the scene identifier from field set to 0x01, the group identifier to field set to G1 and the scene identifier to field set to 0x02.\n"); if (ShouldSkip("S.S.C42.Rsp")) { NextTest(); return; } - err = TestStep6aThSendsACopySceneCommandToDutWithTheModeFieldSetTo0x00TheGroupIdentifierFromFieldSetToG1TheSceneIdentifierFromFieldSetTo0x01TheGroupIdentifierToFieldSetToG1AndTheSceneIdentifierToFieldSetTo0x02_23(); + err = TestStep6aThSendsACopySceneCommandToDutWithTheModeFieldSetTo0x00TheGroupIdentifierFromFieldSetToG1TheSceneIdentifierFromFieldSetTo0x01TheGroupIdentifierToFieldSetToG1AndTheSceneIdentifierToFieldSetTo0x02_25(); break; - case 24: - ChipLogProgress(chipTool, " ***** Test Step 24 : Step 6b: TH sends a GetSceneMembership command to DUT with the GroupID field set to G1.\n"); + case 26: + ChipLogProgress(chipTool, " ***** Test Step 26 : Step 6b: TH sends a GetSceneMembership command to DUT with the GroupID field set to G1.\n"); if (ShouldSkip("S.S.C06.Rsp")) { NextTest(); return; } - err = TestStep6bThSendsAGetSceneMembershipCommandToDutWithTheGroupIDFieldSetToG1_24(); + err = TestStep6bThSendsAGetSceneMembershipCommandToDutWithTheGroupIDFieldSetToG1_26(); break; - case 25: - ChipLogProgress(chipTool, " ***** Test Step 25 : Step 7: TH removes the Group key set that was added by sending a KeySetRemove command to the GroupKeyManagement cluster with the GroupKeySetID field set to 0x01a1\n"); - err = TestStep7ThRemovesTheGroupKeySetThatWasAddedBySendingAKeySetRemoveCommandToTheGroupKeyManagementClusterWithTheGroupKeySetIDFieldSetTo0x01a1_25(); + case 27: + ChipLogProgress(chipTool, " ***** Test Step 27 : Step 7: TH removes the Group key set that was added by sending a KeySetRemove command to the GroupKeyManagement cluster with the GroupKeySetID field set to 0x01a1\n"); + err = TestStep7ThRemovesTheGroupKeySetThatWasAddedBySendingAKeySetRemoveCommandToTheGroupKeyManagementClusterWithTheGroupKeySetIDFieldSetTo0x01a1_27(); break; } @@ -172781,6 +172789,12 @@ class Test_TC_S_2_3 : public TestCommandBridge { case 25: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; } // Go on to the next test. @@ -172791,7 +172805,7 @@ class Test_TC_S_2_3 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 26; + const uint16_t mTestCount = 28; chip::Optional mNodeId; chip::Optional mCluster; @@ -172829,8 +172843,74 @@ class Test_TC_S_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } + NSNumber * _Nonnull maxScenesMinusOne; + + CHIP_ERROR TestArithmeticOperationToGetTheMaxScenes1_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRUnitTestingClusterTestAddArgumentsParams alloc] init]; + params.arg1 = + [NSNumber numberWithUnsignedChar:[maxScenes unsignedShortValue] - 1U]; + params.arg2 = + [NSNumber numberWithUnsignedChar:0U]; + [cluster testAddArgumentsWithParams:params completion: + ^(MTRUnitTestingClusterTestAddArgumentsResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"Arithmetic operation to get the maxScenes - 1 Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.returnValue; + VerifyOrReturn(CheckValue("returnValue", actualValue, [maxScenes unsignedShortValue] - 1U)); + } + { + maxScenesMinusOne = values.returnValue; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + NSNumber * _Nonnull fabricCapacity; + + CHIP_ERROR TestArithmeticOperationToGetTheFabricCapacity_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRUnitTestingClusterTestAddArgumentsParams alloc] init]; + params.arg1 = + [NSNumber numberWithUnsignedChar:[maxScenesMinusOne unsignedCharValue] / 2U]; + params.arg2 = + [NSNumber numberWithUnsignedChar:0U]; + [cluster testAddArgumentsWithParams:params completion: + ^(MTRUnitTestingClusterTestAddArgumentsResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"Arithmetic operation to get the fabric Capacity Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.returnValue; + VerifyOrReturn(CheckValue("returnValue", actualValue, [maxScenesMinusOne unsignedCharValue] / 2U)); + } + { + fabricCapacity = values.returnValue; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } - CHIP_ERROR TestStep0aPreparationStepForUsingCommandsFromGroupsClusterAddKeySet_2() + CHIP_ERROR TestStep0aPreparationStepForUsingCommandsFromGroupsClusterAddKeySet_4() { MTRBaseDevice * device = GetDevice("alpha"); @@ -172868,7 +172948,7 @@ class Test_TC_S_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep0bPreparationStepForUsingCommandsFromGroupsClusterWriteGroupKeys_3() + CHIP_ERROR TestStep0bPreparationStepForUsingCommandsFromGroupsClusterWriteGroupKeys_5() { MTRBaseDevice * device = GetDevice("alpha"); @@ -172898,7 +172978,7 @@ class Test_TC_S_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep1aThSendsAAddGroupCommandToDutWithTheGroupIDFieldSetToG1_4() + CHIP_ERROR TestStep1aThSendsAAddGroupCommandToDutWithTheGroupIDFieldSetToG1_6() { MTRBaseDevice * device = GetDevice("alpha"); @@ -172930,7 +173010,7 @@ class Test_TC_S_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestInstallACLs_5() + CHIP_ERROR TestInstallACLs_7() { MTRBaseDevice * device = GetDevice("alpha"); @@ -172973,7 +173053,7 @@ class Test_TC_S_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep1bThSendsARemoveAllScenesCommandToDutWithTheGroupIDFieldSetToG1_6() + CHIP_ERROR TestStep1bThSendsARemoveAllScenesCommandToDutWithTheGroupIDFieldSetToG1_8() { MTRBaseDevice * device = GetDevice("alpha"); @@ -173004,7 +173084,7 @@ class Test_TC_S_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep1cThSendsAGetSceneMembershipCommandToDutWithTheGroupIDFieldSetToG1_7() + CHIP_ERROR TestStep1cThSendsAGetSceneMembershipCommandToDutWithTheGroupIDFieldSetToG1_9() { MTRBaseDevice * device = GetDevice("alpha"); @@ -173026,8 +173106,12 @@ class Test_TC_S_2_3 : public TestCommandBridge { { id actualValue = values.capacity; - VerifyOrReturn(CheckValueNonNull("Capacity", actualValue)); - VerifyOrReturn(CheckValue("Capacity", actualValue, [maxScenes unsignedShortValue] / 2U)); + if (fabricCapacity == nil) { + VerifyOrReturn(CheckValueNull("Capacity", actualValue)); + } else { + VerifyOrReturn(CheckValueNonNull("Capacity", actualValue)); + VerifyOrReturn(CheckValue("Capacity", actualValue, fabricCapacity)); + } } { @@ -173046,7 +173130,7 @@ class Test_TC_S_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep2aThSendsAEnhancedAddSceneCommandToDutWithTheGroupIDFieldSetToG1TheSceneIDFieldSetTo0x01TheTransitionTimeFieldSetTo0x000a1sAndASetOfExtensionFieldsAppropriateToAc1_8() + CHIP_ERROR TestStep2aThSendsAEnhancedAddSceneCommandToDutWithTheGroupIDFieldSetToG1TheSceneIDFieldSetTo0x01TheTransitionTimeFieldSetTo0x000a1sAndASetOfExtensionFieldsAppropriateToAc1_10() { MTRBaseDevice * device = GetDevice("alpha"); @@ -173119,7 +173203,7 @@ class Test_TC_S_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep2bThSendsAAddSceneCommandToDutWithTheGroupIDFieldSetToG1TheSceneIDFieldSetTo0x01TheTransitionTimeFieldSetTo0x00011sAndASetOfExtensionFieldsAppropriateToAc1_9() + CHIP_ERROR TestStep2bThSendsAAddSceneCommandToDutWithTheGroupIDFieldSetToG1TheSceneIDFieldSetTo0x01TheTransitionTimeFieldSetTo0x00011sAndASetOfExtensionFieldsAppropriateToAc1_11() { MTRBaseDevice * device = GetDevice("alpha"); @@ -173192,7 +173276,7 @@ class Test_TC_S_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep2aThSendsAEnhancedAddSceneCommandToDutWithTheGroupIDFieldSetToG1TheSceneIDFieldSetTo0x01TheTransitionTimeFieldSetTo0x000aAndASetOfExtensionFieldsAppropriateToAc1_10() + CHIP_ERROR TestStep2aThSendsAEnhancedAddSceneCommandToDutWithTheGroupIDFieldSetToG1TheSceneIDFieldSetTo0x01TheTransitionTimeFieldSetTo0x000aAndASetOfExtensionFieldsAppropriateToAc1_12() { chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; @@ -173202,7 +173286,7 @@ class Test_TC_S_2_3 : public TestCommandBridge { return UserPrompt("alpha", value); } - CHIP_ERROR TestStep2bThSendsAAddSceneCommandToDutWithTheGroupIDFieldSetToG1TheSceneIDFieldSetTo0x01TheTransitionTimeFieldSetToG1AndASetOfExtensionFieldsAppropriateToAc1_11() + CHIP_ERROR TestStep2bThSendsAAddSceneCommandToDutWithTheGroupIDFieldSetToG1TheSceneIDFieldSetTo0x01TheTransitionTimeFieldSetToG1AndASetOfExtensionFieldsAppropriateToAc1_13() { chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; @@ -173212,7 +173296,7 @@ class Test_TC_S_2_3 : public TestCommandBridge { return UserPrompt("alpha", value); } - CHIP_ERROR TestStep3aThSendsAEnhancedViewSceneCommandToDutWithTheGroupIDFieldSetToG1AndTheSceneIDFieldSetTo0x01_12() + CHIP_ERROR TestStep3aThSendsAEnhancedViewSceneCommandToDutWithTheGroupIDFieldSetToG1AndTheSceneIDFieldSetTo0x01_14() { MTRBaseDevice * device = GetDevice("alpha"); @@ -173268,7 +173352,7 @@ class Test_TC_S_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep3bThSendsAViewSceneCommandToDutWithTheGroupIDFieldSetToG1AndTheSceneIDFieldSetTo0x01_13() + CHIP_ERROR TestStep3bThSendsAViewSceneCommandToDutWithTheGroupIDFieldSetToG1AndTheSceneIDFieldSetTo0x01_15() { MTRBaseDevice * device = GetDevice("alpha"); @@ -173324,7 +173408,7 @@ class Test_TC_S_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep3aThSendsAEnhancedViewSceneCommandToDutWithTheGroupIDFieldSetToG1AndTheSceneIDFieldSetTo0x01_14() + CHIP_ERROR TestStep3aThSendsAEnhancedViewSceneCommandToDutWithTheGroupIDFieldSetToG1AndTheSceneIDFieldSetTo0x01_16() { chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; @@ -173334,7 +173418,7 @@ class Test_TC_S_2_3 : public TestCommandBridge { return UserPrompt("alpha", value); } - CHIP_ERROR TestStep3bThSendsAViewSceneCommandToDutWithTheGroupIDFieldSetToG1AndTheSceneIDFieldSetTo0x01_15() + CHIP_ERROR TestStep3bThSendsAViewSceneCommandToDutWithTheGroupIDFieldSetToG1AndTheSceneIDFieldSetTo0x01_17() { chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; @@ -173344,7 +173428,7 @@ class Test_TC_S_2_3 : public TestCommandBridge { return UserPrompt("alpha", value); } - CHIP_ERROR TestStep4ThSendsAGetSceneMembershipCommandToDutWithTheGroupIDFieldSetToG1_16() + CHIP_ERROR TestStep4ThSendsAGetSceneMembershipCommandToDutWithTheGroupIDFieldSetToG1_18() { MTRBaseDevice * device = GetDevice("alpha"); @@ -173367,7 +173451,7 @@ class Test_TC_S_2_3 : public TestCommandBridge { { id actualValue = values.capacity; VerifyOrReturn(CheckValueNonNull("Capacity", actualValue)); - VerifyOrReturn(CheckValue("Capacity", actualValue, ([maxScenes unsignedShortValue] / 2U) - 1U)); + VerifyOrReturn(CheckValue("Capacity", actualValue, [fabricCapacity unsignedCharValue] - 1U)); } { @@ -173387,7 +173471,7 @@ class Test_TC_S_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep5aThConfiguresAc2OnDutForAllImplementedApplicationClustersSupportingScenes_17() + CHIP_ERROR TestStep5aThConfiguresAc2OnDutForAllImplementedApplicationClustersSupportingScenes_19() { MTRBaseDevice * device = GetDevice("alpha"); @@ -173415,7 +173499,7 @@ class Test_TC_S_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep5aThConfiguresAc2OnDutForAllImplementedApplicationClustersSupportingScenes_18() + CHIP_ERROR TestStep5aThConfiguresAc2OnDutForAllImplementedApplicationClustersSupportingScenes_20() { chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; @@ -173425,7 +173509,7 @@ class Test_TC_S_2_3 : public TestCommandBridge { return UserPrompt("alpha", value); } - CHIP_ERROR TestStep5bThSendsARecallSceneCommandToGroupG1WithTheGroupIDFieldSetToG1AndTheSceneIdFieldSetTo0x01_19() + CHIP_ERROR TestStep5bThSendsARecallSceneCommandToGroupG1WithTheGroupIDFieldSetToG1AndTheSceneIdFieldSetTo0x01_21() { MTRBaseDevice * device = GetDevice("alpha"); @@ -173448,7 +173532,7 @@ class Test_TC_S_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWait1s_20() + CHIP_ERROR TestWait1s_22() { chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; @@ -173456,7 +173540,7 @@ class Test_TC_S_2_3 : public TestCommandBridge { return WaitForMs("alpha", value); } - CHIP_ERROR TestThConfirmTheDutReachedAc1OnLevelControlClusterAfter1s_21() + CHIP_ERROR TestThConfirmTheDutReachedAc1OnLevelControlClusterAfter1s_23() { MTRBaseDevice * device = GetDevice("alpha"); @@ -173480,7 +173564,7 @@ class Test_TC_S_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestVerifyDutReturnsToAc1_22() + CHIP_ERROR TestVerifyDutReturnsToAc1_24() { chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; @@ -173490,7 +173574,7 @@ class Test_TC_S_2_3 : public TestCommandBridge { return UserPrompt("alpha", value); } - CHIP_ERROR TestStep6aThSendsACopySceneCommandToDutWithTheModeFieldSetTo0x00TheGroupIdentifierFromFieldSetToG1TheSceneIdentifierFromFieldSetTo0x01TheGroupIdentifierToFieldSetToG1AndTheSceneIdentifierToFieldSetTo0x02_23() + CHIP_ERROR TestStep6aThSendsACopySceneCommandToDutWithTheModeFieldSetTo0x00TheGroupIdentifierFromFieldSetToG1TheSceneIdentifierFromFieldSetTo0x01TheGroupIdentifierToFieldSetToG1AndTheSceneIdentifierToFieldSetTo0x02_25() { MTRBaseDevice * device = GetDevice("alpha"); @@ -173533,7 +173617,7 @@ class Test_TC_S_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep6bThSendsAGetSceneMembershipCommandToDutWithTheGroupIDFieldSetToG1_24() + CHIP_ERROR TestStep6bThSendsAGetSceneMembershipCommandToDutWithTheGroupIDFieldSetToG1_26() { MTRBaseDevice * device = GetDevice("alpha"); @@ -173556,7 +173640,7 @@ class Test_TC_S_2_3 : public TestCommandBridge { { id actualValue = values.capacity; VerifyOrReturn(CheckValueNonNull("Capacity", actualValue)); - VerifyOrReturn(CheckValue("Capacity", actualValue, ([maxScenes unsignedShortValue] / 2U) - 2U)); + VerifyOrReturn(CheckValue("Capacity", actualValue, [fabricCapacity unsignedCharValue] - 2U)); } { @@ -173577,7 +173661,7 @@ class Test_TC_S_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep7ThRemovesTheGroupKeySetThatWasAddedBySendingAKeySetRemoveCommandToTheGroupKeyManagementClusterWithTheGroupKeySetIDFieldSetTo0x01a1_25() + CHIP_ERROR TestStep7ThRemovesTheGroupKeySetThatWasAddedBySendingAKeySetRemoveCommandToTheGroupKeyManagementClusterWithTheGroupKeySetIDFieldSetTo0x01a1_27() { MTRBaseDevice * device = GetDevice("alpha"); From 0548e5a17027595cf8c7eb4e27a6102d76ba1259 Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs Date: Tue, 17 Oct 2023 13:55:25 -0400 Subject: [PATCH 5/6] Attempt to fix signedness error on Darwin CI --- src/app/clusters/scenes-server/SceneTableImpl.cpp | 1 + src/app/tests/suites/certification/Test_TC_S_2_3.yaml | 7 +++++-- .../darwin-framework-tool/zap-generated/test/Commands.h | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/app/clusters/scenes-server/SceneTableImpl.cpp b/src/app/clusters/scenes-server/SceneTableImpl.cpp index ce890247be29bb..f1900416c4499b 100644 --- a/src/app/clusters/scenes-server/SceneTableImpl.cpp +++ b/src/app/clusters/scenes-server/SceneTableImpl.cpp @@ -928,6 +928,7 @@ void DefaultSceneTableImpl::SetEndpoint(EndpointId endpoint) void DefaultSceneTableImpl::SetTableSize(uint16_t endpointSceneTableSize) { // Verify the endpoint passed size respects the limits of the device configuration + VerifyOrDie(kMaxScenesPerEndpoint > 0); mMaxScenesPerEndpoint = (kMaxScenesPerEndpoint < endpointSceneTableSize) ? kMaxScenesPerEndpoint : endpointSceneTableSize; mMaxScenesPerFabric = static_cast((mMaxScenesPerEndpoint - 1) / 2); } diff --git a/src/app/tests/suites/certification/Test_TC_S_2_3.yaml b/src/app/tests/suites/certification/Test_TC_S_2_3.yaml index eb1637fdf563cf..5603bed016f8ec 100644 --- a/src/app/tests/suites/certification/Test_TC_S_2_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_S_2_3.yaml @@ -25,6 +25,9 @@ config: G1: type: group_id defaultValue: 0x0101 + one: + type: int8u + defaultValue: 1 tests: - label: "Wait for the commissioned device to be retrieved" @@ -50,14 +53,14 @@ tests: arguments: values: - name: "arg1" - value: maxScenes - 1 + value: maxScenes - one - name: "arg2" value: 0 response: values: - name: "returnValue" saveAs: maxScenesMinusOne - value: maxScenes - 1 + value: maxScenes - one - label: "Arithmetic operation to get the fabric Capacity" cluster: "Unit Testing" diff --git a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h index 410bf7eeb90329..1df65d4061ee64 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -172854,7 +172854,7 @@ class Test_TC_S_2_3 : public TestCommandBridge { __auto_type * params = [[MTRUnitTestingClusterTestAddArgumentsParams alloc] init]; params.arg1 = - [NSNumber numberWithUnsignedChar:[maxScenes unsignedShortValue] - 1U]; + [NSNumber numberWithUnsignedChar:[maxScenes unsignedShortValue] - 0x0001U]; params.arg2 = [NSNumber numberWithUnsignedChar:0U]; [cluster testAddArgumentsWithParams:params completion: @@ -172865,7 +172865,7 @@ class Test_TC_S_2_3 : public TestCommandBridge { { id actualValue = values.returnValue; - VerifyOrReturn(CheckValue("returnValue", actualValue, [maxScenes unsignedShortValue] - 1U)); + VerifyOrReturn(CheckValue("returnValue", actualValue, [maxScenes unsignedShortValue] - 0x0001U)); } { maxScenesMinusOne = values.returnValue; From e29ad66bab9f4f0c3129851fa2f63d25373b5c8b Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Tue, 17 Oct 2023 22:26:45 +0000 Subject: [PATCH 6/6] Restyled by prettier-yaml --- .../templates/tests/ciTests.json | 4 +- .../suites/certification/Test_TC_S_2_3.yaml | 7 +- .../zap-generated/test/Commands.h | 1223 ----------------- 3 files changed, 5 insertions(+), 1229 deletions(-) diff --git a/examples/darwin-framework-tool/templates/tests/ciTests.json b/examples/darwin-framework-tool/templates/tests/ciTests.json index 0d4527d435aad8..10c1d1a63d7142 100644 --- a/examples/darwin-framework-tool/templates/tests/ciTests.json +++ b/examples/darwin-framework-tool/templates/tests/ciTests.json @@ -57,6 +57,8 @@ "Test_TC_TCTL_2_1", "Disabled because darwin-framework-tool does not support constraints arithmetic operations", "Test_TC_FLW_2_1", - "Test_TC_RH_2_1" + "Test_TC_RH_2_1", + "Disabled because darwin-framework-tool does not handle substraction in parameters", + "Test_TC_S_2_3" ] } diff --git a/src/app/tests/suites/certification/Test_TC_S_2_3.yaml b/src/app/tests/suites/certification/Test_TC_S_2_3.yaml index 5603bed016f8ec..eb1637fdf563cf 100644 --- a/src/app/tests/suites/certification/Test_TC_S_2_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_S_2_3.yaml @@ -25,9 +25,6 @@ config: G1: type: group_id defaultValue: 0x0101 - one: - type: int8u - defaultValue: 1 tests: - label: "Wait for the commissioned device to be retrieved" @@ -53,14 +50,14 @@ tests: arguments: values: - name: "arg1" - value: maxScenes - one + value: maxScenes - 1 - name: "arg2" value: 0 response: values: - name: "returnValue" saveAs: maxScenesMinusOne - value: maxScenes - one + value: maxScenes - 1 - label: "Arithmetic operation to get the fabric Capacity" cluster: "Unit Testing" diff --git a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h index 1df65d4061ee64..429acf1a76a20d 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -297,7 +297,6 @@ class TestList : public Command { printf("Test_TC_G_1_1\n"); printf("Test_TC_S_1_1\n"); printf("Test_TC_S_2_1\n"); - printf("Test_TC_S_2_3\n"); printf("Test_TC_S_2_4\n"); printf("TestActivatedCarbonFilterMonitoring\n"); printf("TestHepaFilterMonitoring\n"); @@ -172463,1227 +172462,6 @@ class Test_TC_S_2_1 : public TestCommandBridge { } }; -class Test_TC_S_2_3 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_S_2_3() - : TestCommandBridge("Test_TC_S_2_3") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("G1", 0, UINT16_MAX, &mG1); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~Test_TC_S_2_3() - { - } - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_S_2_3\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_S_2_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the (0x0006) SceneTableSize attribute\n"); - if (ShouldSkip("S.S.A0006")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutThe0x0006SceneTableSizeAttribute_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Arithmetic operation to get the maxScenes - 1\n"); - err = TestArithmeticOperationToGetTheMaxScenes1_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Arithmetic operation to get the fabric Capacity\n"); - err = TestArithmeticOperationToGetTheFabricCapacity_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Step 0a: preparation step for using commands from Groups cluster: Add KeySet\n"); - err = TestStep0aPreparationStepForUsingCommandsFromGroupsClusterAddKeySet_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Step 0b: Preparation step for using commands from Groups cluster: Write Group Keys\n"); - err = TestStep0bPreparationStepForUsingCommandsFromGroupsClusterWriteGroupKeys_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Step 1a: TH sends a AddGroup command to DUT with the GroupID field set to G1.\n"); - if (ShouldSkip("G.S.C00.Rsp")) { - NextTest(); - return; - } - err = TestStep1aThSendsAAddGroupCommandToDutWithTheGroupIDFieldSetToG1_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Install ACLs\n"); - err = TestInstallACLs_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Step 1b: TH sends a RemoveAllScenes command to DUT with the GroupID field set to G1.\n"); - if (ShouldSkip("S.S.C03.Rsp")) { - NextTest(); - return; - } - err = TestStep1bThSendsARemoveAllScenesCommandToDutWithTheGroupIDFieldSetToG1_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Step 1c: TH sends a GetSceneMembership command to DUT with the GroupID field set to G1.\n"); - if (ShouldSkip("S.S.C06.Rsp")) { - NextTest(); - return; - } - err = TestStep1cThSendsAGetSceneMembershipCommandToDutWithTheGroupIDFieldSetToG1_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Step 2a: TH sends a EnhancedAddScene command to DUT with the GroupID field set to G1, the SceneID field set to 0x01, the TransitionTime field set to 0x000a (1s) and a set of extension fields appropriate to AC1.\n"); - if (ShouldSkip("S.S.C40.Rsp && PICS_SDK_CI_ONLY")) { - NextTest(); - return; - } - err = TestStep2aThSendsAEnhancedAddSceneCommandToDutWithTheGroupIDFieldSetToG1TheSceneIDFieldSetTo0x01TheTransitionTimeFieldSetTo0x000a1sAndASetOfExtensionFieldsAppropriateToAc1_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Step 2b: TH sends a AddScene command to DUT with the GroupID field set to G1, the SceneID field set to 0x01, the TransitionTime field set to 0x0001 (1s) and a set of extension fields appropriate to AC1.\n"); - if (ShouldSkip("S.S.C00.Rsp && PICS_SDK_CI_ONLY")) { - NextTest(); - return; - } - err = TestStep2bThSendsAAddSceneCommandToDutWithTheGroupIDFieldSetToG1TheSceneIDFieldSetTo0x01TheTransitionTimeFieldSetTo0x00011sAndASetOfExtensionFieldsAppropriateToAc1_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Step 2a: TH sends a EnhancedAddScene command to DUT with the GroupID field set to G1, the SceneID field set to 0x01, the TransitionTime field set to 0x000a and a set of extension fields appropriate to AC1.\n"); - if (ShouldSkip("S.S.C40.Rsp && PICS_SKIP_SAMPLE_APP")) { - NextTest(); - return; - } - err = TestStep2aThSendsAEnhancedAddSceneCommandToDutWithTheGroupIDFieldSetToG1TheSceneIDFieldSetTo0x01TheTransitionTimeFieldSetTo0x000aAndASetOfExtensionFieldsAppropriateToAc1_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Step 2b: TH sends a AddScene command to DUT with the GroupID field set to G1, the SceneID field set to 0x01, the TransitionTime field set to G1 and a set of extension fields appropriate to AC1.\n"); - if (ShouldSkip("S.S.C00.Rsp && PICS_SKIP_SAMPLE_APP")) { - NextTest(); - return; - } - err = TestStep2bThSendsAAddSceneCommandToDutWithTheGroupIDFieldSetToG1TheSceneIDFieldSetTo0x01TheTransitionTimeFieldSetToG1AndASetOfExtensionFieldsAppropriateToAc1_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Step 3a: TH sends a EnhancedViewScene command to DUT with the GroupID field set to G1 and the SceneID field set to 0x01.\n"); - if (ShouldSkip("S.S.C41.Rsp && PICS_SDK_CI_ONLY")) { - NextTest(); - return; - } - err = TestStep3aThSendsAEnhancedViewSceneCommandToDutWithTheGroupIDFieldSetToG1AndTheSceneIDFieldSetTo0x01_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Step 3b: TH sends a ViewScene command to DUT with the GroupID field set to G1 and the SceneID field set to 0x01.\n"); - if (ShouldSkip("S.S.C01.Rsp && PICS_SDK_CI_ONLY")) { - NextTest(); - return; - } - err = TestStep3bThSendsAViewSceneCommandToDutWithTheGroupIDFieldSetToG1AndTheSceneIDFieldSetTo0x01_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Step 3a: TH sends a EnhancedViewScene command to DUT with the GroupID field set to G1 and the SceneID field set to 0x01.\n"); - if (ShouldSkip("S.S.C41.Rsp && PICS_SKIP_SAMPLE_APP")) { - NextTest(); - return; - } - err = TestStep3aThSendsAEnhancedViewSceneCommandToDutWithTheGroupIDFieldSetToG1AndTheSceneIDFieldSetTo0x01_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Step 3b: TH sends a ViewScene command to DUT with the GroupID field set to G1 and the SceneID field set to 0x01.\n"); - if (ShouldSkip("S.S.C01.Rsp && PICS_SKIP_SAMPLE_APP")) { - NextTest(); - return; - } - err = TestStep3bThSendsAViewSceneCommandToDutWithTheGroupIDFieldSetToG1AndTheSceneIDFieldSetTo0x01_17(); - break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Step 4: TH sends a GetSceneMembership command to DUT with the GroupID field set to G1.\n"); - if (ShouldSkip("S.S.C06.Rsp")) { - NextTest(); - return; - } - err = TestStep4ThSendsAGetSceneMembershipCommandToDutWithTheGroupIDFieldSetToG1_18(); - break; - case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Step 5a: TH configures AC2 on DUT for all implemented application clusters supporting scenes.\n"); - if (ShouldSkip("PICS_SDK_CI_ONLY")) { - NextTest(); - return; - } - err = TestStep5aThConfiguresAc2OnDutForAllImplementedApplicationClustersSupportingScenes_19(); - break; - case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : Step 5a: TH configures AC2 on DUT for all implemented application clusters supporting scenes.\n"); - if (ShouldSkip("PICS_SKIP_SAMPLE_APP")) { - NextTest(); - return; - } - err = TestStep5aThConfiguresAc2OnDutForAllImplementedApplicationClustersSupportingScenes_20(); - break; - case 21: - ChipLogProgress(chipTool, " ***** Test Step 21 : Step 5b: TH sends a RecallScene command to group G1 with the GroupID field set to G1 and the scene ID field set to 0x01.\n"); - if (ShouldSkip("S.S.C05.Rsp")) { - NextTest(); - return; - } - err = TestStep5bThSendsARecallSceneCommandToGroupG1WithTheGroupIDFieldSetToG1AndTheSceneIdFieldSetTo0x01_21(); - break; - case 22: - ChipLogProgress(chipTool, " ***** Test Step 22 : Wait 1s\n"); - if (ShouldSkip("PICS_SDK_CI_ONLY")) { - NextTest(); - return; - } - err = TestWait1s_22(); - break; - case 23: - ChipLogProgress(chipTool, " ***** Test Step 23 : TH confirm the DUT reached AC1 (on level control cluster) after 1s\n"); - if (ShouldSkip("PICS_SDK_CI_ONLY && S.S.C05.Rsp")) { - NextTest(); - return; - } - err = TestThConfirmTheDutReachedAc1OnLevelControlClusterAfter1s_23(); - break; - case 24: - ChipLogProgress(chipTool, " ***** Test Step 24 : Verify DUT returns to AC1.\n"); - if (ShouldSkip("PICS_SKIP_SAMPLE_APP")) { - NextTest(); - return; - } - err = TestVerifyDutReturnsToAc1_24(); - break; - case 25: - ChipLogProgress(chipTool, " ***** Test Step 25 : Step 6a: TH sends a CopyScene command to DUT with the mode field set to 0x00, the group identifier from field set to G1, the scene identifier from field set to 0x01, the group identifier to field set to G1 and the scene identifier to field set to 0x02.\n"); - if (ShouldSkip("S.S.C42.Rsp")) { - NextTest(); - return; - } - err = TestStep6aThSendsACopySceneCommandToDutWithTheModeFieldSetTo0x00TheGroupIdentifierFromFieldSetToG1TheSceneIdentifierFromFieldSetTo0x01TheGroupIdentifierToFieldSetToG1AndTheSceneIdentifierToFieldSetTo0x02_25(); - break; - case 26: - ChipLogProgress(chipTool, " ***** Test Step 26 : Step 6b: TH sends a GetSceneMembership command to DUT with the GroupID field set to G1.\n"); - if (ShouldSkip("S.S.C06.Rsp")) { - NextTest(); - return; - } - err = TestStep6bThSendsAGetSceneMembershipCommandToDutWithTheGroupIDFieldSetToG1_26(); - break; - case 27: - ChipLogProgress(chipTool, " ***** Test Step 27 : Step 7: TH removes the Group key set that was added by sending a KeySetRemove command to the GroupKeyManagement cluster with the GroupKeySetID field set to 0x01a1\n"); - err = TestStep7ThRemovesTheGroupKeySetThatWasAddedBySendingAKeySetRemoveCommandToTheGroupKeyManagementClusterWithTheGroupKeySetIDFieldSetTo0x01a1_27(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - void OnStatusUpdate(const chip::app::StatusIB & status) override - { - switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - } - - // Go on to the next test. - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 28; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mG1; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - NSNumber * _Nonnull maxScenes; - - CHIP_ERROR TestThReadsFromTheDutThe0x0006SceneTableSizeAttribute_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeSceneTableSizeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the (0x0006) SceneTableSize attribute Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - maxScenes = value; - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - NSNumber * _Nonnull maxScenesMinusOne; - - CHIP_ERROR TestArithmeticOperationToGetTheMaxScenes1_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRUnitTestingClusterTestAddArgumentsParams alloc] init]; - params.arg1 = - [NSNumber numberWithUnsignedChar:[maxScenes unsignedShortValue] - 0x0001U]; - params.arg2 = - [NSNumber numberWithUnsignedChar:0U]; - [cluster testAddArgumentsWithParams:params completion: - ^(MTRUnitTestingClusterTestAddArgumentsResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Arithmetic operation to get the maxScenes - 1 Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.returnValue; - VerifyOrReturn(CheckValue("returnValue", actualValue, [maxScenes unsignedShortValue] - 0x0001U)); - } - { - maxScenesMinusOne = values.returnValue; - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - NSNumber * _Nonnull fabricCapacity; - - CHIP_ERROR TestArithmeticOperationToGetTheFabricCapacity_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRUnitTestingClusterTestAddArgumentsParams alloc] init]; - params.arg1 = - [NSNumber numberWithUnsignedChar:[maxScenesMinusOne unsignedCharValue] / 2U]; - params.arg2 = - [NSNumber numberWithUnsignedChar:0U]; - [cluster testAddArgumentsWithParams:params completion: - ^(MTRUnitTestingClusterTestAddArgumentsResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Arithmetic operation to get the fabric Capacity Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.returnValue; - VerifyOrReturn(CheckValue("returnValue", actualValue, [maxScenesMinusOne unsignedCharValue] / 2U)); - } - { - fabricCapacity = values.returnValue; - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep0aPreparationStepForUsingCommandsFromGroupsClusterAddKeySet_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device endpointID:@(0) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRGroupKeyManagementClusterKeySetWriteParams alloc] init]; - params.groupKeySet = [[MTRGroupKeyManagementClusterGroupKeySetStruct alloc] init]; - ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).groupKeySetID = - [NSNumber numberWithUnsignedShort:417U]; - ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).groupKeySecurityPolicy = - [NSNumber numberWithUnsignedChar:0U]; - ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey0 = - [[NSData alloc] initWithBytes:"\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257" length:16]; - ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime0 = - [NSNumber numberWithUnsignedLongLong:1110000ULL]; - ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey1 = - [[NSData alloc] initWithBytes:"\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277" length:16]; - ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime1 = - [NSNumber numberWithUnsignedLongLong:1110001ULL]; - ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey2 = - [[NSData alloc] initWithBytes:"\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317" length:16]; - ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime2 = - [NSNumber numberWithUnsignedLongLong:1110002ULL]; - - [cluster keySetWriteWithParams:params completion: - ^(NSError * _Nullable err) { - NSLog(@"Step 0a: preparation step for using commands from Groups cluster: Add KeySet Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep0bPreparationStepForUsingCommandsFromGroupsClusterWriteGroupKeys_5() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device endpointID:@(0) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id groupKeyMapArgument; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [[MTRGroupKeyManagementClusterGroupKeyMapStruct alloc] init]; - ((MTRGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[0]).groupId = mG1.HasValue() ? [NSNumber numberWithUnsignedShort:mG1.Value()] : [NSNumber numberWithUnsignedShort:257U]; - ((MTRGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[0]).groupKeySetID = - [NSNumber numberWithUnsignedShort:417U]; - ((MTRGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[0]).fabricIndex = - [NSNumber numberWithUnsignedChar:1U]; - - groupKeyMapArgument = temp_0; - } - [cluster writeAttributeGroupKeyMapWithValue:groupKeyMapArgument completion:^(NSError * _Nullable err) { - NSLog(@"Step 0b: Preparation step for using commands from Groups cluster: Write Group Keys Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep1aThSendsAAddGroupCommandToDutWithTheGroupIDFieldSetToG1_6() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRGroupsClusterAddGroupParams alloc] init]; - params.groupID = mG1.HasValue() ? [NSNumber numberWithUnsignedShort:mG1.Value()] : [NSNumber numberWithUnsignedShort:257U]; - params.groupName = @"Group #1"; - [cluster addGroupWithParams:params completion: - ^(MTRGroupsClusterAddGroupResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Step 1a: TH sends a AddGroup command to DUT with the GroupID field set to G1. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 0U)); - } - - { - id actualValue = values.groupID; - VerifyOrReturn(CheckValue("GroupID", actualValue, mG1.HasValue() ? mG1.Value() : 257U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestInstallACLs_7() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(0) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id aclArgument; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [[MTRAccessControlClusterAccessControlEntryStruct alloc] init]; - ((MTRAccessControlClusterAccessControlEntryStruct *) temp_0[0]).privilege = - [NSNumber numberWithUnsignedChar:5U]; - ((MTRAccessControlClusterAccessControlEntryStruct *) temp_0[0]).authMode = - [NSNumber numberWithUnsignedChar:2U]; - ((MTRAccessControlClusterAccessControlEntryStruct *) temp_0[0]).subjects = nil; - ((MTRAccessControlClusterAccessControlEntryStruct *) temp_0[0]).targets = nil; - ((MTRAccessControlClusterAccessControlEntryStruct *) temp_0[0]).fabricIndex = - [NSNumber numberWithUnsignedChar:0U]; - - temp_0[1] = [[MTRAccessControlClusterAccessControlEntryStruct alloc] init]; - ((MTRAccessControlClusterAccessControlEntryStruct *) temp_0[1]).privilege = - [NSNumber numberWithUnsignedChar:4U]; - ((MTRAccessControlClusterAccessControlEntryStruct *) temp_0[1]).authMode = - [NSNumber numberWithUnsignedChar:3U]; - ((MTRAccessControlClusterAccessControlEntryStruct *) temp_0[1]).subjects = nil; - ((MTRAccessControlClusterAccessControlEntryStruct *) temp_0[1]).targets = nil; - ((MTRAccessControlClusterAccessControlEntryStruct *) temp_0[1]).fabricIndex = - [NSNumber numberWithUnsignedChar:0U]; - - aclArgument = temp_0; - } - [cluster writeAttributeACLWithValue:aclArgument completion:^(NSError * _Nullable err) { - NSLog(@"Install ACLs Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep1bThSendsARemoveAllScenesCommandToDutWithTheGroupIDFieldSetToG1_8() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRScenesClusterRemoveAllScenesParams alloc] init]; - params.groupID = mG1.HasValue() ? [NSNumber numberWithUnsignedShort:mG1.Value()] : [NSNumber numberWithUnsignedShort:257U]; - [cluster removeAllScenesWithParams:params completion: - ^(MTRScenesClusterRemoveAllScenesResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Step 1b: TH sends a RemoveAllScenes command to DUT with the GroupID field set to G1. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 0U)); - } - - { - id actualValue = values.groupID; - VerifyOrReturn(CheckValue("GroupID", actualValue, mG1.HasValue() ? mG1.Value() : 257U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep1cThSendsAGetSceneMembershipCommandToDutWithTheGroupIDFieldSetToG1_9() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRScenesClusterGetSceneMembershipParams alloc] init]; - params.groupID = mG1.HasValue() ? [NSNumber numberWithUnsignedShort:mG1.Value()] : [NSNumber numberWithUnsignedShort:257U]; - [cluster getSceneMembershipWithParams:params completion: - ^(MTRScenesClusterGetSceneMembershipResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Step 1c: TH sends a GetSceneMembership command to DUT with the GroupID field set to G1. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 0U)); - } - - { - id actualValue = values.capacity; - if (fabricCapacity == nil) { - VerifyOrReturn(CheckValueNull("Capacity", actualValue)); - } else { - VerifyOrReturn(CheckValueNonNull("Capacity", actualValue)); - VerifyOrReturn(CheckValue("Capacity", actualValue, fabricCapacity)); - } - } - - { - id actualValue = values.groupID; - VerifyOrReturn(CheckValue("GroupID", actualValue, mG1.HasValue() ? mG1.Value() : 257U)); - } - - { - id actualValue = values.sceneList; - VerifyOrReturn(CheckValue("SceneList", [actualValue count], static_cast(0))); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep2aThSendsAEnhancedAddSceneCommandToDutWithTheGroupIDFieldSetToG1TheSceneIDFieldSetTo0x01TheTransitionTimeFieldSetTo0x000a1sAndASetOfExtensionFieldsAppropriateToAc1_10() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRScenesClusterEnhancedAddSceneParams alloc] init]; - params.groupID = mG1.HasValue() ? [NSNumber numberWithUnsignedShort:mG1.Value()] : [NSNumber numberWithUnsignedShort:257U]; - params.sceneID = - [NSNumber numberWithUnsignedChar:1U]; - params.transitionTime = - [NSNumber numberWithUnsignedShort:10U]; - params.sceneName = @"Scene1"; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [[MTRScenesClusterExtensionFieldSet alloc] init]; - ((MTRScenesClusterExtensionFieldSet *) temp_0[0]).clusterID = - [NSNumber numberWithUnsignedInt:6UL]; - { - NSMutableArray * temp_2 = [[NSMutableArray alloc] init]; - temp_2[0] = [[MTRScenesClusterAttributeValuePair alloc] init]; - ((MTRScenesClusterAttributeValuePair *) temp_2[0]).attributeID = - [NSNumber numberWithUnsignedInt:0UL]; - ((MTRScenesClusterAttributeValuePair *) temp_2[0]).attributeValue = - [NSNumber numberWithUnsignedInt:1UL]; - - ((MTRScenesClusterExtensionFieldSet *) temp_0[0]).attributeValueList = temp_2; - } - - temp_0[1] = [[MTRScenesClusterExtensionFieldSet alloc] init]; - ((MTRScenesClusterExtensionFieldSet *) temp_0[1]).clusterID = - [NSNumber numberWithUnsignedInt:8UL]; - { - NSMutableArray * temp_2 = [[NSMutableArray alloc] init]; - temp_2[0] = [[MTRScenesClusterAttributeValuePair alloc] init]; - ((MTRScenesClusterAttributeValuePair *) temp_2[0]).attributeID = - [NSNumber numberWithUnsignedInt:0UL]; - ((MTRScenesClusterAttributeValuePair *) temp_2[0]).attributeValue = - [NSNumber numberWithUnsignedInt:100UL]; - - ((MTRScenesClusterExtensionFieldSet *) temp_0[1]).attributeValueList = temp_2; - } - - params.extensionFieldSets = temp_0; - } - [cluster enhancedAddSceneWithParams:params completion: - ^(MTRScenesClusterEnhancedAddSceneResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Step 2a: TH sends a EnhancedAddScene command to DUT with the GroupID field set to G1, the SceneID field set to 0x01, the TransitionTime field set to 0x000a (1s) and a set of extension fields appropriate to AC1. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 0U)); - } - - { - id actualValue = values.groupID; - VerifyOrReturn(CheckValue("GroupID", actualValue, mG1.HasValue() ? mG1.Value() : 257U)); - } - - { - id actualValue = values.sceneID; - VerifyOrReturn(CheckValue("SceneID", actualValue, 1U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep2bThSendsAAddSceneCommandToDutWithTheGroupIDFieldSetToG1TheSceneIDFieldSetTo0x01TheTransitionTimeFieldSetTo0x00011sAndASetOfExtensionFieldsAppropriateToAc1_11() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRScenesClusterAddSceneParams alloc] init]; - params.groupID = mG1.HasValue() ? [NSNumber numberWithUnsignedShort:mG1.Value()] : [NSNumber numberWithUnsignedShort:257U]; - params.sceneID = - [NSNumber numberWithUnsignedChar:1U]; - params.transitionTime = - [NSNumber numberWithUnsignedShort:1U]; - params.sceneName = @"Scene1"; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [[MTRScenesClusterExtensionFieldSet alloc] init]; - ((MTRScenesClusterExtensionFieldSet *) temp_0[0]).clusterID = - [NSNumber numberWithUnsignedInt:6UL]; - { - NSMutableArray * temp_2 = [[NSMutableArray alloc] init]; - temp_2[0] = [[MTRScenesClusterAttributeValuePair alloc] init]; - ((MTRScenesClusterAttributeValuePair *) temp_2[0]).attributeID = - [NSNumber numberWithUnsignedInt:0UL]; - ((MTRScenesClusterAttributeValuePair *) temp_2[0]).attributeValue = - [NSNumber numberWithUnsignedInt:1UL]; - - ((MTRScenesClusterExtensionFieldSet *) temp_0[0]).attributeValueList = temp_2; - } - - temp_0[1] = [[MTRScenesClusterExtensionFieldSet alloc] init]; - ((MTRScenesClusterExtensionFieldSet *) temp_0[1]).clusterID = - [NSNumber numberWithUnsignedInt:8UL]; - { - NSMutableArray * temp_2 = [[NSMutableArray alloc] init]; - temp_2[0] = [[MTRScenesClusterAttributeValuePair alloc] init]; - ((MTRScenesClusterAttributeValuePair *) temp_2[0]).attributeID = - [NSNumber numberWithUnsignedInt:0UL]; - ((MTRScenesClusterAttributeValuePair *) temp_2[0]).attributeValue = - [NSNumber numberWithUnsignedInt:100UL]; - - ((MTRScenesClusterExtensionFieldSet *) temp_0[1]).attributeValueList = temp_2; - } - - params.extensionFieldSets = temp_0; - } - [cluster addSceneWithParams:params completion: - ^(MTRScenesClusterAddSceneResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Step 2b: TH sends a AddScene command to DUT with the GroupID field set to G1, the SceneID field set to 0x01, the TransitionTime field set to 0x0001 (1s) and a set of extension fields appropriate to AC1. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 0U)); - } - - { - id actualValue = values.groupID; - VerifyOrReturn(CheckValue("GroupID", actualValue, mG1.HasValue() ? mG1.Value() : 257U)); - } - - { - id actualValue = values.sceneID; - VerifyOrReturn(CheckValue("SceneID", actualValue, 1U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep2aThSendsAEnhancedAddSceneCommandToDutWithTheGroupIDFieldSetToG1TheSceneIDFieldSetTo0x01TheTransitionTimeFieldSetTo0x000aAndASetOfExtensionFieldsAppropriateToAc1_12() - { - - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please execute the enhanced add scene command with extensionfieldsets in accordance with AC1 on DUT and enter 'y' if the command is successfulgarbage: not in length on purpose", 142); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); - } - - CHIP_ERROR TestStep2bThSendsAAddSceneCommandToDutWithTheGroupIDFieldSetToG1TheSceneIDFieldSetTo0x01TheTransitionTimeFieldSetToG1AndASetOfExtensionFieldsAppropriateToAc1_13() - { - - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please execute the add scene command with extensionfieldsets in accordance with AC1 on DUT and enter 'y' if the command is successfulgarbage: not in length on purpose", 133); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); - } - - CHIP_ERROR TestStep3aThSendsAEnhancedViewSceneCommandToDutWithTheGroupIDFieldSetToG1AndTheSceneIDFieldSetTo0x01_14() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRScenesClusterEnhancedViewSceneParams alloc] init]; - params.groupID = mG1.HasValue() ? [NSNumber numberWithUnsignedShort:mG1.Value()] : [NSNumber numberWithUnsignedShort:257U]; - params.sceneID = - [NSNumber numberWithUnsignedChar:1U]; - [cluster enhancedViewSceneWithParams:params completion: - ^(MTRScenesClusterEnhancedViewSceneResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Step 3a: TH sends a EnhancedViewScene command to DUT with the GroupID field set to G1 and the SceneID field set to 0x01. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 0U)); - } - - { - id actualValue = values.groupID; - VerifyOrReturn(CheckValue("GroupID", actualValue, mG1.HasValue() ? mG1.Value() : 257U)); - } - - { - id actualValue = values.sceneID; - VerifyOrReturn(CheckValue("SceneID", actualValue, 1U)); - } - - { - id actualValue = values.transitionTime; - VerifyOrReturn(CheckValue("TransitionTime", actualValue, 10U)); - } - - { - id actualValue = values.extensionFieldSets; - VerifyOrReturn(CheckValue("ExtensionFieldSets", [actualValue count], static_cast(2))); - VerifyOrReturn(CheckValue("ClusterID", ((MTRScenesClusterExtensionFieldSet *) actualValue[0]).clusterID, 6UL)); - VerifyOrReturn(CheckValue("AttributeValueList", [((MTRScenesClusterExtensionFieldSet *) actualValue[0]).attributeValueList count], static_cast(1))); - VerifyOrReturn(CheckValue("AttributeID", ((MTRScenesClusterAttributeValuePair *) ((MTRScenesClusterExtensionFieldSet *) actualValue[0]).attributeValueList[0]).attributeID, 0UL)); - VerifyOrReturn(CheckValue("AttributeValue", ((MTRScenesClusterAttributeValuePair *) ((MTRScenesClusterExtensionFieldSet *) actualValue[0]).attributeValueList[0]).attributeValue, 1UL)); - VerifyOrReturn(CheckValue("ClusterID", ((MTRScenesClusterExtensionFieldSet *) actualValue[1]).clusterID, 8UL)); - VerifyOrReturn(CheckValue("AttributeValueList", [((MTRScenesClusterExtensionFieldSet *) actualValue[1]).attributeValueList count], static_cast(1))); - VerifyOrReturn(CheckValue("AttributeID", ((MTRScenesClusterAttributeValuePair *) ((MTRScenesClusterExtensionFieldSet *) actualValue[1]).attributeValueList[0]).attributeID, 0UL)); - VerifyOrReturn(CheckValue("AttributeValue", ((MTRScenesClusterAttributeValuePair *) ((MTRScenesClusterExtensionFieldSet *) actualValue[1]).attributeValueList[0]).attributeValue, 100UL)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep3bThSendsAViewSceneCommandToDutWithTheGroupIDFieldSetToG1AndTheSceneIDFieldSetTo0x01_15() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRScenesClusterViewSceneParams alloc] init]; - params.groupID = mG1.HasValue() ? [NSNumber numberWithUnsignedShort:mG1.Value()] : [NSNumber numberWithUnsignedShort:257U]; - params.sceneID = - [NSNumber numberWithUnsignedChar:1U]; - [cluster viewSceneWithParams:params completion: - ^(MTRScenesClusterViewSceneResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Step 3b: TH sends a ViewScene command to DUT with the GroupID field set to G1 and the SceneID field set to 0x01. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 0U)); - } - - { - id actualValue = values.groupID; - VerifyOrReturn(CheckValue("GroupID", actualValue, mG1.HasValue() ? mG1.Value() : 257U)); - } - - { - id actualValue = values.sceneID; - VerifyOrReturn(CheckValue("SceneID", actualValue, 1U)); - } - - { - id actualValue = values.transitionTime; - VerifyOrReturn(CheckValue("TransitionTime", actualValue, 1U)); - } - - { - id actualValue = values.extensionFieldSets; - VerifyOrReturn(CheckValue("ExtensionFieldSets", [actualValue count], static_cast(2))); - VerifyOrReturn(CheckValue("ClusterID", ((MTRScenesClusterExtensionFieldSet *) actualValue[0]).clusterID, 6UL)); - VerifyOrReturn(CheckValue("AttributeValueList", [((MTRScenesClusterExtensionFieldSet *) actualValue[0]).attributeValueList count], static_cast(1))); - VerifyOrReturn(CheckValue("AttributeID", ((MTRScenesClusterAttributeValuePair *) ((MTRScenesClusterExtensionFieldSet *) actualValue[0]).attributeValueList[0]).attributeID, 0UL)); - VerifyOrReturn(CheckValue("AttributeValue", ((MTRScenesClusterAttributeValuePair *) ((MTRScenesClusterExtensionFieldSet *) actualValue[0]).attributeValueList[0]).attributeValue, 1UL)); - VerifyOrReturn(CheckValue("ClusterID", ((MTRScenesClusterExtensionFieldSet *) actualValue[1]).clusterID, 8UL)); - VerifyOrReturn(CheckValue("AttributeValueList", [((MTRScenesClusterExtensionFieldSet *) actualValue[1]).attributeValueList count], static_cast(1))); - VerifyOrReturn(CheckValue("AttributeID", ((MTRScenesClusterAttributeValuePair *) ((MTRScenesClusterExtensionFieldSet *) actualValue[1]).attributeValueList[0]).attributeID, 0UL)); - VerifyOrReturn(CheckValue("AttributeValue", ((MTRScenesClusterAttributeValuePair *) ((MTRScenesClusterExtensionFieldSet *) actualValue[1]).attributeValueList[0]).attributeValue, 100UL)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep3aThSendsAEnhancedViewSceneCommandToDutWithTheGroupIDFieldSetToG1AndTheSceneIDFieldSetTo0x01_16() - { - - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please execute the ehanced-view-scene command and verify that the extensionfieldsets, status, groupID and SceneID are in accordance with AC1 on DUT and enter 'y' if the command is successfulgarbage: not in length on purpose", 190); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); - } - - CHIP_ERROR TestStep3bThSendsAViewSceneCommandToDutWithTheGroupIDFieldSetToG1AndTheSceneIDFieldSetTo0x01_17() - { - - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please execute the view-scene command and verify that the extensionfieldsets, status, groupID and SceneID are in accordance with AC1 on DUT and enter 'y' if the command is successfulgarbage: not in length on purpose", 182); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); - } - - CHIP_ERROR TestStep4ThSendsAGetSceneMembershipCommandToDutWithTheGroupIDFieldSetToG1_18() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRScenesClusterGetSceneMembershipParams alloc] init]; - params.groupID = mG1.HasValue() ? [NSNumber numberWithUnsignedShort:mG1.Value()] : [NSNumber numberWithUnsignedShort:257U]; - [cluster getSceneMembershipWithParams:params completion: - ^(MTRScenesClusterGetSceneMembershipResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Step 4: TH sends a GetSceneMembership command to DUT with the GroupID field set to G1. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 0U)); - } - - { - id actualValue = values.capacity; - VerifyOrReturn(CheckValueNonNull("Capacity", actualValue)); - VerifyOrReturn(CheckValue("Capacity", actualValue, [fabricCapacity unsignedCharValue] - 1U)); - } - - { - id actualValue = values.groupID; - VerifyOrReturn(CheckValue("GroupID", actualValue, mG1.HasValue() ? mG1.Value() : 257U)); - } - - { - id actualValue = values.sceneList; - VerifyOrReturn(CheckValue("SceneList", [actualValue count], static_cast(1))); - VerifyOrReturn(CheckValue("", actualValue[0], 1U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep5aThConfiguresAc2OnDutForAllImplementedApplicationClustersSupportingScenes_19() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRLevelControlClusterMoveToLevelWithOnOffParams alloc] init]; - params.level = - [NSNumber numberWithUnsignedChar:200U]; - params.transitionTime = - [NSNumber numberWithUnsignedShort:0U]; - params.optionsMask = - [NSNumber numberWithUnsignedChar:0U]; - params.optionsOverride = - [NSNumber numberWithUnsignedChar:0U]; - [cluster moveToLevelWithOnOffWithParams:params completion: - ^(NSError * _Nullable err) { - NSLog(@"Step 5a: TH configures AC2 on DUT for all implemented application clusters supporting scenes. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep5aThConfiguresAc2OnDutForAllImplementedApplicationClustersSupportingScenes_20() - { - - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please configure AC2 on DUT and enter 'y' after the configuration is completegarbage: not in length on purpose", 77); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); - } - - CHIP_ERROR TestStep5bThSendsARecallSceneCommandToGroupG1WithTheGroupIDFieldSetToG1AndTheSceneIdFieldSetTo0x01_21() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRScenesClusterRecallSceneParams alloc] init]; - params.groupID = mG1.HasValue() ? [NSNumber numberWithUnsignedShort:mG1.Value()] : [NSNumber numberWithUnsignedShort:257U]; - params.sceneID = - [NSNumber numberWithUnsignedChar:1U]; - [cluster recallSceneWithParams:params completion: - ^(NSError * _Nullable err) { - NSLog(@"Step 5b: TH sends a RecallScene command to group G1 with the GroupID field set to G1 and the scene ID field set to 0x01. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWait1s_22() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1050UL; - return WaitForMs("alpha", value); - } - - CHIP_ERROR TestThConfirmTheDutReachedAc1OnLevelControlClusterAfter1s_23() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeCurrentLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH confirm the DUT reached AC1 (on level control cluster) after 1s Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("CurrentLevel", actualValue)); - VerifyOrReturn(CheckValue("CurrentLevel", actualValue, 100U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestVerifyDutReturnsToAc1_24() - { - - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please confirm AC1 on DUT and enter 'y'.garbage: not in length on purpose", 40); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); - } - - CHIP_ERROR TestStep6aThSendsACopySceneCommandToDutWithTheModeFieldSetTo0x00TheGroupIdentifierFromFieldSetToG1TheSceneIdentifierFromFieldSetTo0x01TheGroupIdentifierToFieldSetToG1AndTheSceneIdentifierToFieldSetTo0x02_25() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRScenesClusterCopySceneParams alloc] init]; - params.mode = - [NSNumber numberWithUnsignedChar:0U]; - params.groupIdentifierFrom = mG1.HasValue() ? [NSNumber numberWithUnsignedShort:mG1.Value()] : [NSNumber numberWithUnsignedShort:257U]; - params.sceneIdentifierFrom = - [NSNumber numberWithUnsignedChar:1U]; - params.groupIdentifierTo = mG1.HasValue() ? [NSNumber numberWithUnsignedShort:mG1.Value()] : [NSNumber numberWithUnsignedShort:257U]; - params.sceneIdentifierTo = - [NSNumber numberWithUnsignedChar:2U]; - [cluster copySceneWithParams:params completion: - ^(MTRScenesClusterCopySceneResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Step 6a: TH sends a CopyScene command to DUT with the mode field set to 0x00, the group identifier from field set to G1, the scene identifier from field set to 0x01, the group identifier to field set to G1 and the scene identifier to field set to 0x02. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 0U)); - } - - { - id actualValue = values.groupIdentifierFrom; - VerifyOrReturn(CheckValue("GroupIdentifierFrom", actualValue, mG1.HasValue() ? mG1.Value() : 257U)); - } - - { - id actualValue = values.sceneIdentifierFrom; - VerifyOrReturn(CheckValue("SceneIdentifierFrom", actualValue, 1U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep6bThSendsAGetSceneMembershipCommandToDutWithTheGroupIDFieldSetToG1_26() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRScenesClusterGetSceneMembershipParams alloc] init]; - params.groupID = mG1.HasValue() ? [NSNumber numberWithUnsignedShort:mG1.Value()] : [NSNumber numberWithUnsignedShort:257U]; - [cluster getSceneMembershipWithParams:params completion: - ^(MTRScenesClusterGetSceneMembershipResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Step 6b: TH sends a GetSceneMembership command to DUT with the GroupID field set to G1. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 0U)); - } - - { - id actualValue = values.capacity; - VerifyOrReturn(CheckValueNonNull("Capacity", actualValue)); - VerifyOrReturn(CheckValue("Capacity", actualValue, [fabricCapacity unsignedCharValue] - 2U)); - } - - { - id actualValue = values.groupID; - VerifyOrReturn(CheckValue("GroupID", actualValue, mG1.HasValue() ? mG1.Value() : 257U)); - } - - { - id actualValue = values.sceneList; - VerifyOrReturn(CheckValue("SceneList", [actualValue count], static_cast(2))); - VerifyOrReturn(CheckValue("", actualValue[0], 1U)); - VerifyOrReturn(CheckValue("", actualValue[1], 2U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep7ThRemovesTheGroupKeySetThatWasAddedBySendingAKeySetRemoveCommandToTheGroupKeyManagementClusterWithTheGroupKeySetIDFieldSetTo0x01a1_27() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device endpointID:@(0) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRGroupKeyManagementClusterKeySetRemoveParams alloc] init]; - params.groupKeySetID = - [NSNumber numberWithUnsignedShort:417U]; - [cluster keySetRemoveWithParams:params completion: - ^(NSError * _Nullable err) { - NSLog(@"Step 7: TH removes the Group key set that was added by sending a KeySetRemove command to the GroupKeyManagement cluster with the GroupKeySetID field set to 0x01a1 Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - class Test_TC_S_2_4 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced @@ -176875,7 +175653,6 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), - make_unique(), make_unique(), make_unique(), make_unique(),