From d88beed86f245db867d28c8f6cabab3c50530441 Mon Sep 17 00:00:00 2001 From: Minh Le <98434995+minhlez@users.noreply.github.com> Date: Wed, 23 Mar 2022 21:12:05 -0700 Subject: [PATCH] Implement startup behavior with StartUpMode (#16039) * Implement StartUpMode behavior with validation * Disable TestModeSelectCluster for darwin. To be added back in #16514 * Update StartUpMode of ModeSelectCluster to use NVM storage option and generate code * Restyled by clang-format Co-authored-by: Restyled.io --- .../all-clusters-app.matter | 2 +- .../all-clusters-common/all-clusters-app.zap | 18 +- examples/chip-tool-darwin/templates/tests.js | 1 - .../placeholder/linux/apps/app1/config.matter | 4 +- .../placeholder/linux/apps/app2/config.matter | 4 +- .../mode-select-server/mode-select-server.cpp | 114 ++++ .../tests/suites/TestModeSelectCluster.yaml | 52 ++ src/app/zap-templates/templates/app/helper.js | 8 +- .../data-model/chip/mode-select-cluster.xml | 2 +- .../data_model/controller-clusters.matter | 2 +- .../zap-generated/CHIPClustersWrite-JNI.cpp | 60 ++ .../chip/devicecontroller/ChipClusters.java | 15 + .../devicecontroller/ClusterWriteMapping.java | 16 + .../python/chip/clusters/CHIPClusters.py | 1 + .../Framework/CHIP/templates/tests/tests.js | 1 - .../CHIP/zap-generated/CHIPClustersObjc.h | 1 + .../CHIP/zap-generated/CHIPClustersObjc.mm | 23 + .../CHIP/zap-generated/CHIPTestClustersObjc.h | 1 - .../zap-generated/CHIPTestClustersObjc.mm | 23 - .../Framework/CHIPTests/CHIPClustersTests.m | 412 -------------- .../zap-generated/endpoint_config.h | 13 +- .../cluster/CHIPTestClustersObjc.h | 1 - .../cluster/CHIPTestClustersObjc.mm | 23 - .../zap-generated/cluster/Commands.h | 35 ++ .../zap-generated/test/Commands.h | 512 ------------------ .../zap-generated/cluster/Commands.h | 27 + .../chip-tool/zap-generated/test/Commands.h | 208 ++++++- .../app1/zap-generated/endpoint_config.h | 15 +- .../app2/zap-generated/endpoint_config.h | 15 +- 29 files changed, 603 insertions(+), 1006 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index a36db652a3dd62..245ad5d324e88c 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 @@ -1985,7 +1985,7 @@ server cluster ModeSelect = 80 { readonly attribute nullable enum16 standardNamespace = 1; readonly attribute ModeOptionStruct supportedModes[] = 2; readonly attribute int8u currentMode = 3; - readonly attribute nullable int8u startUpMode = 4; + attribute nullable int8u startUpMode = 4; attribute nullable int8u onMode = 5; readonly global attribute command_id generatedCommandList[] = 65528; readonly global attribute command_id acceptedCommandList[] = 65529; 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 c74772c8bc26f7..491c2d88690c48 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 @@ -8033,7 +8033,7 @@ "reportableChange": 0 }, { - "name": "ServerGeneratedCommandList", + "name": "GeneratedCommandList", "code": 65528, "mfgCode": null, "side": "server", @@ -8048,7 +8048,7 @@ "reportableChange": 0 }, { - "name": "ClientGeneratedCommandList", + "name": "AcceptedCommandList", "code": 65529, "mfgCode": null, "side": "server", @@ -8935,7 +8935,7 @@ "reportableChange": 0 }, { - "name": "ServerGeneratedCommandList", + "name": "GeneratedCommandList", "code": 65528, "mfgCode": null, "side": "server", @@ -8950,7 +8950,7 @@ "reportableChange": 0 }, { - "name": "ClientGeneratedCommandList", + "name": "AcceptedCommandList", "code": 65529, "mfgCode": null, "side": "server", @@ -10531,7 +10531,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "NVM", "singleton": 0, "bounded": 0, "defaultValue": "0", @@ -10571,7 +10571,7 @@ "reportableChange": 0 }, { - "name": "ServerGeneratedCommandList", + "name": "GeneratedCommandList", "code": 65528, "mfgCode": null, "side": "server", @@ -10586,7 +10586,7 @@ "reportableChange": 0 }, { - "name": "ClientGeneratedCommandList", + "name": "AcceptedCommandList", "code": 65529, "mfgCode": null, "side": "server", @@ -14842,7 +14842,7 @@ "reportableChange": 0 }, { - "name": "ServerGeneratedCommandList", + "name": "GeneratedCommandList", "code": 65528, "mfgCode": null, "side": "server", @@ -14857,7 +14857,7 @@ "reportableChange": 0 }, { - "name": "ClientGeneratedCommandList", + "name": "AcceptedCommandList", "code": 65529, "mfgCode": null, "side": "server", diff --git a/examples/chip-tool-darwin/templates/tests.js b/examples/chip-tool-darwin/templates/tests.js index 7cd1779c34e63a..87e68b38512571 100644 --- a/examples/chip-tool-darwin/templates/tests.js +++ b/examples/chip-tool-darwin/templates/tests.js @@ -234,7 +234,6 @@ function getTests() 'TestIdentifyCluster', 'TestLogCommands', 'TestOperationalCredentialsCluster', - 'TestModeSelectCluster', 'TestBinding', ]; diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index df68c1024a08cd..63037ef5627973 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -1024,7 +1024,7 @@ client cluster ModeSelect = 80 { readonly attribute nullable enum16 standardNamespace = 1; readonly attribute ModeOptionStruct supportedModes[] = 2; readonly attribute int8u currentMode = 3; - readonly attribute nullable int8u startUpMode = 4; + attribute nullable int8u startUpMode = 4; readonly global attribute command_id generatedCommandList[] = 65528; readonly global attribute command_id acceptedCommandList[] = 65529; readonly global attribute attrib_id attributeList[] = 65531; @@ -1053,7 +1053,7 @@ server cluster ModeSelect = 80 { readonly attribute nullable enum16 standardNamespace = 1; readonly attribute ModeOptionStruct supportedModes[] = 2; readonly attribute int8u currentMode = 3; - readonly attribute nullable int8u startUpMode = 4; + attribute nullable int8u startUpMode = 4; readonly global attribute command_id generatedCommandList[] = 65528; readonly global attribute command_id acceptedCommandList[] = 65529; readonly global attribute attrib_id attributeList[] = 65531; diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index df68c1024a08cd..63037ef5627973 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -1024,7 +1024,7 @@ client cluster ModeSelect = 80 { readonly attribute nullable enum16 standardNamespace = 1; readonly attribute ModeOptionStruct supportedModes[] = 2; readonly attribute int8u currentMode = 3; - readonly attribute nullable int8u startUpMode = 4; + attribute nullable int8u startUpMode = 4; readonly global attribute command_id generatedCommandList[] = 65528; readonly global attribute command_id acceptedCommandList[] = 65529; readonly global attribute attrib_id attributeList[] = 65531; @@ -1053,7 +1053,7 @@ server cluster ModeSelect = 80 { readonly attribute nullable enum16 standardNamespace = 1; readonly attribute ModeOptionStruct supportedModes[] = 2; readonly attribute int8u currentMode = 3; - readonly attribute nullable int8u startUpMode = 4; + attribute nullable int8u startUpMode = 4; readonly global attribute command_id generatedCommandList[] = 65528; readonly global attribute command_id acceptedCommandList[] = 65529; readonly global attribute attrib_id attributeList[] = 65531; diff --git a/src/app/clusters/mode-select-server/mode-select-server.cpp b/src/app/clusters/mode-select-server/mode-select-server.cpp index 6b050a8cab4cf5..cb700bed4d0d4e 100644 --- a/src/app/clusters/mode-select-server/mode-select-server.cpp +++ b/src/app/clusters/mode-select-server/mode-select-server.cpp @@ -28,15 +28,23 @@ #include #include #include +#include +#include #include using namespace std; using namespace chip; using namespace chip::app; using namespace chip::app::Clusters; +using namespace chip::app::Clusters::ModeSelect; +using namespace chip::Protocols; + +static InteractionModel::Status verifyModeValue(const EndpointId endpointId, const uint8_t newMode); namespace { +inline bool areStartUpModeAndCurrentModeNonVolatile(EndpointId endpoint); + class ModeSelectAttrAccess : public AttributeAccessInterface { public: @@ -103,7 +111,113 @@ bool emberAfModeSelectClusterChangeToModeCallback(CommandHandler * commandHandle return true; } +/** + * Callback for Mode Select Cluster Server Initialization. + * Enabled in src/app/zap-templates/templates/app/helper.js + * @param endpointId id of the endpoint that is being initialized + */ +void emberAfModeSelectClusterServerInitCallback(EndpointId endpointId) +{ + // StartUp behavior relies on CurrentMode StartUpMode attributes being non-volatile. + if (areStartUpModeAndCurrentModeNonVolatile(endpointId)) + { + // Read the StartUpMode attribute and set the CurrentMode attribute + // The StartUpMode attribute SHALL define the desired startup behavior of a + // device when it is supplied with power and this state SHALL be + // reflected in the CurrentMode attribute. The values of the StartUpMode + // attribute are listed below. + + DataModel::Nullable startUpMode; + EmberAfStatus status = Attributes::StartUpMode::Get(endpointId, startUpMode); + if (status == EMBER_ZCL_STATUS_SUCCESS && !startUpMode.IsNull()) + { + // Initialise currentMode to 0 + uint8_t currentMode = 0; + status = Attributes::CurrentMode::Get(endpointId, ¤tMode); + if (status == EMBER_ZCL_STATUS_SUCCESS && startUpMode.Value() != currentMode) + { + status = Attributes::CurrentMode::Set(endpointId, startUpMode.Value()); + if (status != EMBER_ZCL_STATUS_SUCCESS) + { + ChipLogError(Zcl, "ModeSelect: Error initializing CurrentMode, EmberAfStatus code 0x%02x", status); + } + else + { + emberAfPrintln(EMBER_AF_PRINT_DEBUG, "ModeSelect: Successfully initialized CurrentMode to %u", + startUpMode.Value()); + } + } + } + } + else + { + emberAfPrintln(EMBER_AF_PRINT_DEBUG, + "ModeSelect: Skipped initializing CurrentMode by StartUpMode because one of them is volatile"); + } +} + +namespace { + +/** + * Checks if StartUpMode and CurrentMode are non-volatile. + * @param endpointId id of the endpoint to check + * @return true if both attributes are non-volatile; false otherwise. + */ +inline bool areStartUpModeAndCurrentModeNonVolatile(EndpointId endpointId) +{ + return emberAfIsNonVolatileAttribute(endpointId, ModeSelect::Id, Attributes::CurrentMode::Id, true) && + emberAfIsNonVolatileAttribute(endpointId, ModeSelect::Id, Attributes::StartUpMode::Id, true); +} + +} // namespace + void MatterModeSelectPluginServerInitCallback(void) { registerAttributeAccessOverride(&gModeSelectAttrAccess); } + +/** + * Callback for Mode Select Cluster Server Pre Attribute Changed + * Enabled in src/app/zap-templates/templates/app/helper.js + * @param attributePath Concrete attribute path to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +InteractionModel::Status MatterModeSelectClusterServerPreAttributeChangedCallback(const ConcreteAttributePath & attributePath, + EmberAfAttributeType attributeType, uint16_t size, + uint8_t * value) +{ + const EndpointId endpointId = attributePath.mEndpointId; + InteractionModel::Status result; + + switch (attributePath.mAttributeId) + { + case ModeSelect::Attributes::StartUpMode::Id: + result = verifyModeValue(endpointId, *value); + break; + default: + result = InteractionModel::Status::Success; + } + + return result; +} + +/** + * Checks the new mode against the endpoint's supported modes. + * @param endpointId endpointId of the endpoint + * @param newMode value of the new mode + * @return Success status if the value is valid; InvalidValue otherwise. + */ +static InteractionModel::Status verifyModeValue(const EndpointId endpointId, const uint8_t newMode) +{ + const ModeSelect::Structs::ModeOptionStruct::Type * modeOptionPtr; + EmberAfStatus checkSupportedModeStatus = + ModeSelect::getSupportedModesManager()->getModeOptionByMode(endpointId, newMode, &modeOptionPtr); + if (EMBER_ZCL_STATUS_SUCCESS != checkSupportedModeStatus) + { + const InteractionModel::Status returnStatus = ToInteractionModelStatus(checkSupportedModeStatus); + return returnStatus; + } + return InteractionModel::Status::Success; +} diff --git a/src/app/tests/suites/TestModeSelectCluster.yaml b/src/app/tests/suites/TestModeSelectCluster.yaml index a27f110eb5aaf6..c3b070fe999904 100644 --- a/src/app/tests/suites/TestModeSelectCluster.yaml +++ b/src/app/tests/suites/TestModeSelectCluster.yaml @@ -18,6 +18,9 @@ config: nodeId: 0x12344321 cluster: "Mode Select" endpoint: 1 + discriminator: + type: INT16U + defaultValue: 3840 tests: - label: "Wait for the commissioned device to be retrieved" @@ -135,3 +138,52 @@ tests: attribute: "CurrentMode" response: value: OnModeValue + + - label: "Change to Unsupported StartUp Mode" + command: "writeAttribute" + attribute: "StartUpMode" + arguments: + value: 2 + response: + error: CONSTRAINT_ERROR + + - label: "Change to Supported StartUp Mode" + command: "writeAttribute" + attribute: "StartUpMode" + arguments: + value: 7 + + - label: "Verify StartUp Mode Change" + command: "readAttribute" + attribute: "StartUpMode" + response: + value: 7 + + - label: "Change CurrentMode to another value" + command: "changeToMode" + arguments: + values: + - name: "NewMode" + value: 0 + + - label: "Reboot target device" + cluster: "SystemCommands" + command: "Reboot" + arguments: + values: + - name: "discriminator" + value: discriminator + + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Verify Current Mode Change based on new StartUp Mode" + command: "readAttribute" + attribute: "CurrentMode" + response: + value: 7 diff --git a/src/app/zap-templates/templates/app/helper.js b/src/app/zap-templates/templates/app/helper.js index 1445874804c91b..04817befafbd26 100644 --- a/src/app/zap-templates/templates/app/helper.js +++ b/src/app/zap-templates/templates/app/helper.js @@ -120,6 +120,7 @@ var endpointClusterWithInit = [ 'Scenes', 'Time Format Localization', 'Thermostat', + 'Mode Select', ]; var endpointClusterWithAttributeChanged = [ 'Bridged Device Basic', @@ -129,7 +130,12 @@ var endpointClusterWithAttributeChanged = [ 'Window Covering', ]; var endpointClusterWithPreAttribute = [ - 'IAS Zone', 'Door Lock', 'Thermostat User Interface Configuration', 'Time Format Localization', 'Localization Configuration' + 'IAS Zone', + 'Door Lock', + 'Thermostat User Interface Configuration', + 'Time Format Localization', + 'Localization Configuration', + 'Mode Select', ]; var endpointClusterWithMessageSent = [ 'IAS Zone' ]; diff --git a/src/app/zap-templates/zcl/data-model/chip/mode-select-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/mode-select-cluster.xml index 6b41513b2990ad..af1e3cc22c17b9 100644 --- a/src/app/zap-templates/zcl/data-model/chip/mode-select-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/mode-select-cluster.xml @@ -45,7 +45,7 @@ limitations under the License. StandardNamespace SupportedModes CurrentMode - StartUpMode + StartUpMode OnMode diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 6b3398c3d7df27..61edfa042933fe 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -2380,7 +2380,7 @@ client cluster ModeSelect = 80 { readonly attribute nullable enum16 standardNamespace = 1; readonly attribute ModeOptionStruct supportedModes[] = 2; readonly attribute int8u currentMode = 3; - readonly attribute nullable int8u startUpMode = 4; + attribute nullable int8u startUpMode = 4; attribute nullable int8u onMode = 5; readonly global attribute command_id generatedCommandList[] = 65528; readonly global attribute command_id acceptedCommandList[] = 65529; diff --git a/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp b/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp index 7a1a6d0395f110..8097fdea6c08c0 100644 --- a/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp +++ b/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp @@ -2609,6 +2609,66 @@ JNI_METHOD(void, LocalizationConfigurationCluster, writeActiveLocaleAttribute) onFailure.release(); } +JNI_METHOD(void, ModeSelectCluster, writeStartUpModeAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) +{ + chip::DeviceLayer::StackLock lock; + ListFreer listFreer; + using TypeInfo = chip::app::Clusters::ModeSelect::Attributes::StartUpMode::TypeInfo; + TypeInfo::Type cppValue; + + std::vector> cleanupByteArrays; + std::vector> cleanupStrings; + + if (value == nullptr) + { + cppValue.SetNull(); + } + else + { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + } + + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + ModeSelectCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + if (timedWriteTimeoutMs == nullptr) + { + err = cppCluster->WriteAttribute(cppValue, onSuccess->mContext, successFn->mCall, failureFn->mCall); + } + else + { + err = cppCluster->WriteAttribute(cppValue, onSuccess->mContext, successFn->mCall, failureFn->mCall, + chip::JniReferences::GetInstance().IntegerToPrimitive(timedWriteTimeoutMs)); + } + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + JNI_METHOD(void, ModeSelectCluster, writeOnModeAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java index b591c9b7f39264..16d342275cc298 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java @@ -11149,6 +11149,15 @@ public void readStartUpModeAttribute(StartUpModeAttributeCallback callback) { readStartUpModeAttribute(chipClusterPtr, callback); } + public void writeStartUpModeAttribute(DefaultClusterCallback callback, Integer value) { + writeStartUpModeAttribute(chipClusterPtr, callback, value, null); + } + + public void writeStartUpModeAttribute( + DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { + writeStartUpModeAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); + } + public void subscribeStartUpModeAttribute( StartUpModeAttributeCallback callback, int minInterval, int maxInterval) { subscribeStartUpModeAttribute(chipClusterPtr, callback, minInterval, maxInterval); @@ -11253,6 +11262,12 @@ private native void subscribeCurrentModeAttribute( private native void readStartUpModeAttribute( long chipClusterPtr, StartUpModeAttributeCallback callback); + private native void writeStartUpModeAttribute( + long chipClusterPtr, + DefaultClusterCallback callback, + Integer value, + @Nullable Integer timedWriteTimeoutMs); + private native void subscribeStartUpModeAttribute( long chipClusterPtr, StartUpModeAttributeCallback callback, diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ClusterWriteMapping.java b/src/controller/java/zap-generated/chip/devicecontroller/ClusterWriteMapping.java index 1b767580eb505d..24518720f29eb5 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ClusterWriteMapping.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ClusterWriteMapping.java @@ -776,6 +776,22 @@ public Map> getWriteAttributeMap() { Map writeMediaPlaybackInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("mediaPlayback", writeMediaPlaybackInteractionInfo); Map writeModeSelectInteractionInfo = new LinkedHashMap<>(); + Map writeModeSelectStartUpModeCommandParams = + new LinkedHashMap(); + CommandParameterInfo modeSelectstartUpModeCommandParameterInfo = + new CommandParameterInfo("value", Integer.class); + writeModeSelectStartUpModeCommandParams.put("value", modeSelectstartUpModeCommandParameterInfo); + InteractionInfo writeModeSelectStartUpModeAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ModeSelectCluster) cluster) + .writeStartUpModeAttribute( + (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); + }, + () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), + writeModeSelectStartUpModeCommandParams); + writeModeSelectInteractionInfo.put( + "writeStartUpModeAttribute", writeModeSelectStartUpModeAttributeInteractionInfo); Map writeModeSelectOnModeCommandParams = new LinkedHashMap(); CommandParameterInfo modeSelectonModeCommandParameterInfo = diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 532da158fd2628..de9d36bd47833b 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -3499,6 +3499,7 @@ class ChipClusters: "attributeId": 0x00000004, "type": "int", "reportable": True, + "writable": True, }, 0x00000005: { "attributeName": "OnMode", diff --git a/src/darwin/Framework/CHIP/templates/tests/tests.js b/src/darwin/Framework/CHIP/templates/tests/tests.js index ef894546f2615a..5d33a2b078cac4 100644 --- a/src/darwin/Framework/CHIP/templates/tests/tests.js +++ b/src/darwin/Framework/CHIP/templates/tests/tests.js @@ -255,7 +255,6 @@ function getTests() 'TestIdentifyCluster', 'TestLogCommands', 'TestOperationalCredentialsCluster', - 'TestModeSelectCluster', 'TestBinding', ]; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h index 8bea9196da2f7b..56c6deb418a178 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h @@ -7249,6 +7249,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)readAttributeStartUpModeWithCompletionHandler:(void (^)( NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; +- (void)writeAttributeStartUpModeWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; /** * This API does not support setting autoResubscribe to NO in the * CHIPSubscribeParams. diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm index 367dda050f27b3..f9bcce15629f2a 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm @@ -26927,6 +26927,29 @@ new CHIPNullableInt8uAttributeCallbackBridge( }); } +- (void)writeAttributeStartUpModeWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler +{ + new CHIPDefaultSuccessCallbackBridge( + self.callbackQueue, + ^(id _Nullable ignored, NSError * _Nullable error) { + completionHandler(error); + }, + ^(Cancelable * success, Cancelable * failure) { + ListFreer listFreer; + using TypeInfo = ModeSelect::Attributes::StartUpMode::TypeInfo; + TypeInfo::Type cppValue; + if (value == nil) { + cppValue.SetNull(); + } else { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = value.unsignedCharValue; + } + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + - (void)subscribeAttributeStartUpModeWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval params:(CHIPSubscribeParams * _Nullable)params diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.h index c6753ae1bb6de0..601a1e3e207143 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.h @@ -701,7 +701,6 @@ NS_ASSUME_NONNULL_BEGIN - (void)writeAttributeStandardNamespaceWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeSupportedModesWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeCurrentModeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeStartUpModeWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm index 87bfd9a92e852f..2837ff1ceec708 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm @@ -9350,29 +9350,6 @@ new CHIPDefaultSuccessCallbackBridge( }); } -- (void)writeAttributeStartUpModeWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ModeSelect::Attributes::StartUpMode::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedCharValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - - (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler { new CHIPDefaultSuccessCallbackBridge( diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index 180ffae02bacba..acc67d4f028669 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -48729,418 +48729,6 @@ - (void)testSendClusterTestOperationalCredentialsCluster_000007_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTestModeSelectCluster_000000_WaitForCommissionee -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForCommissionee(expectation, queue, 305414945); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestModeSelectCluster_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read Description"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeDescriptionWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read Description Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue([actualValue isEqualToString:@"Coffee"]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestModeSelectCluster_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read StandardNamespace"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeStandardNamespaceWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read StandardNamespace Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestModeSelectCluster_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read SupportedModes"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeSupportedModesWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read SupportedModes Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 3); - XCTAssertTrue([((CHIPModeSelectClusterModeOptionStruct *) actualValue[0]).label isEqualToString:@"Black"]); - XCTAssertEqual([((CHIPModeSelectClusterModeOptionStruct *) actualValue[0]).mode unsignedCharValue], 0); - XCTAssertEqual([((CHIPModeSelectClusterModeOptionStruct *) actualValue[0]).semanticTag unsignedIntValue], 0UL); - XCTAssertTrue([((CHIPModeSelectClusterModeOptionStruct *) actualValue[1]).label isEqualToString:@"Cappuccino"]); - XCTAssertEqual([((CHIPModeSelectClusterModeOptionStruct *) actualValue[1]).mode unsignedCharValue], 4); - XCTAssertEqual([((CHIPModeSelectClusterModeOptionStruct *) actualValue[1]).semanticTag unsignedIntValue], 0UL); - XCTAssertTrue([((CHIPModeSelectClusterModeOptionStruct *) actualValue[2]).label isEqualToString:@"Espresso"]); - XCTAssertEqual([((CHIPModeSelectClusterModeOptionStruct *) actualValue[2]).mode unsignedCharValue], 7); - XCTAssertEqual([((CHIPModeSelectClusterModeOptionStruct *) actualValue[2]).semanticTag unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestModeSelectCluster_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read CurrentMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read CurrentMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestModeSelectCluster_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read StartUpMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeStartUpModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read StartUpMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestModeSelectCluster_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read OnMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read OnMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue(actualValue == nil); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestModeSelectCluster_000007_ChangeToMode -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Change to Supported Mode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPModeSelectClusterChangeToModeParams alloc] init]; - params.newMode = [NSNumber numberWithUnsignedChar:4]; - [cluster changeToModeWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Change to Supported Mode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull currentModeBeforeToggle; -- (void)testSendClusterTestModeSelectCluster_000008_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Verify Current Mode Change"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify Current Mode Change Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 4); - } - { - id actualValue = value; - currentModeBeforeToggle = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestModeSelectCluster_000009_ChangeToMode -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Change to Unsupported Mode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPModeSelectClusterChangeToModeParams alloc] init]; - params.newMode = [NSNumber numberWithUnsignedChar:2]; - [cluster changeToModeWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Change to Unsupported Mode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestModeSelectCluster_000010_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Toggle OnOff"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Toggle OnOff Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestModeSelectCluster_000011_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Toggle OnOff"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Toggle OnOff Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestModeSelectCluster_000012_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Verify Current Mode does not change when OnMode is null"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify Current Mode does not change when OnMode is null Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, currentModeBeforeToggle); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestModeSelectCluster_000013_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Change OnMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id onModeArgument; - onModeArgument = [NSNumber numberWithUnsignedChar:7]; - [cluster writeAttributeOnModeWithValue:onModeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Change OnMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nullable OnModeValue; -- (void)testSendClusterTestModeSelectCluster_000014_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Verify OnMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify OnMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 7); - } - { - id actualValue = value; - OnModeValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestModeSelectCluster_000015_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Toggle OnOff"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Toggle OnOff Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestModeSelectCluster_000016_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Toggle OnOff"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Toggle OnOff Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestModeSelectCluster_000017_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Verify Current Mode Changes if OnMode is not null"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify Current Mode Changes if OnMode is not null Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, OnModeValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - - (void)testSendClusterTestBinding_000000_WaitForCommissionee { XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; diff --git a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h index 760272f0ca8256..02e60deaa833c9 100644 --- a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h +++ b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h @@ -1455,8 +1455,9 @@ { 0x00000000, ZAP_TYPE(CHAR_STRING), 33, 0, ZAP_LONG_DEFAULTS_INDEX(379) }, /* Description */ \ { 0x00000001, ZAP_TYPE(ENUM16), 2, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0) }, /* StandardNamespace */ \ { 0x00000002, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* SupportedModes */ \ - { 0x00000003, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* CurrentMode */ \ - { 0x00000004, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x00000003, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(TOKENIZE), ZAP_SIMPLE_DEFAULT(0) }, /* CurrentMode */ \ + { 0x00000004, ZAP_TYPE(INT8U), 1, \ + ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(0) }, /* StartUpMode */ \ { 0x00000005, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(255) }, /* OnMode */ \ @@ -2027,6 +2028,10 @@ const EmberAfGenericClusterFunction chipFuncArrayLevelControlServer[] = { \ (EmberAfGenericClusterFunction) emberAfLevelControlClusterServerInitCallback, \ }; \ + const EmberAfGenericClusterFunction chipFuncArrayModeSelectServer[] = { \ + (EmberAfGenericClusterFunction) emberAfModeSelectClusterServerInitCallback, \ + (EmberAfGenericClusterFunction) MatterModeSelectClusterServerPreAttributeChangedCallback, \ + }; \ const EmberAfGenericClusterFunction chipFuncArrayDoorLockServer[] = { \ (EmberAfGenericClusterFunction) MatterDoorLockClusterServerAttributeChangedCallback, \ (EmberAfGenericClusterFunction) MatterDoorLockClusterServerPreAttributeChangedCallback, \ @@ -2873,8 +2878,8 @@ .attributes = ZAP_ATTRIBUTE_INDEX(272), \ .attributeCount = 8, \ .clusterSize = 44, \ - .mask = ZAP_CLUSTER_MASK(SERVER), \ - .functions = NULL, \ + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ + .functions = chipFuncArrayModeSelectServer, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 125 ) ,\ .generatedCommandList = nullptr ,\ },\ diff --git a/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.h b/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.h index c6753ae1bb6de0..601a1e3e207143 100644 --- a/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.h +++ b/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.h @@ -701,7 +701,6 @@ NS_ASSUME_NONNULL_BEGIN - (void)writeAttributeStandardNamespaceWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeSupportedModesWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeCurrentModeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeStartUpModeWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; diff --git a/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.mm b/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.mm index 87bfd9a92e852f..2837ff1ceec708 100644 --- a/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.mm +++ b/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.mm @@ -9350,29 +9350,6 @@ new CHIPDefaultSuccessCallbackBridge( }); } -- (void)writeAttributeStartUpModeWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ModeSelect::Attributes::StartUpMode::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedCharValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - - (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler { new CHIPDefaultSuccessCallbackBridge( diff --git a/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h index e5b2fae755e46c..75df474bd97069 100644 --- a/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h @@ -34949,6 +34949,40 @@ class ReadModeSelectStartUpMode : public ModelCommand { } }; +class WriteModeSelectStartUpMode : public ModelCommand { +public: + WriteModeSelectStartUpMode() + : ModelCommand("write") + { + AddArgument("attr-name", "start-up-mode"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteModeSelectStartUpMode() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000050) WriteAttribute (0x00000004) on endpoint %" PRIu16, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPModeSelect * cluster = [[CHIPModeSelect alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; + CHIP_ERROR __block err = CHIP_NO_ERROR; + + NSNumber * _Nullable value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster writeAttributeStartUpModeWithValue:value + completionHandler:^(NSError * _Nullable error) { + err = [CHIPError errorToCHIPErrorCode:error]; + ChipLogError(chipTool, "ModeSelect StartUpMode Error: %s", chip::ErrorStr(err)); + SetCommandExitStatus(err); + }]; + return err; + } + +private: + uint8_t mValue; +}; + class SubscribeAttributeModeSelectStartUpMode : public ModelCommand { public: SubscribeAttributeModeSelectStartUpMode() @@ -73875,6 +73909,7 @@ void registerClusterModeSelect(Commands & commands) make_unique(), // make_unique(), // make_unique(), // + make_unique(), // make_unique(), // make_unique(), // make_unique(), // diff --git a/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h b/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h index 3e7d79e5cf6b95..44fcafab7368ef 100644 --- a/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h @@ -158,7 +158,6 @@ class TestList : public Command { printf("TestIdentifyCluster\n"); printf("TestLogCommands\n"); printf("TestOperationalCredentialsCluster\n"); - printf("TestModeSelectCluster\n"); printf("TestBinding\n"); printf("Test_TC_SWDIAG_1_1\n"); printf("Test_TC_SWDIAG_2_1\n"); @@ -55788,516 +55787,6 @@ class TestOperationalCredentialsCluster : public TestCommandBridge { } }; -class TestModeSelectCluster : public TestCommandBridge { -public: - TestModeSelectCluster() - : TestCommandBridge("TestModeSelectCluster") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestModeSelectCluster() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: TestModeSelectCluster\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: TestModeSelectCluster\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 : Read Description\n"); - err = TestReadDescription_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read StandardNamespace\n"); - err = TestReadStandardNamespace_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read SupportedModes\n"); - err = TestReadSupportedModes_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read CurrentMode\n"); - err = TestReadCurrentMode_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read StartUpMode\n"); - err = TestReadStartUpMode_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Read OnMode\n"); - err = TestReadOnMode_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Change to Supported Mode\n"); - err = TestChangeToSupportedMode_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Verify Current Mode Change\n"); - err = TestVerifyCurrentModeChange_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Change to Unsupported Mode\n"); - err = TestChangeToUnsupportedMode_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Toggle OnOff\n"); - err = TestToggleOnOff_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Toggle OnOff\n"); - err = TestToggleOnOff_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Verify Current Mode does not change when OnMode is null\n"); - err = TestVerifyCurrentModeDoesNotChangeWhenOnModeIsNull_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Change OnMode\n"); - err = TestChangeOnMode_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Verify OnMode\n"); - err = TestVerifyOnMode_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Toggle OnOff\n"); - err = TestToggleOnOff_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Toggle OnOff\n"); - err = TestToggleOnOff_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Verify Current Mode Changes if OnMode is not null\n"); - err = TestVerifyCurrentModeChangesIfOnModeIsNotNull_17(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - 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 = 18; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadDescription_1() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeDescriptionWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read Description Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValueAsString("Description", actualValue, @"Coffee")); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadStandardNamespace_2() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeStandardNamespaceWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read StandardNamespace Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("StandardNamespace", actualValue)); - VerifyOrReturn(CheckValue("StandardNamespace", actualValue, 0U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadSupportedModes_3() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeSupportedModesWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read SupportedModes Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("SupportedModes", [actualValue count], static_cast(3))); - VerifyOrReturn( - CheckValueAsString("Label", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[0]).label, @"Black")); - VerifyOrReturn(CheckValue("Mode", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[0]).mode, 0)); - VerifyOrReturn( - CheckValue("SemanticTag", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[0]).semanticTag, 0UL)); - VerifyOrReturn( - CheckValueAsString("Label", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[1]).label, @"Cappuccino")); - VerifyOrReturn(CheckValue("Mode", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[1]).mode, 4)); - VerifyOrReturn( - CheckValue("SemanticTag", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[1]).semanticTag, 0UL)); - VerifyOrReturn( - CheckValueAsString("Label", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[2]).label, @"Espresso")); - VerifyOrReturn(CheckValue("Mode", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[2]).mode, 7)); - VerifyOrReturn( - CheckValue("SemanticTag", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[2]).semanticTag, 0UL)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadCurrentMode_4() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeCurrentModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read CurrentMode Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("CurrentMode", actualValue, 0)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadStartUpMode_5() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeStartUpModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read StartUpMode Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("StartUpMode", actualValue)); - VerifyOrReturn(CheckValue("StartUpMode", actualValue, 0)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadOnMode_6() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeOnModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read OnMode Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValueNull("OnMode", actualValue)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestChangeToSupportedMode_7() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[CHIPModeSelectClusterChangeToModeParams alloc] init]; - params.newMode = [NSNumber numberWithUnsignedChar:4]; - [cluster changeToModeWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Change to Supported Mode Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - NSNumber * _Nonnull currentModeBeforeToggle; - - CHIP_ERROR TestVerifyCurrentModeChange_8() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeCurrentModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify Current Mode Change Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("CurrentMode", actualValue, 4)); - } - { - currentModeBeforeToggle = value; - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestChangeToUnsupportedMode_9() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[CHIPModeSelectClusterChangeToModeParams alloc] init]; - params.newMode = [NSNumber numberWithUnsignedChar:2]; - [cluster changeToModeWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Change to Unsupported Mode Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestToggleOnOff_10() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Toggle OnOff Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestToggleOnOff_11() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Toggle OnOff Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestVerifyCurrentModeDoesNotChangeWhenOnModeIsNull_12() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeCurrentModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify Current Mode does not change when OnMode is null Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("CurrentMode", actualValue, currentModeBeforeToggle)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestChangeOnMode_13() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id onModeArgument; - onModeArgument = [NSNumber numberWithUnsignedChar:7]; - [cluster writeAttributeOnModeWithValue:onModeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Change OnMode Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - NSNumber * _Nullable OnModeValue; - - CHIP_ERROR TestVerifyOnMode_14() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeOnModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify OnMode Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("OnMode", actualValue)); - VerifyOrReturn(CheckValue("OnMode", actualValue, 7)); - } - { - OnModeValue = value; - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestToggleOnOff_15() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Toggle OnOff Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestToggleOnOff_16() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Toggle OnOff Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestVerifyCurrentModeChangesIfOnModeIsNotNull_17() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeCurrentModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify Current Mode Changes if OnMode is not null Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("CurrentMode", actualValue, OnModeValue)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - class TestBinding : public TestCommandBridge { public: TestBinding() @@ -57452,7 +56941,6 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), - make_unique(), make_unique(), make_unique(), make_unique(), diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index a6c6bdb48e050d..41a3b8c09bd0ff 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -7198,6 +7198,32 @@ class ModeSelectChangeToMode : public ClusterCommand chip::app::Clusters::ModeSelect::Commands::ChangeToMode::Type mRequest; }; +class WriteModeSelectStartUpMode : public WriteAttribute +{ +public: + WriteModeSelectStartUpMode(CredentialIssuerCommands * credsIssuerConfig) : WriteAttribute("StartUpMode", credsIssuerConfig) + { + AddArgument("attr-name", "start-up-mode"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteModeSelectStartUpMode() {} + + CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override + { + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x00000050, 0x00000004, mValue); + } + + CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex, chip::NodeId senderNodeId) override + { + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, senderNodeId, 0x00000050, 0x00000004, mValue); + } + +private: + chip::app::DataModel::Nullable mValue; +}; + class WriteModeSelectOnMode : public WriteAttribute { public: @@ -21796,6 +21822,7 @@ void registerClusterModeSelect(Commands & commands, CredentialIssuerCommands * c make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // make_unique(Id, credsIssuerConfig), // + make_unique(credsIssuerConfig), // make_unique(credsIssuerConfig), // make_unique(Id, credsIssuerConfig), // make_unique(Id, "description", Attributes::Description::Id, credsIssuerConfig), // diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index c43ae121cefa38..767cce84c1d7fc 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -90171,6 +90171,7 @@ class TestModeSelectClusterSuite : public TestCommand AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } @@ -90273,6 +90274,34 @@ class TestModeSelectClusterSuite : public TestCommand ChipLogProgress(chipTool, " ***** Test Step 17 : Verify Current Mode Changes if OnMode is not null\n"); err = TestVerifyCurrentModeChangesIfOnModeIsNotNull_17(); break; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : Change to Unsupported StartUp Mode\n"); + err = TestChangeToUnsupportedStartUpMode_18(); + break; + case 19: + ChipLogProgress(chipTool, " ***** Test Step 19 : Change to Supported StartUp Mode\n"); + err = TestChangeToSupportedStartUpMode_19(); + break; + case 20: + ChipLogProgress(chipTool, " ***** Test Step 20 : Verify StartUp Mode Change\n"); + err = TestVerifyStartUpModeChange_20(); + break; + case 21: + ChipLogProgress(chipTool, " ***** Test Step 21 : Change CurrentMode to another value\n"); + err = TestChangeCurrentModeToAnotherValue_21(); + break; + case 22: + ChipLogProgress(chipTool, " ***** Test Step 22 : Reboot target device\n"); + err = TestRebootTargetDevice_22(); + break; + case 23: + ChipLogProgress(chipTool, " ***** Test Step 23 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_23(); + break; + case 24: + ChipLogProgress(chipTool, " ***** Test Step 24 : Verify Current Mode Change based on new StartUp Mode\n"); + err = TestVerifyCurrentModeChangeBasedOnNewStartUpMode_24(); + break; } if (CHIP_NO_ERROR != err) @@ -90289,11 +90318,12 @@ class TestModeSelectClusterSuite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 18; + const uint16_t mTestCount = 25; chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; + chip::Optional mDiscriminator; chip::Optional mTimeout; uint8_t currentModeBeforeToggle; @@ -90420,6 +90450,46 @@ class TestModeSelectClusterSuite : public TestCommand (static_cast(context))->OnSuccessResponse_17(currentMode); } + static void OnFailureCallback_18(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_18(error); + } + + static void OnSuccessCallback_18(void * context) + { + (static_cast(context))->OnSuccessResponse_18(); + } + + static void OnFailureCallback_19(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_19(error); + } + + static void OnSuccessCallback_19(void * context) + { + (static_cast(context))->OnSuccessResponse_19(); + } + + static void OnFailureCallback_20(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_20(error); + } + + static void OnSuccessCallback_20(void * context, const chip::app::DataModel::Nullable & startUpMode) + { + (static_cast(context))->OnSuccessResponse_20(startUpMode); + } + + static void OnFailureCallback_24(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_24(error); + } + + static void OnSuccessCallback_24(void * context, uint8_t currentMode) + { + (static_cast(context))->OnSuccessResponse_24(currentMode); + } + // // Tests methods // @@ -90880,6 +90950,142 @@ class TestModeSelectClusterSuite : public TestCommand NextTest(); } + + CHIP_ERROR TestChangeToUnsupportedStartUpMode_18() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ModeSelectClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + chip::app::DataModel::Nullable startUpModeArgument; + startUpModeArgument.SetNonNull(); + startUpModeArgument.Value() = 2; + + ReturnErrorOnFailure(cluster.WriteAttribute( + startUpModeArgument, this, OnSuccessCallback_18, OnFailureCallback_18)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_18(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + NextTest(); + } + + void OnSuccessResponse_18() { ThrowSuccessResponse(); } + + CHIP_ERROR TestChangeToSupportedStartUpMode_19() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ModeSelectClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + chip::app::DataModel::Nullable startUpModeArgument; + startUpModeArgument.SetNonNull(); + startUpModeArgument.Value() = 7; + + ReturnErrorOnFailure(cluster.WriteAttribute( + startUpModeArgument, this, OnSuccessCallback_19, OnFailureCallback_19)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_19(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_19() { NextTest(); } + + CHIP_ERROR TestVerifyStartUpModeChange_20() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ModeSelectClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_20, OnFailureCallback_20, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_20(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_20(const chip::app::DataModel::Nullable & startUpMode) + { + VerifyOrReturn(CheckValueNonNull("startUpMode", startUpMode)); + VerifyOrReturn(CheckValue("startUpMode.Value()", startUpMode.Value(), 7)); + + NextTest(); + } + + CHIP_ERROR TestChangeCurrentModeToAnotherValue_21() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::ModeSelect::Commands::ChangeToMode::Type; + + RequestType request; + request.newMode = 0; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_21(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_21(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_21(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_21() { NextTest(); } + + CHIP_ERROR TestRebootTargetDevice_22() + { + SetIdentity(kIdentityAlpha); + return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_23() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + + CHIP_ERROR TestVerifyCurrentModeChangeBasedOnNewStartUpMode_24() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ModeSelectClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_24, OnFailureCallback_24, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_24(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_24(uint8_t currentMode) + { + VerifyOrReturn(CheckValue("currentMode", currentMode, 7)); + + NextTest(); + } }; class TestSystemCommandsSuite : public TestCommand diff --git a/zzz_generated/placeholder/app1/zap-generated/endpoint_config.h b/zzz_generated/placeholder/app1/zap-generated/endpoint_config.h index cc7101d2393a9c..f828fa6405832b 100644 --- a/zzz_generated/placeholder/app1/zap-generated/endpoint_config.h +++ b/zzz_generated/placeholder/app1/zap-generated/endpoint_config.h @@ -375,9 +375,10 @@ ZAP_EMPTY_DEFAULT() }, /* StandardNamespace */ \ { 0x00000002, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* SupportedModes */ \ { 0x00000003, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* CurrentMode */ \ - { 0x00000004, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* StartUpMode */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(40) }, /* FeatureMap */ \ - { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + { 0x00000004, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* StartUpMode */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(40) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Window Covering (server) */ \ { 0x00000000, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* Type */ \ @@ -616,6 +617,10 @@ const EmberAfGenericClusterFunction chipFuncArrayBasicServer[] = { \ (EmberAfGenericClusterFunction) emberAfBasicClusterServerInitCallback, \ }; \ + const EmberAfGenericClusterFunction chipFuncArrayModeSelectServer[] = { \ + (EmberAfGenericClusterFunction) emberAfModeSelectClusterServerInitCallback, \ + (EmberAfGenericClusterFunction) MatterModeSelectClusterServerPreAttributeChangedCallback, \ + }; \ const EmberAfGenericClusterFunction chipFuncArrayWindowCoveringServer[] = { \ (EmberAfGenericClusterFunction) MatterWindowCoveringClusterServerAttributeChangedCallback, \ }; \ @@ -963,8 +968,8 @@ .attributes = ZAP_ATTRIBUTE_INDEX(68), \ .attributeCount = 7, \ .clusterSize = 41, \ - .mask = ZAP_CLUSTER_MASK(SERVER), \ - .functions = NULL, \ + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ + .functions = chipFuncArrayModeSelectServer, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 40 ) ,\ .generatedCommandList = nullptr ,\ },\ diff --git a/zzz_generated/placeholder/app2/zap-generated/endpoint_config.h b/zzz_generated/placeholder/app2/zap-generated/endpoint_config.h index cc7101d2393a9c..f828fa6405832b 100644 --- a/zzz_generated/placeholder/app2/zap-generated/endpoint_config.h +++ b/zzz_generated/placeholder/app2/zap-generated/endpoint_config.h @@ -375,9 +375,10 @@ ZAP_EMPTY_DEFAULT() }, /* StandardNamespace */ \ { 0x00000002, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* SupportedModes */ \ { 0x00000003, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* CurrentMode */ \ - { 0x00000004, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* StartUpMode */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(40) }, /* FeatureMap */ \ - { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + { 0x00000004, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* StartUpMode */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(40) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Window Covering (server) */ \ { 0x00000000, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* Type */ \ @@ -616,6 +617,10 @@ const EmberAfGenericClusterFunction chipFuncArrayBasicServer[] = { \ (EmberAfGenericClusterFunction) emberAfBasicClusterServerInitCallback, \ }; \ + const EmberAfGenericClusterFunction chipFuncArrayModeSelectServer[] = { \ + (EmberAfGenericClusterFunction) emberAfModeSelectClusterServerInitCallback, \ + (EmberAfGenericClusterFunction) MatterModeSelectClusterServerPreAttributeChangedCallback, \ + }; \ const EmberAfGenericClusterFunction chipFuncArrayWindowCoveringServer[] = { \ (EmberAfGenericClusterFunction) MatterWindowCoveringClusterServerAttributeChangedCallback, \ }; \ @@ -963,8 +968,8 @@ .attributes = ZAP_ATTRIBUTE_INDEX(68), \ .attributeCount = 7, \ .clusterSize = 41, \ - .mask = ZAP_CLUSTER_MASK(SERVER), \ - .functions = NULL, \ + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ + .functions = chipFuncArrayModeSelectServer, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 40 ) ,\ .generatedCommandList = nullptr ,\ },\