[ICD] Remove user active mode trigger attributes for the external list (#30980)
* remove user active trigger attributes for the external list
* Add tests to validate attributes
* generated files
* Fix attribute storage options
* generated files
* update .matter
diff --git a/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.matter b/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.matter
index 9b57051..ce33f98 100644
--- a/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.matter
+++ b/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.matter
@@ -1740,8 +1740,8 @@
callback attribute registeredClients;
callback attribute ICDCounter;
callback attribute clientsSupportedPerFabric;
- callback attribute userActiveModeTriggerHint;
- callback attribute userActiveModeTriggerInstruction;
+ ram attribute userActiveModeTriggerHint default = 0x110D;
+ ram attribute userActiveModeTriggerInstruction default = "Restart the application";
callback attribute generatedCommandList;
callback attribute acceptedCommandList;
callback attribute eventList;
diff --git a/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.zap b/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.zap
index 52301cf..294429a 100644
--- a/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.zap
+++ b/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.zap
@@ -3494,10 +3494,10 @@
"side": "server",
"type": "UserActiveModeTriggerBitmap",
"included": 1,
- "storageOption": "External",
+ "storageOption": "RAM",
"singleton": 0,
"bounded": 0,
- "defaultValue": null,
+ "defaultValue": "0x110D",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
@@ -3510,10 +3510,10 @@
"side": "server",
"type": "char_string",
"included": 1,
- "storageOption": "External",
+ "storageOption": "RAM",
"singleton": 0,
"bounded": 0,
- "defaultValue": null,
+ "defaultValue": "Restart the application",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
diff --git a/src/app/tests/suites/TestIcdManagementCluster.yaml b/src/app/tests/suites/TestIcdManagementCluster.yaml
index 4f4cbf0..eb611f2 100644
--- a/src/app/tests/suites/TestIcdManagementCluster.yaml
+++ b/src/app/tests/suites/TestIcdManagementCluster.yaml
@@ -69,6 +69,23 @@
minValue: 0x0
maxValue: 0xFFFFFFFF
+ - label: "Read UserActiveModeTriggerHint"
+ command: "readAttribute"
+ attribute: "UserActiveModeTriggerHint"
+ response:
+ constraints:
+ type: bitmap32
+ value: 0x110D
+
+ - label: "Read UserActiveModeTriggerInstruction"
+ command: "readAttribute"
+ attribute: "UserActiveModeTriggerInstruction"
+ response:
+ constraints:
+ type: char_string
+ minLength: 1
+ maxLength: 128
+
- label: "Read ClientsSupportedPerFabric"
command: "readAttribute"
attribute: "ClientsSupportedPerFabric"
diff --git a/src/app/zap-templates/zcl/zcl-with-test-extensions.json b/src/app/zap-templates/zcl/zcl-with-test-extensions.json
index 1bab6d7..54c13da 100644
--- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json
+++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json
@@ -217,9 +217,7 @@
"ActiveModeThreshold",
"RegisteredClients",
"ICDCounter",
- "ClientsSupportedPerFabric",
- "UserActiveModeTriggerHint",
- "UserActiveModeTriggerInstruction"
+ "ClientsSupportedPerFabric"
],
"Operational Credentials": [
"SupportedFabrics",
diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json
index 257222d..1e1e06e 100644
--- a/src/app/zap-templates/zcl/zcl.json
+++ b/src/app/zap-templates/zcl/zcl.json
@@ -215,9 +215,7 @@
"ActiveModeThreshold",
"RegisteredClients",
"ICDCounter",
- "ClientsSupportedPerFabric",
- "UserActiveModeTriggerHint",
- "UserActiveModeTriggerInstruction"
+ "ClientsSupportedPerFabric"
],
"Operational Credentials": [
"SupportedFabrics",
diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp
index 66f3ff6..c418c95 100644
--- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp
+++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp
@@ -6570,6 +6570,68 @@
namespace IcdManagement {
namespace Attributes {
+namespace UserActiveModeTriggerHint {
+
+EmberAfStatus Get(chip::EndpointId endpoint, chip::BitMask<chip::app::Clusters::IcdManagement::UserActiveModeTriggerBitmap> * value)
+{
+ using Traits = NumericAttributeTraits<chip::BitMask<chip::app::Clusters::IcdManagement::UserActiveModeTriggerBitmap>>;
+ Traits::StorageType temp;
+ uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp);
+ EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::IcdManagement::Id, Id, readable, sizeof(temp));
+ VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status);
+ if (!Traits::CanRepresentValue(/* isNullable = */ false, temp))
+ {
+ return EMBER_ZCL_STATUS_CONSTRAINT_ERROR;
+ }
+ *value = Traits::StorageToWorking(temp);
+ return status;
+}
+EmberAfStatus Set(chip::EndpointId endpoint, chip::BitMask<chip::app::Clusters::IcdManagement::UserActiveModeTriggerBitmap> value)
+{
+ using Traits = NumericAttributeTraits<chip::BitMask<chip::app::Clusters::IcdManagement::UserActiveModeTriggerBitmap>>;
+ if (!Traits::CanRepresentValue(/* isNullable = */ false, value))
+ {
+ return EMBER_ZCL_STATUS_CONSTRAINT_ERROR;
+ }
+ Traits::StorageType storageValue;
+ Traits::WorkingToStorage(value, storageValue);
+ uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue);
+ return emberAfWriteAttribute(endpoint, Clusters::IcdManagement::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE);
+}
+
+} // namespace UserActiveModeTriggerHint
+
+namespace UserActiveModeTriggerInstruction {
+
+EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan & value)
+{
+ uint8_t zclString[128 + 1];
+ EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::IcdManagement::Id, Id, zclString, sizeof(zclString));
+ VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status);
+ size_t length = emberAfStringLength(zclString);
+ if (length == NumericAttributeTraits<uint8_t>::kNullValue)
+ {
+ return EMBER_ZCL_STATUS_CONSTRAINT_ERROR;
+ }
+
+ VerifyOrReturnError(value.size() == 128, EMBER_ZCL_STATUS_INVALID_DATA_TYPE);
+ memcpy(value.data(), &zclString[1], 128);
+ value.reduce_size(length);
+ return status;
+}
+EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value)
+{
+ static_assert(128 < NumericAttributeTraits<uint8_t>::kNullValue, "value.size() might be too big");
+ VerifyOrReturnError(value.size() <= 128, EMBER_ZCL_STATUS_CONSTRAINT_ERROR);
+ uint8_t zclString[128 + 1];
+ auto length = static_cast<uint8_t>(value.size());
+ Encoding::Put8(zclString, length);
+ memcpy(&zclString[1], value.data(), value.size());
+ return emberAfWriteAttribute(endpoint, Clusters::IcdManagement::Id, Id, zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE);
+}
+
+} // namespace UserActiveModeTriggerInstruction
+
namespace FeatureMap {
EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value)
diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h
index 4222d40..70f2457 100644
--- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h
+++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h
@@ -1274,6 +1274,18 @@
namespace IcdManagement {
namespace Attributes {
+namespace UserActiveModeTriggerHint {
+EmberAfStatus
+Get(chip::EndpointId endpoint,
+ chip::BitMask<chip::app::Clusters::IcdManagement::UserActiveModeTriggerBitmap> * value); // UserActiveModeTriggerBitmap
+EmberAfStatus Set(chip::EndpointId endpoint, chip::BitMask<chip::app::Clusters::IcdManagement::UserActiveModeTriggerBitmap> value);
+} // namespace UserActiveModeTriggerHint
+
+namespace UserActiveModeTriggerInstruction {
+EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan & value); // char_string
+EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value);
+} // namespace UserActiveModeTriggerInstruction
+
namespace FeatureMap {
EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32
EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value);