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 38edc082244bca..76aae218439f07 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 00bc4346fc36b9..d8edc24a8e391d 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/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/examples/lighting-app/lighting-common/lighting-app.matter b/examples/lighting-app/lighting-common/lighting-app.matter index 6876d707febd15..b0777fc19a97aa 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 c6060734636d52..f0b2108babcf4a 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 e02f879882dce8..fd92210ea3dd19 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 033a3ed146af73..bc62ad9ebc9c58 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -192,6 +192,8 @@ provisional 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 edcc25b83f5bbd..689f75dbc008c8 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -192,6 +192,8 @@ provisional 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..f1900416c4499b 100644 --- a/src/app/clusters/scenes-server/SceneTableImpl.cpp +++ b/src/app/clusters/scenes-server/SceneTableImpl.cpp @@ -928,8 +928,9 @@ 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(endpointSceneTableSize / 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 3be1dc43e48c26..60a378f43c3ce8 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 - 1) / 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..08ada73b3729a1 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 = (defaultTestTableSize - 1) / 2; + // 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); @@ -120,7 +130,10 @@ 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); // 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)); @@ -722,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)); @@ -754,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 @@ -785,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); @@ -796,7 +798,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); @@ -818,13 +820,13 @@ 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); } 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); @@ -835,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)); @@ -849,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); @@ -861,7 +861,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); @@ -873,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(); @@ -881,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(); @@ -889,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(); @@ -897,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(); @@ -905,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)); @@ -914,44 +914,36 @@ 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); 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 +977,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)); @@ -1014,39 +1003,38 @@ 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); 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, 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, scenes::kMaxScenesPerFabric - 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, 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)); @@ -1057,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 @@ -1075,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); @@ -1095,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)); @@ -1102,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)); @@ -1126,33 +1114,30 @@ 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 - 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, scenes::kMaxScenesPerFabric - 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, scenes::kMaxScenesPerFabric - 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)); @@ -1163,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)); @@ -1170,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)); @@ -1178,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)); @@ -1191,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)); @@ -1203,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)); @@ -1214,52 +1203,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 +1254,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 +1281,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 +1295,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 +1303,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 +1320,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 +1328,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 +1342,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)); @@ -1367,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)); @@ -1377,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); @@ -1385,26 +1368,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)); @@ -1414,10 +1397,9 @@ 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); + 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)); @@ -1427,19 +1409,18 @@ 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); + 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 +1433,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 +1448,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 +1467,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 +1521,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,18 +1545,16 @@ 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; + uint8_t fabric_capacity = 0; + uint8_t fabricsFullCount = defaultTestTableSize - 2; // Fill scene table // Fill fabric 1 to capacity @@ -1586,11 +1565,11 @@ 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); - 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 @@ -1601,17 +1580,58 @@ 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); - 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, 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); + 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, 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)); + 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, 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); @@ -1622,16 +1642,21 @@ 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); + 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)); + 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 +1664,72 @@ 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 - 2 - 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)); // Check count updated for fabric iterator = ReducedSceneTable.IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerFabric - 3 == iterator->Count()); + NL_TEST_ASSERT(aSuite, 2 == 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, 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); - // 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 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, 2 == 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); 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, 5 == 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/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/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. */ 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..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"); @@ -171491,112 +171490,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 +171670,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 +171686,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 +171763,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 +171827,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 +171851,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 +171872,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 +171893,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 +171914,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 +171941,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 +171962,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 +171983,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 +172004,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 +172030,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 +172051,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 +172072,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"); @@ -172411,1143 +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 : Step 0a: preparation step for using commands from Groups cluster: Add KeySet\n"); - err = TestStep0aPreparationStepForUsingCommandsFromGroupsClusterAddKeySet_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(); - 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"); - if (ShouldSkip("G.S.C00.Rsp")) { - NextTest(); - return; - } - err = TestStep1aThSendsAAddGroupCommandToDutWithTheGroupIDFieldSetToG1_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Install ACLs\n"); - err = TestInstallACLs_5(); - 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"); - if (ShouldSkip("S.S.C03.Rsp")) { - NextTest(); - return; - } - err = TestStep1bThSendsARemoveAllScenesCommandToDutWithTheGroupIDFieldSetToG1_6(); - 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"); - if (ShouldSkip("S.S.C06.Rsp")) { - NextTest(); - return; - } - err = TestStep1cThSendsAGetSceneMembershipCommandToDutWithTheGroupIDFieldSetToG1_7(); - 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"); - if (ShouldSkip("S.S.C40.Rsp && PICS_SDK_CI_ONLY")) { - NextTest(); - return; - } - err = TestStep2aThSendsAEnhancedAddSceneCommandToDutWithTheGroupIDFieldSetToG1TheSceneIDFieldSetTo0x01TheTransitionTimeFieldSetTo0x000a1sAndASetOfExtensionFieldsAppropriateToAc1_8(); - 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"); - if (ShouldSkip("S.S.C00.Rsp && PICS_SDK_CI_ONLY")) { - NextTest(); - return; - } - err = TestStep2bThSendsAAddSceneCommandToDutWithTheGroupIDFieldSetToG1TheSceneIDFieldSetTo0x01TheTransitionTimeFieldSetTo0x00011sAndASetOfExtensionFieldsAppropriateToAc1_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 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(); - 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"); - if (ShouldSkip("S.S.C00.Rsp && PICS_SKIP_SAMPLE_APP")) { - NextTest(); - return; - } - err = TestStep2bThSendsAAddSceneCommandToDutWithTheGroupIDFieldSetToG1TheSceneIDFieldSetTo0x01TheTransitionTimeFieldSetToG1AndASetOfExtensionFieldsAppropriateToAc1_11(); - 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"); - if (ShouldSkip("S.S.C41.Rsp && PICS_SDK_CI_ONLY")) { - NextTest(); - return; - } - err = TestStep3aThSendsAEnhancedViewSceneCommandToDutWithTheGroupIDFieldSetToG1AndTheSceneIDFieldSetTo0x01_12(); - 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"); - if (ShouldSkip("S.S.C01.Rsp && PICS_SDK_CI_ONLY")) { - NextTest(); - return; - } - err = TestStep3bThSendsAViewSceneCommandToDutWithTheGroupIDFieldSetToG1AndTheSceneIDFieldSetTo0x01_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_SKIP_SAMPLE_APP")) { - 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_SKIP_SAMPLE_APP")) { - NextTest(); - return; - } - err = TestStep3bThSendsAViewSceneCommandToDutWithTheGroupIDFieldSetToG1AndTheSceneIDFieldSetTo0x01_15(); - 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"); - if (ShouldSkip("S.S.C06.Rsp")) { - NextTest(); - return; - } - err = TestStep4ThSendsAGetSceneMembershipCommandToDutWithTheGroupIDFieldSetToG1_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : 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(); - break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : 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(); - 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"); - if (ShouldSkip("S.S.C05.Rsp")) { - NextTest(); - return; - } - err = TestStep5bThSendsARecallSceneCommandToGroupG1WithTheGroupIDFieldSetToG1AndTheSceneIdFieldSetTo0x01_19(); - break; - case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : Wait 1s\n"); - if (ShouldSkip("PICS_SDK_CI_ONLY")) { - NextTest(); - return; - } - err = TestWait1s_20(); - break; - case 21: - ChipLogProgress(chipTool, " ***** Test Step 21 : 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(); - break; - case 22: - ChipLogProgress(chipTool, " ***** Test Step 22 : Verify DUT returns to AC1.\n"); - if (ShouldSkip("PICS_SKIP_SAMPLE_APP")) { - NextTest(); - return; - } - err = TestVerifyDutReturnsToAc1_22(); - 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"); - if (ShouldSkip("S.S.C42.Rsp")) { - NextTest(); - return; - } - err = TestStep6aThSendsACopySceneCommandToDutWithTheModeFieldSetTo0x00TheGroupIdentifierFromFieldSetToG1TheSceneIdentifierFromFieldSetTo0x01TheGroupIdentifierToFieldSetToG1AndTheSceneIdentifierToFieldSetTo0x02_23(); - 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"); - if (ShouldSkip("S.S.C06.Rsp")) { - NextTest(); - return; - } - err = TestStep6bThSendsAGetSceneMembershipCommandToDutWithTheGroupIDFieldSetToG1_24(); - 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(); - 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; - } - - // 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 = 26; - - 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; - } - - CHIP_ERROR TestStep0aPreparationStepForUsingCommandsFromGroupsClusterAddKeySet_2() - { - - 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_3() - { - - 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_4() - { - - 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_5() - { - - 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_6() - { - - 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_7() - { - - 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; - VerifyOrReturn(CheckValueNonNull("Capacity", actualValue)); - VerifyOrReturn(CheckValue("Capacity", actualValue, [maxScenes unsignedShortValue] / 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(0))); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep2aThSendsAEnhancedAddSceneCommandToDutWithTheGroupIDFieldSetToG1TheSceneIDFieldSetTo0x01TheTransitionTimeFieldSetTo0x000a1sAndASetOfExtensionFieldsAppropriateToAc1_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 = [[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_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 = [[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_10() - { - - 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_11() - { - - 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_12() - { - - 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_13() - { - - 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_14() - { - - 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_15() - { - - 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_16() - { - - 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, ([maxScenes unsignedShortValue] / 2U) - 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_17() - { - - 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_18() - { - - 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_19() - { - - 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_20() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1050UL; - return WaitForMs("alpha", value); - } - - CHIP_ERROR TestThConfirmTheDutReachedAc1OnLevelControlClusterAfter1s_21() - { - - 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_22() - { - - 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_23() - { - - 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_24() - { - - 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, ([maxScenes unsignedShortValue] / 2U) - 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_25() - { - - 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 @@ -176739,7 +175653,6 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), - make_unique(), make_unique(), make_unique(), make_unique(),