diff --git a/src/controller/java/zap-generated/CHIPClusters-JNI.cpp b/src/controller/java/zap-generated/CHIPClusters-JNI.cpp index 5dbb9c9e44eff1..f69846bf99b267 100644 --- a/src/controller/java/zap-generated/CHIPClusters-JNI.cpp +++ b/src/controller/java/zap-generated/CHIPClusters-JNI.cpp @@ -300,7 +300,6 @@ class CHIPBooleanAttributeCallback : public Callback::Callback { public: @@ -358,7 +357,6 @@ class CHIPCharStringAttributeCallback : public Callback::Callback { public: @@ -413,7 +411,6 @@ class CHIPInt8sAttributeCallback : public Callback::Callback { public: @@ -468,7 +465,6 @@ class CHIPInt8uAttributeCallback : public Callback::Callback { public: @@ -523,7 +519,6 @@ class CHIPInt16sAttributeCallback : public Callback::Callback { public: @@ -578,7 +573,6 @@ class CHIPInt16uAttributeCallback : public Callback::Callback { public: @@ -633,7 +627,6 @@ class CHIPInt32sAttributeCallback : public Callback::Callback { public: @@ -688,7 +681,6 @@ class CHIPInt32uAttributeCallback : public Callback::Callback { public: @@ -743,7 +735,6 @@ class CHIPInt64sAttributeCallback : public Callback::Callback { public: @@ -798,7 +789,6 @@ class CHIPInt64uAttributeCallback : public Callback::Callback { public: @@ -859,6 +849,7 @@ class CHIPOctetStringAttributeCallback : public Callback::Callback { @@ -7875,7 +7866,6 @@ JNI_METHOD(void, AccountLoginCluster, login) env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, AccountLoginCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -8065,7 +8055,6 @@ JNI_METHOD(void, AdministratorCommissioningCluster, revokeCommissioning) env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, AdministratorCommissioningCluster, readClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -8157,7 +8146,6 @@ JNI_METHOD(void, ApplicationBasicCluster, changeStatus)(JNIEnv * env, jobject se env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, ApplicationBasicCluster, readVendorNameAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -8194,7 +8182,6 @@ JNI_METHOD(void, ApplicationBasicCluster, readVendorNameAttribute)(JNIEnv * env, ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ApplicationBasicCluster, readVendorIdAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -8231,7 +8218,6 @@ JNI_METHOD(void, ApplicationBasicCluster, readVendorIdAttribute)(JNIEnv * env, j ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ApplicationBasicCluster, readApplicationNameAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -8269,7 +8255,6 @@ JNI_METHOD(void, ApplicationBasicCluster, readApplicationNameAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ApplicationBasicCluster, readProductIdAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -8306,7 +8291,6 @@ JNI_METHOD(void, ApplicationBasicCluster, readProductIdAttribute)(JNIEnv * env, ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ApplicationBasicCluster, readApplicationIdAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -8344,7 +8328,6 @@ JNI_METHOD(void, ApplicationBasicCluster, readApplicationIdAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ApplicationBasicCluster, readCatalogVendorIdAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -8382,7 +8365,6 @@ JNI_METHOD(void, ApplicationBasicCluster, readCatalogVendorIdAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ApplicationBasicCluster, readApplicationStatusAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -8420,7 +8402,6 @@ JNI_METHOD(void, ApplicationBasicCluster, readApplicationStatusAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ApplicationBasicCluster, readClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -8517,7 +8498,6 @@ JNI_METHOD(void, ApplicationLauncherCluster, launchApp) env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, ApplicationLauncherCluster, readApplicationLauncherListAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -8556,7 +8536,6 @@ JNI_METHOD(void, ApplicationLauncherCluster, readApplicationLauncherListAttribut ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ApplicationLauncherCluster, readCatalogVendorIdAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -8594,7 +8573,6 @@ JNI_METHOD(void, ApplicationLauncherCluster, readCatalogVendorIdAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ApplicationLauncherCluster, readApplicationIdAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -8632,7 +8610,6 @@ JNI_METHOD(void, ApplicationLauncherCluster, readApplicationIdAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ApplicationLauncherCluster, readClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -8772,7 +8749,6 @@ JNI_METHOD(void, AudioOutputCluster, selectOutput)(JNIEnv * env, jobject self, j env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, AudioOutputCluster, readAudioOutputListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -8809,7 +8785,6 @@ JNI_METHOD(void, AudioOutputCluster, readAudioOutputListAttribute)(JNIEnv * env, ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, AudioOutputCluster, readCurrentAudioOutputAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -8847,7 +8822,6 @@ JNI_METHOD(void, AudioOutputCluster, readCurrentAudioOutputAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, AudioOutputCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -8984,7 +8958,6 @@ JNI_METHOD(void, BarrierControlCluster, barrierControlStop)(JNIEnv * env, jobjec env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, BarrierControlCluster, readBarrierMovingStateAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -9022,7 +8995,6 @@ JNI_METHOD(void, BarrierControlCluster, readBarrierMovingStateAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BarrierControlCluster, readBarrierSafetyStatusAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -9060,7 +9032,6 @@ JNI_METHOD(void, BarrierControlCluster, readBarrierSafetyStatusAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BarrierControlCluster, readBarrierCapabilitiesAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -9098,7 +9069,6 @@ JNI_METHOD(void, BarrierControlCluster, readBarrierCapabilitiesAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BarrierControlCluster, readBarrierPositionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -9136,7 +9106,6 @@ JNI_METHOD(void, BarrierControlCluster, readBarrierPositionAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BarrierControlCluster, readClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -9228,7 +9197,6 @@ JNI_METHOD(void, BasicCluster, mfgSpecificPing)(JNIEnv * env, jobject self, jlon env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, BasicCluster, readInteractionModelVersionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -9265,7 +9233,6 @@ JNI_METHOD(void, BasicCluster, readInteractionModelVersionAttribute)(JNIEnv * en ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BasicCluster, readVendorNameAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -9302,7 +9269,6 @@ JNI_METHOD(void, BasicCluster, readVendorNameAttribute)(JNIEnv * env, jobject se ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BasicCluster, readVendorIDAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -9339,7 +9305,6 @@ JNI_METHOD(void, BasicCluster, readVendorIDAttribute)(JNIEnv * env, jobject self ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BasicCluster, readProductNameAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -9376,7 +9341,6 @@ JNI_METHOD(void, BasicCluster, readProductNameAttribute)(JNIEnv * env, jobject s ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BasicCluster, readProductIDAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -9413,7 +9377,6 @@ JNI_METHOD(void, BasicCluster, readProductIDAttribute)(JNIEnv * env, jobject sel ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BasicCluster, readUserLabelAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -9490,7 +9453,6 @@ JNI_METHOD(void, BasicCluster, writeUserLabelAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, BasicCluster, readLocationAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -9567,7 +9529,6 @@ JNI_METHOD(void, BasicCluster, writeLocationAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, BasicCluster, readHardwareVersionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -9604,7 +9565,6 @@ JNI_METHOD(void, BasicCluster, readHardwareVersionAttribute)(JNIEnv * env, jobje ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BasicCluster, readHardwareVersionStringAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -9641,7 +9601,6 @@ JNI_METHOD(void, BasicCluster, readHardwareVersionStringAttribute)(JNIEnv * env, ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BasicCluster, readSoftwareVersionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -9678,7 +9637,6 @@ JNI_METHOD(void, BasicCluster, readSoftwareVersionAttribute)(JNIEnv * env, jobje ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BasicCluster, readSoftwareVersionStringAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -9715,7 +9673,6 @@ JNI_METHOD(void, BasicCluster, readSoftwareVersionStringAttribute)(JNIEnv * env, ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BasicCluster, readManufacturingDateAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -9752,7 +9709,6 @@ JNI_METHOD(void, BasicCluster, readManufacturingDateAttribute)(JNIEnv * env, job ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BasicCluster, readPartNumberAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -9789,7 +9745,6 @@ JNI_METHOD(void, BasicCluster, readPartNumberAttribute)(JNIEnv * env, jobject se ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BasicCluster, readProductURLAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -9826,7 +9781,6 @@ JNI_METHOD(void, BasicCluster, readProductURLAttribute)(JNIEnv * env, jobject se ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BasicCluster, readProductLabelAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -9863,7 +9817,6 @@ JNI_METHOD(void, BasicCluster, readProductLabelAttribute)(JNIEnv * env, jobject ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BasicCluster, readSerialNumberAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -9900,7 +9853,6 @@ JNI_METHOD(void, BasicCluster, readSerialNumberAttribute)(JNIEnv * env, jobject ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BasicCluster, readLocalConfigDisabledAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -9975,7 +9927,6 @@ JNI_METHOD(void, BasicCluster, writeLocalConfigDisabledAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, BasicCluster, readReachableAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -10012,7 +9963,6 @@ JNI_METHOD(void, BasicCluster, readReachableAttribute)(JNIEnv * env, jobject sel ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BasicCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -10132,7 +10082,6 @@ JNI_METHOD(void, BinaryInputBasicCluster, writeOutOfServiceAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, BinaryInputBasicCluster, readPresentValueAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -10207,7 +10156,6 @@ JNI_METHOD(void, BinaryInputBasicCluster, writePresentValueAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, BinaryInputBasicCluster, readStatusFlagsAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -10244,7 +10192,6 @@ JNI_METHOD(void, BinaryInputBasicCluster, readStatusFlagsAttribute)(JNIEnv * env ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BinaryInputBasicCluster, readClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -10383,7 +10330,6 @@ JNI_METHOD(void, BindingCluster, unbind) env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, BindingCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -10465,7 +10411,6 @@ JNI_METHOD(void, BridgedDeviceBasicCluster, readVendorNameAttribute)(JNIEnv * en ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BridgedDeviceBasicCluster, readVendorIDAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -10502,7 +10447,6 @@ JNI_METHOD(void, BridgedDeviceBasicCluster, readVendorIDAttribute)(JNIEnv * env, ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BridgedDeviceBasicCluster, readProductNameAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -10540,7 +10484,6 @@ JNI_METHOD(void, BridgedDeviceBasicCluster, readProductNameAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BridgedDeviceBasicCluster, readUserLabelAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -10617,7 +10560,6 @@ JNI_METHOD(void, BridgedDeviceBasicCluster, writeUserLabelAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, BridgedDeviceBasicCluster, readHardwareVersionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -10655,7 +10597,6 @@ JNI_METHOD(void, BridgedDeviceBasicCluster, readHardwareVersionAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BridgedDeviceBasicCluster, readHardwareVersionStringAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -10693,7 +10634,6 @@ JNI_METHOD(void, BridgedDeviceBasicCluster, readHardwareVersionStringAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BridgedDeviceBasicCluster, readSoftwareVersionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -10731,7 +10671,6 @@ JNI_METHOD(void, BridgedDeviceBasicCluster, readSoftwareVersionAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BridgedDeviceBasicCluster, readSoftwareVersionStringAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -10769,7 +10708,6 @@ JNI_METHOD(void, BridgedDeviceBasicCluster, readSoftwareVersionStringAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BridgedDeviceBasicCluster, readManufacturingDateAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -10807,7 +10745,6 @@ JNI_METHOD(void, BridgedDeviceBasicCluster, readManufacturingDateAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BridgedDeviceBasicCluster, readPartNumberAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -10844,7 +10781,6 @@ JNI_METHOD(void, BridgedDeviceBasicCluster, readPartNumberAttribute)(JNIEnv * en ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BridgedDeviceBasicCluster, readProductURLAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -10881,7 +10817,6 @@ JNI_METHOD(void, BridgedDeviceBasicCluster, readProductURLAttribute)(JNIEnv * en ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BridgedDeviceBasicCluster, readProductLabelAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -10919,7 +10854,6 @@ JNI_METHOD(void, BridgedDeviceBasicCluster, readProductLabelAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BridgedDeviceBasicCluster, readSerialNumberAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -10957,7 +10891,6 @@ JNI_METHOD(void, BridgedDeviceBasicCluster, readSerialNumberAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BridgedDeviceBasicCluster, readReachableAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -10994,7 +10927,6 @@ JNI_METHOD(void, BridgedDeviceBasicCluster, readReachableAttribute)(JNIEnv * env ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, BridgedDeviceBasicCluster, readClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -11943,7 +11875,6 @@ JNI_METHOD(void, ColorControlCluster, stopMoveStep) env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, ColorControlCluster, readCurrentHueAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -11980,7 +11911,6 @@ JNI_METHOD(void, ColorControlCluster, readCurrentHueAttribute)(JNIEnv * env, job ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readCurrentSaturationAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -12018,7 +11948,6 @@ JNI_METHOD(void, ColorControlCluster, readCurrentSaturationAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readRemainingTimeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -12055,7 +11984,6 @@ JNI_METHOD(void, ColorControlCluster, readRemainingTimeAttribute)(JNIEnv * env, ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readCurrentXAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -12092,7 +12020,6 @@ JNI_METHOD(void, ColorControlCluster, readCurrentXAttribute)(JNIEnv * env, jobje ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readCurrentYAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -12129,7 +12056,6 @@ JNI_METHOD(void, ColorControlCluster, readCurrentYAttribute)(JNIEnv * env, jobje ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readDriftCompensationAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -12167,7 +12093,6 @@ JNI_METHOD(void, ColorControlCluster, readDriftCompensationAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readCompensationTextAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -12204,7 +12129,6 @@ JNI_METHOD(void, ColorControlCluster, readCompensationTextAttribute)(JNIEnv * en ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readColorTemperatureAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -12241,7 +12165,6 @@ JNI_METHOD(void, ColorControlCluster, readColorTemperatureAttribute)(JNIEnv * en ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readColorModeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -12278,7 +12201,6 @@ JNI_METHOD(void, ColorControlCluster, readColorModeAttribute)(JNIEnv * env, jobj ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readColorControlOptionsAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -12354,7 +12276,6 @@ JNI_METHOD(void, ColorControlCluster, writeColorControlOptionsAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readNumberOfPrimariesAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -12392,7 +12313,6 @@ JNI_METHOD(void, ColorControlCluster, readNumberOfPrimariesAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readPrimary1XAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -12429,7 +12349,6 @@ JNI_METHOD(void, ColorControlCluster, readPrimary1XAttribute)(JNIEnv * env, jobj ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readPrimary1YAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -12466,7 +12385,6 @@ JNI_METHOD(void, ColorControlCluster, readPrimary1YAttribute)(JNIEnv * env, jobj ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readPrimary1IntensityAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -12504,7 +12422,6 @@ JNI_METHOD(void, ColorControlCluster, readPrimary1IntensityAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readPrimary2XAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -12541,7 +12458,6 @@ JNI_METHOD(void, ColorControlCluster, readPrimary2XAttribute)(JNIEnv * env, jobj ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readPrimary2YAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -12578,7 +12494,6 @@ JNI_METHOD(void, ColorControlCluster, readPrimary2YAttribute)(JNIEnv * env, jobj ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readPrimary2IntensityAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -12616,7 +12531,6 @@ JNI_METHOD(void, ColorControlCluster, readPrimary2IntensityAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readPrimary3XAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -12653,7 +12567,6 @@ JNI_METHOD(void, ColorControlCluster, readPrimary3XAttribute)(JNIEnv * env, jobj ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readPrimary3YAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -12690,7 +12603,6 @@ JNI_METHOD(void, ColorControlCluster, readPrimary3YAttribute)(JNIEnv * env, jobj ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readPrimary3IntensityAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -12728,7 +12640,6 @@ JNI_METHOD(void, ColorControlCluster, readPrimary3IntensityAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readPrimary4XAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -12765,7 +12676,6 @@ JNI_METHOD(void, ColorControlCluster, readPrimary4XAttribute)(JNIEnv * env, jobj ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readPrimary4YAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -12802,7 +12712,6 @@ JNI_METHOD(void, ColorControlCluster, readPrimary4YAttribute)(JNIEnv * env, jobj ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readPrimary4IntensityAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -12840,7 +12749,6 @@ JNI_METHOD(void, ColorControlCluster, readPrimary4IntensityAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readPrimary5XAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -12877,7 +12785,6 @@ JNI_METHOD(void, ColorControlCluster, readPrimary5XAttribute)(JNIEnv * env, jobj ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readPrimary5YAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -12914,7 +12821,6 @@ JNI_METHOD(void, ColorControlCluster, readPrimary5YAttribute)(JNIEnv * env, jobj ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readPrimary5IntensityAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -12952,7 +12858,6 @@ JNI_METHOD(void, ColorControlCluster, readPrimary5IntensityAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readPrimary6XAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -12989,7 +12894,6 @@ JNI_METHOD(void, ColorControlCluster, readPrimary6XAttribute)(JNIEnv * env, jobj ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readPrimary6YAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -13026,7 +12930,6 @@ JNI_METHOD(void, ColorControlCluster, readPrimary6YAttribute)(JNIEnv * env, jobj ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readPrimary6IntensityAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -13064,7 +12967,6 @@ JNI_METHOD(void, ColorControlCluster, readPrimary6IntensityAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readWhitePointXAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -13139,7 +13041,6 @@ JNI_METHOD(void, ColorControlCluster, writeWhitePointXAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readWhitePointYAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -13214,7 +13115,6 @@ JNI_METHOD(void, ColorControlCluster, writeWhitePointYAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readColorPointRXAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -13289,7 +13189,6 @@ JNI_METHOD(void, ColorControlCluster, writeColorPointRXAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readColorPointRYAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -13364,7 +13263,6 @@ JNI_METHOD(void, ColorControlCluster, writeColorPointRYAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readColorPointRIntensityAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -13440,7 +13338,6 @@ JNI_METHOD(void, ColorControlCluster, writeColorPointRIntensityAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readColorPointGXAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -13515,7 +13412,6 @@ JNI_METHOD(void, ColorControlCluster, writeColorPointGXAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readColorPointGYAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -13590,7 +13486,6 @@ JNI_METHOD(void, ColorControlCluster, writeColorPointGYAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readColorPointGIntensityAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -13666,7 +13561,6 @@ JNI_METHOD(void, ColorControlCluster, writeColorPointGIntensityAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readColorPointBXAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -13741,7 +13635,6 @@ JNI_METHOD(void, ColorControlCluster, writeColorPointBXAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readColorPointBYAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -13816,7 +13709,6 @@ JNI_METHOD(void, ColorControlCluster, writeColorPointBYAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readColorPointBIntensityAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -13892,7 +13784,6 @@ JNI_METHOD(void, ColorControlCluster, writeColorPointBIntensityAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readEnhancedCurrentHueAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -13930,7 +13821,6 @@ JNI_METHOD(void, ColorControlCluster, readEnhancedCurrentHueAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readEnhancedColorModeAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -13968,7 +13858,6 @@ JNI_METHOD(void, ColorControlCluster, readEnhancedColorModeAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readColorLoopActiveAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -14005,7 +13894,6 @@ JNI_METHOD(void, ColorControlCluster, readColorLoopActiveAttribute)(JNIEnv * env ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readColorLoopDirectionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -14043,7 +13931,6 @@ JNI_METHOD(void, ColorControlCluster, readColorLoopDirectionAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readColorLoopTimeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -14080,7 +13967,6 @@ JNI_METHOD(void, ColorControlCluster, readColorLoopTimeAttribute)(JNIEnv * env, ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readColorLoopStartEnhancedHueAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -14118,7 +14004,6 @@ JNI_METHOD(void, ColorControlCluster, readColorLoopStartEnhancedHueAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readColorLoopStoredEnhancedHueAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -14156,7 +14041,6 @@ JNI_METHOD(void, ColorControlCluster, readColorLoopStoredEnhancedHueAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readColorCapabilitiesAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -14194,7 +14078,6 @@ JNI_METHOD(void, ColorControlCluster, readColorCapabilitiesAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readColorTempPhysicalMinAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -14232,7 +14115,6 @@ JNI_METHOD(void, ColorControlCluster, readColorTempPhysicalMinAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readColorTempPhysicalMaxAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -14270,7 +14152,6 @@ JNI_METHOD(void, ColorControlCluster, readColorTempPhysicalMaxAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readCoupleColorTempToLevelMinMiredsAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -14308,7 +14189,6 @@ JNI_METHOD(void, ColorControlCluster, readCoupleColorTempToLevelMinMiredsAttribu ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readStartUpColorTemperatureMiredsAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -14385,7 +14265,6 @@ JNI_METHOD(void, ColorControlCluster, writeStartUpColorTemperatureMiredsAttribut ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, ColorControlCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -14529,7 +14408,6 @@ JNI_METHOD(void, ContentLauncherCluster, launchURL) env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, ContentLauncherCluster, readAcceptsHeaderListAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -14568,7 +14446,6 @@ JNI_METHOD(void, ContentLauncherCluster, readAcceptsHeaderListAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ContentLauncherCluster, readSupportedStreamingTypesAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -14607,7 +14484,6 @@ JNI_METHOD(void, ContentLauncherCluster, readSupportedStreamingTypesAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ContentLauncherCluster, readClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -14690,7 +14566,6 @@ JNI_METHOD(void, DescriptorCluster, readDeviceListAttribute)(JNIEnv * env, jobje ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, DescriptorCluster, readServerListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -14727,7 +14602,6 @@ JNI_METHOD(void, DescriptorCluster, readServerListAttribute)(JNIEnv * env, jobje ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, DescriptorCluster, readClientListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -14764,7 +14638,6 @@ JNI_METHOD(void, DescriptorCluster, readClientListAttribute)(JNIEnv * env, jobje ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, DescriptorCluster, readPartsListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -14801,7 +14674,6 @@ JNI_METHOD(void, DescriptorCluster, readPartsListAttribute)(JNIEnv * env, jobjec ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, DescriptorCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -15970,7 +15842,6 @@ JNI_METHOD(void, DoorLockCluster, unlockWithTimeout) env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, DoorLockCluster, readLockStateAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -16007,7 +15878,6 @@ JNI_METHOD(void, DoorLockCluster, readLockStateAttribute)(JNIEnv * env, jobject ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, DoorLockCluster, readLockTypeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -16044,7 +15914,6 @@ JNI_METHOD(void, DoorLockCluster, readLockTypeAttribute)(JNIEnv * env, jobject s ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, DoorLockCluster, readActuatorEnabledAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -16081,7 +15950,6 @@ JNI_METHOD(void, DoorLockCluster, readActuatorEnabledAttribute)(JNIEnv * env, jo ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, DoorLockCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -16164,7 +16032,6 @@ JNI_METHOD(void, ElectricalMeasurementCluster, readMeasurementTypeAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ElectricalMeasurementCluster, readTotalActivePowerAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -16202,7 +16069,6 @@ JNI_METHOD(void, ElectricalMeasurementCluster, readTotalActivePowerAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ElectricalMeasurementCluster, readRmsVoltageAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -16240,7 +16106,6 @@ JNI_METHOD(void, ElectricalMeasurementCluster, readRmsVoltageAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ElectricalMeasurementCluster, readRmsVoltageMinAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -16278,7 +16143,6 @@ JNI_METHOD(void, ElectricalMeasurementCluster, readRmsVoltageMinAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ElectricalMeasurementCluster, readRmsVoltageMaxAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -16316,7 +16180,6 @@ JNI_METHOD(void, ElectricalMeasurementCluster, readRmsVoltageMaxAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ElectricalMeasurementCluster, readRmsCurrentAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -16354,7 +16217,6 @@ JNI_METHOD(void, ElectricalMeasurementCluster, readRmsCurrentAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ElectricalMeasurementCluster, readRmsCurrentMinAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -16392,7 +16254,6 @@ JNI_METHOD(void, ElectricalMeasurementCluster, readRmsCurrentMinAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ElectricalMeasurementCluster, readRmsCurrentMaxAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -16430,7 +16291,6 @@ JNI_METHOD(void, ElectricalMeasurementCluster, readRmsCurrentMaxAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ElectricalMeasurementCluster, readActivePowerAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -16468,7 +16328,6 @@ JNI_METHOD(void, ElectricalMeasurementCluster, readActivePowerAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ElectricalMeasurementCluster, readActivePowerMinAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -16506,7 +16365,6 @@ JNI_METHOD(void, ElectricalMeasurementCluster, readActivePowerMinAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ElectricalMeasurementCluster, readActivePowerMaxAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -16544,7 +16402,6 @@ JNI_METHOD(void, ElectricalMeasurementCluster, readActivePowerMaxAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ElectricalMeasurementCluster, readClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -16636,7 +16493,6 @@ JNI_METHOD(void, EthernetNetworkDiagnosticsCluster, resetCounts)(JNIEnv * env, j env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, EthernetNetworkDiagnosticsCluster, readPacketRxCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -16674,7 +16530,6 @@ JNI_METHOD(void, EthernetNetworkDiagnosticsCluster, readPacketRxCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, EthernetNetworkDiagnosticsCluster, readPacketTxCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -16712,7 +16567,6 @@ JNI_METHOD(void, EthernetNetworkDiagnosticsCluster, readPacketTxCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, EthernetNetworkDiagnosticsCluster, readTxErrCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -16750,7 +16604,6 @@ JNI_METHOD(void, EthernetNetworkDiagnosticsCluster, readTxErrCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, EthernetNetworkDiagnosticsCluster, readCollisionCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -16788,7 +16641,6 @@ JNI_METHOD(void, EthernetNetworkDiagnosticsCluster, readCollisionCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, EthernetNetworkDiagnosticsCluster, readOverrunCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -16826,7 +16678,6 @@ JNI_METHOD(void, EthernetNetworkDiagnosticsCluster, readOverrunCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, EthernetNetworkDiagnosticsCluster, readClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -16909,7 +16760,6 @@ JNI_METHOD(void, FixedLabelCluster, readLabelListAttribute)(JNIEnv * env, jobjec ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, FixedLabelCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -16991,7 +16841,6 @@ JNI_METHOD(void, FlowMeasurementCluster, readMeasuredValueAttribute)(JNIEnv * en ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, FlowMeasurementCluster, readMinMeasuredValueAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -17029,7 +16878,6 @@ JNI_METHOD(void, FlowMeasurementCluster, readMinMeasuredValueAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, FlowMeasurementCluster, readMaxMeasuredValueAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -17067,7 +16915,6 @@ JNI_METHOD(void, FlowMeasurementCluster, readMaxMeasuredValueAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, FlowMeasurementCluster, readClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -17255,7 +17102,6 @@ JNI_METHOD(void, GeneralCommissioningCluster, setRegulatoryConfig) env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, GeneralCommissioningCluster, readBreadcrumbAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -17331,7 +17177,6 @@ JNI_METHOD(void, GeneralCommissioningCluster, writeBreadcrumbAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, GeneralCommissioningCluster, readBasicCommissioningInfoListAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -17370,7 +17215,6 @@ JNI_METHOD(void, GeneralCommissioningCluster, readBasicCommissioningInfoListAttr ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, GeneralCommissioningCluster, readClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -17455,7 +17299,6 @@ JNI_METHOD(void, GeneralDiagnosticsCluster, readNetworkInterfacesAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, GeneralDiagnosticsCluster, readRebootCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -17493,7 +17336,6 @@ JNI_METHOD(void, GeneralDiagnosticsCluster, readRebootCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, GeneralDiagnosticsCluster, readClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -17576,7 +17418,6 @@ JNI_METHOD(void, GroupKeyManagementCluster, readGroupsAttribute)(JNIEnv * env, j ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, GroupKeyManagementCluster, readGroupKeysAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -17613,7 +17454,6 @@ JNI_METHOD(void, GroupKeyManagementCluster, readGroupKeysAttribute)(JNIEnv * env ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, GroupKeyManagementCluster, readClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -17937,7 +17777,6 @@ JNI_METHOD(void, GroupsCluster, viewGroup)(JNIEnv * env, jobject self, jlong clu env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, GroupsCluster, readNameSupportAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -17974,7 +17813,6 @@ JNI_METHOD(void, GroupsCluster, readNameSupportAttribute)(JNIEnv * env, jobject ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, GroupsCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -18110,7 +17948,6 @@ JNI_METHOD(void, IdentifyCluster, identifyQuery)(JNIEnv * env, jobject self, jlo env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, IdentifyCluster, readIdentifyTimeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -18185,7 +18022,6 @@ JNI_METHOD(void, IdentifyCluster, writeIdentifyTimeAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, IdentifyCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -18276,7 +18112,6 @@ JNI_METHOD(void, KeypadInputCluster, sendKey)(JNIEnv * env, jobject self, jlong env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, KeypadInputCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -18692,7 +18527,6 @@ JNI_METHOD(void, LevelControlCluster, stopWithOnOff)(JNIEnv * env, jobject self, env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, LevelControlCluster, readCurrentLevelAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -18729,7 +18563,6 @@ JNI_METHOD(void, LevelControlCluster, readCurrentLevelAttribute)(JNIEnv * env, j ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, LevelControlCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -18820,7 +18653,6 @@ JNI_METHOD(void, LowPowerCluster, sleep)(JNIEnv * env, jobject self, jlong clust env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, LowPowerCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -19049,7 +18881,6 @@ JNI_METHOD(void, MediaInputCluster, showInputStatus)(JNIEnv * env, jobject self, env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, MediaInputCluster, readMediaInputListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -19086,7 +18917,6 @@ JNI_METHOD(void, MediaInputCluster, readMediaInputListAttribute)(JNIEnv * env, j ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, MediaInputCluster, readCurrentMediaInputAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -19123,7 +18953,6 @@ JNI_METHOD(void, MediaInputCluster, readCurrentMediaInputAttribute)(JNIEnv * env ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, MediaInputCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -19666,7 +19495,6 @@ JNI_METHOD(void, MediaPlaybackCluster, mediaStop)(JNIEnv * env, jobject self, jl env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, MediaPlaybackCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -20153,7 +19981,6 @@ JNI_METHOD(void, NetworkCommissioningCluster, updateWiFiNetwork) env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, NetworkCommissioningCluster, readFeatureMapAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -20191,7 +20018,6 @@ JNI_METHOD(void, NetworkCommissioningCluster, readFeatureMapAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, NetworkCommissioningCluster, readClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -20389,7 +20215,6 @@ JNI_METHOD(void, OtaSoftwareUpdateProviderCluster, queryImage) env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, OtaSoftwareUpdateProviderCluster, readClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -20472,7 +20297,6 @@ JNI_METHOD(void, OccupancySensingCluster, readOccupancyAttribute)(JNIEnv * env, ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, OccupancySensingCluster, readOccupancySensorTypeAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -20510,7 +20334,6 @@ JNI_METHOD(void, OccupancySensingCluster, readOccupancySensorTypeAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, OccupancySensingCluster, readOccupancySensorTypeBitmapAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -20548,7 +20371,6 @@ JNI_METHOD(void, OccupancySensingCluster, readOccupancySensorTypeBitmapAttribute ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, OccupancySensingCluster, readClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -20867,7 +20689,6 @@ JNI_METHOD(void, OnOffCluster, toggle)(JNIEnv * env, jobject self, jlong cluster env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, OnOffCluster, readOnOffAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -20904,7 +20725,6 @@ JNI_METHOD(void, OnOffCluster, readOnOffAttribute)(JNIEnv * env, jobject self, j ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, OnOffCluster, readGlobalSceneControlAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -20941,7 +20761,6 @@ JNI_METHOD(void, OnOffCluster, readGlobalSceneControlAttribute)(JNIEnv * env, jo ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, OnOffCluster, readOnTimeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -21015,7 +20834,6 @@ JNI_METHOD(void, OnOffCluster, writeOnTimeAttribute)(JNIEnv * env, jobject self, ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, OnOffCluster, readOffWaitTimeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -21090,7 +20908,6 @@ JNI_METHOD(void, OnOffCluster, writeOffWaitTimeAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, OnOffCluster, readStartUpOnOffAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -21165,7 +20982,6 @@ JNI_METHOD(void, OnOffCluster, writeStartUpOnOffAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, OnOffCluster, readFeatureMapAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -21202,7 +21018,6 @@ JNI_METHOD(void, OnOffCluster, readFeatureMapAttribute)(JNIEnv * env, jobject se ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, OnOffCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -21285,7 +21100,6 @@ JNI_METHOD(void, OnOffSwitchConfigurationCluster, readSwitchTypeAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, OnOffSwitchConfigurationCluster, readSwitchActionsAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -21361,7 +21175,6 @@ JNI_METHOD(void, OnOffSwitchConfigurationCluster, writeSwitchActionsAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, OnOffSwitchConfigurationCluster, readClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -21747,7 +21560,6 @@ JNI_METHOD(void, OperationalCredentialsCluster, updateNOC) env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, OperationalCredentialsCluster, readFabricsListAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -21786,7 +21598,6 @@ JNI_METHOD(void, OperationalCredentialsCluster, readFabricsListAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, OperationalCredentialsCluster, readSupportedFabricsAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -21824,7 +21635,6 @@ JNI_METHOD(void, OperationalCredentialsCluster, readSupportedFabricsAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, OperationalCredentialsCluster, readCommissionedFabricsAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -21862,7 +21672,6 @@ JNI_METHOD(void, OperationalCredentialsCluster, readCommissionedFabricsAttribute ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, OperationalCredentialsCluster, readClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -21946,7 +21755,6 @@ JNI_METHOD(void, PressureMeasurementCluster, readMeasuredValueAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, PressureMeasurementCluster, readMinMeasuredValueAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -21984,7 +21792,6 @@ JNI_METHOD(void, PressureMeasurementCluster, readMinMeasuredValueAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, PressureMeasurementCluster, readMaxMeasuredValueAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -22022,7 +21829,6 @@ JNI_METHOD(void, PressureMeasurementCluster, readMaxMeasuredValueAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, PressureMeasurementCluster, readClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -22106,7 +21912,6 @@ JNI_METHOD(void, PumpConfigurationAndControlCluster, readMaxPressureAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, PumpConfigurationAndControlCluster, readMaxSpeedAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -22144,7 +21949,6 @@ JNI_METHOD(void, PumpConfigurationAndControlCluster, readMaxSpeedAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, PumpConfigurationAndControlCluster, readMaxFlowAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -22182,7 +21986,6 @@ JNI_METHOD(void, PumpConfigurationAndControlCluster, readMaxFlowAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, PumpConfigurationAndControlCluster, readEffectiveOperationModeAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -22220,7 +22023,6 @@ JNI_METHOD(void, PumpConfigurationAndControlCluster, readEffectiveOperationModeA ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, PumpConfigurationAndControlCluster, readEffectiveControlModeAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -22258,7 +22060,6 @@ JNI_METHOD(void, PumpConfigurationAndControlCluster, readEffectiveControlModeAtt ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, PumpConfigurationAndControlCluster, readCapacityAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -22296,7 +22097,6 @@ JNI_METHOD(void, PumpConfigurationAndControlCluster, readCapacityAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, PumpConfigurationAndControlCluster, readOperationModeAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -22372,7 +22172,6 @@ JNI_METHOD(void, PumpConfigurationAndControlCluster, writeOperationModeAttribute ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, PumpConfigurationAndControlCluster, readClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -22456,7 +22255,6 @@ JNI_METHOD(void, RelativeHumidityMeasurementCluster, readMeasuredValueAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, RelativeHumidityMeasurementCluster, readMinMeasuredValueAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -22494,7 +22292,6 @@ JNI_METHOD(void, RelativeHumidityMeasurementCluster, readMinMeasuredValueAttribu ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, RelativeHumidityMeasurementCluster, readMaxMeasuredValueAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -22532,7 +22329,6 @@ JNI_METHOD(void, RelativeHumidityMeasurementCluster, readMaxMeasuredValueAttribu ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, RelativeHumidityMeasurementCluster, readClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -22902,7 +22698,6 @@ JNI_METHOD(void, ScenesCluster, viewScene) env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, ScenesCluster, readSceneCountAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -22939,7 +22734,6 @@ JNI_METHOD(void, ScenesCluster, readSceneCountAttribute)(JNIEnv * env, jobject s ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ScenesCluster, readCurrentSceneAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -22976,7 +22770,6 @@ JNI_METHOD(void, ScenesCluster, readCurrentSceneAttribute)(JNIEnv * env, jobject ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ScenesCluster, readCurrentGroupAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -23013,7 +22806,6 @@ JNI_METHOD(void, ScenesCluster, readCurrentGroupAttribute)(JNIEnv * env, jobject ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ScenesCluster, readSceneValidAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -23050,7 +22842,6 @@ JNI_METHOD(void, ScenesCluster, readSceneValidAttribute)(JNIEnv * env, jobject s ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ScenesCluster, readNameSupportAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -23087,7 +22878,6 @@ JNI_METHOD(void, ScenesCluster, readNameSupportAttribute)(JNIEnv * env, jobject ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ScenesCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -23178,7 +22968,6 @@ JNI_METHOD(void, SoftwareDiagnosticsCluster, resetWatermarks)(JNIEnv * env, jobj env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, SoftwareDiagnosticsCluster, readCurrentHeapHighWatermarkAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -23216,7 +23005,6 @@ JNI_METHOD(void, SoftwareDiagnosticsCluster, readCurrentHeapHighWatermarkAttribu ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, SoftwareDiagnosticsCluster, readClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -23299,7 +23087,6 @@ JNI_METHOD(void, SwitchCluster, readNumberOfPositionsAttribute)(JNIEnv * env, jo ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, SwitchCluster, readCurrentPositionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -23336,7 +23123,6 @@ JNI_METHOD(void, SwitchCluster, readCurrentPositionAttribute)(JNIEnv * env, jobj ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, SwitchCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -23520,7 +23306,6 @@ JNI_METHOD(void, TvChannelCluster, skipChannel)(JNIEnv * env, jobject self, jlon env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, TvChannelCluster, readTvChannelListAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -23557,7 +23342,6 @@ JNI_METHOD(void, TvChannelCluster, readTvChannelListAttribute)(JNIEnv * env, job ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, TvChannelCluster, readTvChannelLineupAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -23594,7 +23378,6 @@ JNI_METHOD(void, TvChannelCluster, readTvChannelLineupAttribute)(JNIEnv * env, j ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, TvChannelCluster, readCurrentTvChannelAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -23631,7 +23414,6 @@ JNI_METHOD(void, TvChannelCluster, readCurrentTvChannelAttribute)(JNIEnv * env, ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, TvChannelCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -23725,7 +23507,6 @@ JNI_METHOD(void, TargetNavigatorCluster, navigateTarget) env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, TargetNavigatorCluster, readTargetNavigatorListAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -23764,7 +23545,6 @@ JNI_METHOD(void, TargetNavigatorCluster, readTargetNavigatorListAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, TargetNavigatorCluster, readClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -23848,7 +23628,6 @@ JNI_METHOD(void, TemperatureMeasurementCluster, readMeasuredValueAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, TemperatureMeasurementCluster, readMinMeasuredValueAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -23886,7 +23665,6 @@ JNI_METHOD(void, TemperatureMeasurementCluster, readMinMeasuredValueAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, TemperatureMeasurementCluster, readMaxMeasuredValueAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -23924,7 +23702,6 @@ JNI_METHOD(void, TemperatureMeasurementCluster, readMaxMeasuredValueAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, TemperatureMeasurementCluster, readClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -24197,7 +23974,6 @@ JNI_METHOD(void, TestClusterCluster, testUnknownCommand)(JNIEnv * env, jobject s env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, TestClusterCluster, readBooleanAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -24272,7 +24048,6 @@ JNI_METHOD(void, TestClusterCluster, writeBooleanAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, TestClusterCluster, readBitmap8Attribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -24347,7 +24122,6 @@ JNI_METHOD(void, TestClusterCluster, writeBitmap8Attribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, TestClusterCluster, readBitmap16Attribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -24422,7 +24196,6 @@ JNI_METHOD(void, TestClusterCluster, writeBitmap16Attribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, TestClusterCluster, readBitmap32Attribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -24497,7 +24270,6 @@ JNI_METHOD(void, TestClusterCluster, writeBitmap32Attribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, TestClusterCluster, readBitmap64Attribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -24572,7 +24344,6 @@ JNI_METHOD(void, TestClusterCluster, writeBitmap64Attribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, TestClusterCluster, readInt8uAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -24647,7 +24418,6 @@ JNI_METHOD(void, TestClusterCluster, writeInt8uAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, TestClusterCluster, readInt16uAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -24722,7 +24492,6 @@ JNI_METHOD(void, TestClusterCluster, writeInt16uAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, TestClusterCluster, readInt32uAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -24797,7 +24566,6 @@ JNI_METHOD(void, TestClusterCluster, writeInt32uAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, TestClusterCluster, readInt64uAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -24872,7 +24640,6 @@ JNI_METHOD(void, TestClusterCluster, writeInt64uAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, TestClusterCluster, readInt8sAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -24947,7 +24714,6 @@ JNI_METHOD(void, TestClusterCluster, writeInt8sAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, TestClusterCluster, readInt16sAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -25022,7 +24788,6 @@ JNI_METHOD(void, TestClusterCluster, writeInt16sAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, TestClusterCluster, readInt32sAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -25097,7 +24862,6 @@ JNI_METHOD(void, TestClusterCluster, writeInt32sAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, TestClusterCluster, readInt64sAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -25172,7 +24936,6 @@ JNI_METHOD(void, TestClusterCluster, writeInt64sAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, TestClusterCluster, readEnum8Attribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -25247,7 +25010,6 @@ JNI_METHOD(void, TestClusterCluster, writeEnum8Attribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, TestClusterCluster, readEnum16Attribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -25322,7 +25084,6 @@ JNI_METHOD(void, TestClusterCluster, writeEnum16Attribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, TestClusterCluster, readOctetStringAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -25399,7 +25160,6 @@ JNI_METHOD(void, TestClusterCluster, writeOctetStringAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, TestClusterCluster, readListInt8uAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -25436,7 +25196,6 @@ JNI_METHOD(void, TestClusterCluster, readListInt8uAttribute)(JNIEnv * env, jobje ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, TestClusterCluster, readListOctetStringAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -25473,7 +25232,6 @@ JNI_METHOD(void, TestClusterCluster, readListOctetStringAttribute)(JNIEnv * env, ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, TestClusterCluster, readListStructOctetStringAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -25512,7 +25270,6 @@ JNI_METHOD(void, TestClusterCluster, readListStructOctetStringAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, TestClusterCluster, readLongOctetStringAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -25589,7 +25346,6 @@ JNI_METHOD(void, TestClusterCluster, writeLongOctetStringAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, TestClusterCluster, readCharStringAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -25666,7 +25422,6 @@ JNI_METHOD(void, TestClusterCluster, writeCharStringAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, TestClusterCluster, readLongCharStringAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -25743,7 +25498,6 @@ JNI_METHOD(void, TestClusterCluster, writeLongCharStringAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, TestClusterCluster, readUnsupportedAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -25818,7 +25572,6 @@ JNI_METHOD(void, TestClusterCluster, writeUnsupportedAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, TestClusterCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -26094,7 +25847,6 @@ JNI_METHOD(void, ThermostatCluster, setpointRaiseLower) env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, ThermostatCluster, readLocalTemperatureAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -26131,7 +25883,6 @@ JNI_METHOD(void, ThermostatCluster, readLocalTemperatureAttribute)(JNIEnv * env, ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThermostatCluster, readAbsMinHeatSetpointLimitAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -26169,7 +25920,6 @@ JNI_METHOD(void, ThermostatCluster, readAbsMinHeatSetpointLimitAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThermostatCluster, readAbsMaxHeatSetpointLimitAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -26207,7 +25957,6 @@ JNI_METHOD(void, ThermostatCluster, readAbsMaxHeatSetpointLimitAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThermostatCluster, readAbsMinCoolSetpointLimitAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -26245,7 +25994,6 @@ JNI_METHOD(void, ThermostatCluster, readAbsMinCoolSetpointLimitAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThermostatCluster, readAbsMaxCoolSetpointLimitAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -26283,7 +26031,6 @@ JNI_METHOD(void, ThermostatCluster, readAbsMaxCoolSetpointLimitAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThermostatCluster, readOccupiedCoolingSetpointAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -26359,7 +26106,6 @@ JNI_METHOD(void, ThermostatCluster, writeOccupiedCoolingSetpointAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, ThermostatCluster, readOccupiedHeatingSetpointAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -26435,7 +26181,6 @@ JNI_METHOD(void, ThermostatCluster, writeOccupiedHeatingSetpointAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, ThermostatCluster, readMinHeatSetpointLimitAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -26511,7 +26256,6 @@ JNI_METHOD(void, ThermostatCluster, writeMinHeatSetpointLimitAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, ThermostatCluster, readMaxHeatSetpointLimitAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -26587,7 +26331,6 @@ JNI_METHOD(void, ThermostatCluster, writeMaxHeatSetpointLimitAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, ThermostatCluster, readMinCoolSetpointLimitAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -26663,7 +26406,6 @@ JNI_METHOD(void, ThermostatCluster, writeMinCoolSetpointLimitAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, ThermostatCluster, readMaxCoolSetpointLimitAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -26739,7 +26481,6 @@ JNI_METHOD(void, ThermostatCluster, writeMaxCoolSetpointLimitAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, ThermostatCluster, readControlSequenceOfOperationAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -26816,7 +26557,6 @@ JNI_METHOD(void, ThermostatCluster, writeControlSequenceOfOperationAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, ThermostatCluster, readSystemModeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -26891,7 +26631,6 @@ JNI_METHOD(void, ThermostatCluster, writeSystemModeAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, ThermostatCluster, readStartOfWeekAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -26928,7 +26667,6 @@ JNI_METHOD(void, ThermostatCluster, readStartOfWeekAttribute)(JNIEnv * env, jobj ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThermostatCluster, readNumberOfWeeklyTransitionsAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -26966,7 +26704,6 @@ JNI_METHOD(void, ThermostatCluster, readNumberOfWeeklyTransitionsAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThermostatCluster, readNumberOfDailyTransitionsAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -27004,7 +26741,6 @@ JNI_METHOD(void, ThermostatCluster, readNumberOfDailyTransitionsAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThermostatCluster, readFeatureMapAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -27041,7 +26777,6 @@ JNI_METHOD(void, ThermostatCluster, readFeatureMapAttribute)(JNIEnv * env, jobje ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThermostatCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -27165,7 +26900,6 @@ JNI_METHOD(void, ThermostatUserInterfaceConfigurationCluster, writeTemperatureDi ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, ThermostatUserInterfaceConfigurationCluster, readKeypadLockoutAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -27243,7 +26977,6 @@ JNI_METHOD(void, ThermostatUserInterfaceConfigurationCluster, writeKeypadLockout ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, ThermostatUserInterfaceConfigurationCluster, readScheduleProgrammingVisibilityAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -27322,7 +27055,6 @@ JNI_METHOD(void, ThermostatUserInterfaceConfigurationCluster, writeScheduleProgr ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, ThermostatUserInterfaceConfigurationCluster, readClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -27415,7 +27147,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, resetCounts)(JNIEnv * env, job env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readChannelAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -27453,7 +27184,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readChannelAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRoutingRoleAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -27491,7 +27221,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRoutingRoleAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readNetworkNameAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -27529,7 +27258,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readNetworkNameAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readPanIdAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -27567,7 +27295,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readPanIdAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readExtendedPanIdAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -27605,7 +27332,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readExtendedPanIdAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readMeshLocalPrefixAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -27643,7 +27369,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readMeshLocalPrefixAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readOverrunCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -27681,7 +27406,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readOverrunCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readNeighborTableListAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -27720,7 +27444,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readNeighborTableListAttribute ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRouteTableListAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -27759,7 +27482,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRouteTableListAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readPartitionIdAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -27797,7 +27519,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readPartitionIdAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readWeightingAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -27835,7 +27556,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readWeightingAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readDataVersionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -27873,7 +27593,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readDataVersionAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readStableDataVersionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -27911,7 +27630,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readStableDataVersionAttribute ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readLeaderRouterIdAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -27949,7 +27667,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readLeaderRouterIdAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readDetachedRoleCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -27987,7 +27704,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readDetachedRoleCountAttribute ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readChildRoleCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -28025,7 +27741,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readChildRoleCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRouterRoleCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -28063,7 +27778,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRouterRoleCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readLeaderRoleCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -28101,7 +27815,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readLeaderRoleCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readAttachAttemptCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -28139,7 +27852,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readAttachAttemptCountAttribut ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readPartitionIdChangeCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -28177,7 +27889,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readPartitionIdChangeCountAttr ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readBetterPartitionAttachAttemptCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -28215,7 +27926,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readBetterPartitionAttachAttem ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readParentChangeCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -28253,7 +27963,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readParentChangeCountAttribute ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxTotalCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -28291,7 +28000,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxTotalCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxUnicastCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -28329,7 +28037,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxUnicastCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxBroadcastCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -28367,7 +28074,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxBroadcastCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxAckRequestedCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -28405,7 +28111,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxAckRequestedCountAttribu ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxAckedCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -28443,7 +28148,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxAckedCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxNoAckRequestedCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -28481,7 +28185,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxNoAckRequestedCountAttri ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxDataCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -28519,7 +28222,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxDataCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxDataPollCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -28557,7 +28259,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxDataPollCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxBeaconCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -28595,7 +28296,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxBeaconCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxBeaconRequestCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -28633,7 +28333,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxBeaconRequestCountAttrib ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxOtherCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -28671,7 +28370,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxOtherCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxRetryCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -28709,7 +28407,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxRetryCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxDirectMaxRetryExpiryCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -28747,7 +28444,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxDirectMaxRetryExpiryCoun ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxIndirectMaxRetryExpiryCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -28785,7 +28481,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxIndirectMaxRetryExpiryCo ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxErrCcaCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -28823,7 +28518,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxErrCcaCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxErrAbortCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -28861,7 +28555,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxErrAbortCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxErrBusyChannelCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -28899,7 +28592,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readTxErrBusyChannelCountAttri ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxTotalCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -28937,7 +28629,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxTotalCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxUnicastCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -28975,7 +28666,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxUnicastCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxBroadcastCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -29013,7 +28703,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxBroadcastCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxDataCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -29051,7 +28740,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxDataCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxDataPollCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -29089,7 +28777,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxDataPollCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxBeaconCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -29127,7 +28814,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxBeaconCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxBeaconRequestCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -29165,7 +28851,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxBeaconRequestCountAttrib ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxOtherCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -29203,7 +28888,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxOtherCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxAddressFilteredCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -29241,7 +28925,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxAddressFilteredCountAttr ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxDestAddrFilteredCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -29279,7 +28962,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxDestAddrFilteredCountAtt ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxDuplicatedCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -29317,7 +28999,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxDuplicatedCountAttribute ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxErrNoFrameCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -29355,7 +29036,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxErrNoFrameCountAttribute ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxErrUnknownNeighborCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -29393,7 +29073,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxErrUnknownNeighborCountA ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxErrInvalidSrcAddrCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -29431,7 +29110,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxErrInvalidSrcAddrCountAt ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxErrSecCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -29469,7 +29147,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxErrSecCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxErrFcsCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -29507,7 +29184,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxErrFcsCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxErrOtherCountAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -29545,7 +29221,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readRxErrOtherCountAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readSecurityPolicyAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -29584,7 +29259,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readSecurityPolicyAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readChannelMaskAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -29622,7 +29296,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readChannelMaskAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readOperationalDatasetComponentsAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -29661,7 +29334,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readOperationalDatasetComponen ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readActiveNetworkFaultsListAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -29700,7 +29372,6 @@ JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readActiveNetworkFaultsListAtt ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, ThreadNetworkDiagnosticsCluster, readClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -29783,7 +29454,6 @@ JNI_METHOD(void, WakeOnLanCluster, readWakeOnLanMacAddressAttribute)(JNIEnv * en ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, WakeOnLanCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -29874,7 +29544,6 @@ JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, resetCounts)(JNIEnv * env, jobje env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, readBssidAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -29911,7 +29580,6 @@ JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, readBssidAttribute)(JNIEnv * env ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, readSecurityTypeAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -29949,7 +29617,6 @@ JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, readSecurityTypeAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, readWiFiVersionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -29987,7 +29654,6 @@ JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, readWiFiVersionAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, readChannelNumberAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -30025,7 +29691,6 @@ JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, readChannelNumberAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, readRssiAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -30062,7 +29727,6 @@ JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, readRssiAttribute)(JNIEnv * env, ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, WiFiNetworkDiagnosticsCluster, readClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -30428,7 +30092,6 @@ JNI_METHOD(void, WindowCoveringCluster, upOrOpen)(JNIEnv * env, jobject self, jl env->CallVoidMethod(callback, method, exception); } } - JNI_METHOD(void, WindowCoveringCluster, readTypeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -30465,7 +30128,6 @@ JNI_METHOD(void, WindowCoveringCluster, readTypeAttribute)(JNIEnv * env, jobject ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, WindowCoveringCluster, readCurrentPositionLiftAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -30503,7 +30165,6 @@ JNI_METHOD(void, WindowCoveringCluster, readCurrentPositionLiftAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, WindowCoveringCluster, readCurrentPositionTiltAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -30541,7 +30202,6 @@ JNI_METHOD(void, WindowCoveringCluster, readCurrentPositionTiltAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, WindowCoveringCluster, readConfigStatusAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -30578,7 +30238,6 @@ JNI_METHOD(void, WindowCoveringCluster, readConfigStatusAttribute)(JNIEnv * env, ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, WindowCoveringCluster, readCurrentPositionLiftPercentageAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -30616,7 +30275,6 @@ JNI_METHOD(void, WindowCoveringCluster, readCurrentPositionLiftPercentageAttribu ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, WindowCoveringCluster, readCurrentPositionTiltPercentageAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -30654,7 +30312,6 @@ JNI_METHOD(void, WindowCoveringCluster, readCurrentPositionTiltPercentageAttribu ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, WindowCoveringCluster, readOperationalStatusAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -30692,7 +30349,6 @@ JNI_METHOD(void, WindowCoveringCluster, readOperationalStatusAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, WindowCoveringCluster, readTargetPositionLiftPercent100thsAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -30730,7 +30386,6 @@ JNI_METHOD(void, WindowCoveringCluster, readTargetPositionLiftPercent100thsAttri ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, WindowCoveringCluster, readTargetPositionTiltPercent100thsAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -30768,7 +30423,6 @@ JNI_METHOD(void, WindowCoveringCluster, readTargetPositionTiltPercent100thsAttri ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, WindowCoveringCluster, readEndProductTypeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -30805,7 +30459,6 @@ JNI_METHOD(void, WindowCoveringCluster, readEndProductTypeAttribute)(JNIEnv * en ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, WindowCoveringCluster, readCurrentPositionLiftPercent100thsAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -30843,7 +30496,6 @@ JNI_METHOD(void, WindowCoveringCluster, readCurrentPositionLiftPercent100thsAttr ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, WindowCoveringCluster, readCurrentPositionTiltPercent100thsAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -30881,7 +30533,6 @@ JNI_METHOD(void, WindowCoveringCluster, readCurrentPositionTiltPercent100thsAttr ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, WindowCoveringCluster, readInstalledOpenLimitLiftAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -30919,7 +30570,6 @@ JNI_METHOD(void, WindowCoveringCluster, readInstalledOpenLimitLiftAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, WindowCoveringCluster, readInstalledClosedLimitLiftAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -30957,7 +30607,6 @@ JNI_METHOD(void, WindowCoveringCluster, readInstalledClosedLimitLiftAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, WindowCoveringCluster, readInstalledOpenLimitTiltAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -30995,7 +30644,6 @@ JNI_METHOD(void, WindowCoveringCluster, readInstalledOpenLimitTiltAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, WindowCoveringCluster, readInstalledClosedLimitTiltAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -31033,7 +30681,6 @@ JNI_METHOD(void, WindowCoveringCluster, readInstalledClosedLimitTiltAttribute) ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, WindowCoveringCluster, readModeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -31108,7 +30755,6 @@ JNI_METHOD(void, WindowCoveringCluster, writeModeAttribute) ReturnIllegalStateException(env, callback, "Error writing attribute", err.AsInteger()); } } - JNI_METHOD(void, WindowCoveringCluster, readSafetyStatusAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { StackLockGuard lock(JniReferences::GetInstance().GetStackLock()); @@ -31145,7 +30791,6 @@ JNI_METHOD(void, WindowCoveringCluster, readSafetyStatusAttribute)(JNIEnv * env, ReturnIllegalStateException(env, callback, "Error reading attribute", err.AsInteger()); } } - JNI_METHOD(void, WindowCoveringCluster, readClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java index 2939bc7c172b9b..7de20a4a808af3 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java @@ -4770,7 +4770,7 @@ public void readLongCharStringAttribute(CharStringAttributeCallback callback) { public void writeLongCharStringAttribute(DefaultClusterCallback callback, String value) { writeLongCharStringAttribute(chipClusterPtr, callback, value); } - + // TODO: Unsupported type simplestruct public void readUnsupportedAttribute(BooleanAttributeCallback callback) { readUnsupportedAttribute(chipClusterPtr, callback); } @@ -4893,7 +4893,7 @@ private native void readLongCharStringAttribute( private native void writeLongCharStringAttribute( long chipClusterPtr, DefaultClusterCallback callback, String value); - + // TODO: Unsupported type simplestruct private native void readUnsupportedAttribute( long chipClusterPtr, BooleanAttributeCallback callback); diff --git a/src/controller/python/chip/clusters/CHIPClusters.cpp b/src/controller/python/chip/clusters/CHIPClusters.cpp index 49c92376101e76..34109fa0a8f30f 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.cpp +++ b/src/controller/python/chip/clusters/CHIPClusters.cpp @@ -265,6 +265,15 @@ static void OnTestClusterListStructOctetStringListAttributeResponse(void * conte } chip::Callback::Callback gTestClusterListStructOctetStringListAttributeCallback{ OnTestClusterListStructOctetStringListAttributeResponse, nullptr }; +static void OnTestClusterSimpleStructStructAttributeResponse(void * context, _simplestruct value) +{ + ChipLogProgress(chipTool, "%s: TODO: Print struct content.", __FUNCTION__); + if (gSuccessResponseDelegate != nullptr) + gSuccessResponseDelegate(); +} +chip::Callback::Callback gTestClusterSimpleStructAttributeCallback{ + OnTestClusterSimpleStructStructAttributeResponse, nullptr +}; static void OnThreadNetworkDiagnosticsNeighborTableListListAttributeResponse(void * context, uint16_t count, _NeighborTable * entries) { @@ -379,6 +388,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_AccountLogin_ClusterRevision VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::AccountLoginCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -423,6 +433,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_AdministratorCommissioning_C VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::AdministratorCommissioningCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -446,6 +457,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_VendorName( VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ApplicationBasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeVendorName(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -456,6 +468,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_VendorId(ch VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ApplicationBasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeVendorId(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -466,6 +479,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_Application VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ApplicationBasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeApplicationName(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -477,6 +491,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_ProductId(c VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ApplicationBasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeProductId(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -487,6 +502,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_Application VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ApplicationBasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeApplicationId(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -497,6 +513,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_CatalogVend VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ApplicationBasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCatalogVendorId(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -507,6 +524,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_Application VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ApplicationBasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeApplicationStatus(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -517,6 +535,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_ClusterRevi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ApplicationBasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -543,6 +562,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationLauncher_Applicat VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ApplicationLauncherCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster .ReadAttributeApplicationLauncherList(gApplicationLauncherApplicationLauncherListListAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) @@ -556,6 +576,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationLauncher_CatalogV VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ApplicationLauncherCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCatalogVendorId(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -566,6 +587,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationLauncher_Applicat VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ApplicationLauncherCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeApplicationId(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -576,6 +598,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationLauncher_ClusterR VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ApplicationLauncherCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -608,6 +631,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_AudioOutput_AudioOutputList( VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::AudioOutputCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster .ReadAttributeAudioOutputList(gAudioOutputAudioOutputListListAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); @@ -620,6 +644,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_AudioOutput_CurrentAudioOutp VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::AudioOutputCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCurrentAudioOutput(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -630,6 +655,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_AudioOutput_ClusterRevision( VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::AudioOutputCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -661,6 +687,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BarrierControl_BarrierMoving VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BarrierControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeBarrierMovingState(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -671,6 +698,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BarrierControl_BarrierSafety VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BarrierControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeBarrierSafetyStatus(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -682,6 +710,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BarrierControl_BarrierCapabi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BarrierControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeBarrierCapabilities(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -692,6 +721,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BarrierControl_BarrierPositi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BarrierControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeBarrierPosition(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -702,6 +732,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BarrierControl_ClusterRevisi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BarrierControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -724,6 +755,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_InteractionModelVersio VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeInteractionModelVersion(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -734,6 +766,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_VendorName(chip::Contr VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeVendorName(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -743,6 +776,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_VendorID(chip::Control VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeVendorID(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -753,6 +787,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_ProductName(chip::Cont VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeProductName(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -762,6 +797,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_ProductID(chip::Contro VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeProductID(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -771,6 +807,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_UserLabel(chip::Contro VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeUserLabel(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -791,6 +828,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_Location(chip::Control VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeLocation(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -812,6 +850,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_HardwareVersion(chip:: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeHardwareVersion(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -822,6 +861,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_HardwareVersionString( VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeHardwareVersionString(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -833,6 +873,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_SoftwareVersion(chip:: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeSoftwareVersion(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -843,6 +884,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_SoftwareVersionString( VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeSoftwareVersionString(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -854,6 +896,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_ManufacturingDate(chip VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeManufacturingDate(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -864,6 +907,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_PartNumber(chip::Contr VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePartNumber(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -873,6 +917,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_ProductURL(chip::Contr VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeProductURL(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -883,6 +928,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_ProductLabel(chip::Con VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeProductLabel(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -893,6 +939,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_SerialNumber(chip::Con VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeSerialNumber(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -903,6 +950,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_LocalConfigDisabled(ch VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeLocalConfigDisabled(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -923,6 +971,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_Reachable(chip::Contro VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeReachable(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -933,6 +982,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_ClusterRevision(chip:: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -946,6 +996,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BinaryInputBasic_OutOfServic VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BinaryInputBasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeOutOfService(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -966,6 +1017,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BinaryInputBasic_PresentValu VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BinaryInputBasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePresentValue(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -999,6 +1051,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BinaryInputBasic_StatusFlags VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BinaryInputBasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeStatusFlags(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1021,6 +1074,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BinaryInputBasic_ClusterRevi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BinaryInputBasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1054,6 +1108,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Binding_ClusterRevision(chip VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BindingCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1067,6 +1122,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_VendorNam VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BridgedDeviceBasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeVendorName(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1077,6 +1133,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_VendorID( VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BridgedDeviceBasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeVendorID(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1087,6 +1144,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_ProductNa VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BridgedDeviceBasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeProductName(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1097,6 +1155,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_UserLabel VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BridgedDeviceBasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeUserLabel(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1118,6 +1177,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_HardwareV VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BridgedDeviceBasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeHardwareVersion(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1128,6 +1188,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_HardwareV VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BridgedDeviceBasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeHardwareVersionString(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -1139,6 +1200,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_SoftwareV VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BridgedDeviceBasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeSoftwareVersion(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1149,6 +1211,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_SoftwareV VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BridgedDeviceBasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeSoftwareVersionString(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -1160,6 +1223,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_Manufactu VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BridgedDeviceBasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeManufacturingDate(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -1171,6 +1235,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_PartNumbe VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BridgedDeviceBasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePartNumber(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1181,6 +1246,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_ProductUR VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BridgedDeviceBasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeProductURL(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1191,6 +1257,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_ProductLa VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BridgedDeviceBasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeProductLabel(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1201,6 +1268,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_SerialNum VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BridgedDeviceBasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeSerialNumber(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1211,6 +1279,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_Reachable VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BridgedDeviceBasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeReachable(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1221,6 +1290,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_ClusterRe VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BridgedDeviceBasicCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1439,6 +1509,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_CurrentHue(chip VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCurrentHue(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1463,6 +1534,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_CurrentSaturati VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCurrentSaturation(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1487,6 +1559,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_RemainingTime(c VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeRemainingTime(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1497,6 +1570,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_CurrentX(chip:: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCurrentX(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1520,6 +1594,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_CurrentY(chip:: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCurrentY(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1543,6 +1618,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_DriftCompensati VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeDriftCompensation(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1553,6 +1629,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_CompensationTex VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCompensationText(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -1564,6 +1641,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorTemperatur VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorTemperature(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1588,6 +1666,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorMode(chip: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorMode(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1598,6 +1677,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorControlOpt VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorControlOptions(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1618,6 +1698,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_NumberOfPrimari VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeNumberOfPrimaries(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1628,6 +1709,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary1X(chip: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary1X(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1638,6 +1720,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary1Y(chip: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary1Y(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1648,6 +1731,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary1Intensi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary1Intensity(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1658,6 +1742,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary2X(chip: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary2X(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1668,6 +1753,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary2Y(chip: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary2Y(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1678,6 +1764,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary2Intensi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary2Intensity(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1688,6 +1775,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary3X(chip: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary3X(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1698,6 +1786,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary3Y(chip: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary3Y(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1708,6 +1797,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary3Intensi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary3Intensity(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1718,6 +1808,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary4X(chip: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary4X(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1728,6 +1819,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary4Y(chip: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary4Y(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1738,6 +1830,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary4Intensi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary4Intensity(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1748,6 +1841,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary5X(chip: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary5X(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1758,6 +1852,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary5Y(chip: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary5Y(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1768,6 +1863,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary5Intensi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary5Intensity(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1778,6 +1874,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary6X(chip: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary6X(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1788,6 +1885,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary6Y(chip: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary6Y(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1798,6 +1896,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary6Intensi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePrimary6Intensity(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1808,6 +1907,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_WhitePointX(chi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeWhitePointX(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1827,6 +1927,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_WhitePointY(chi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeWhitePointY(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1846,6 +1947,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointRX(ch VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorPointRX(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1866,6 +1968,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointRY(ch VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorPointRY(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1886,6 +1989,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointRInte VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorPointRIntensity(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -1907,6 +2011,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointGX(ch VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorPointGX(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1927,6 +2032,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointGY(ch VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorPointGY(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1947,6 +2053,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointGInte VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorPointGIntensity(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -1968,6 +2075,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointBX(ch VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorPointBX(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -1988,6 +2096,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointBY(ch VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorPointBY(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2008,6 +2117,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointBInte VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorPointBIntensity(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -2029,6 +2139,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_EnhancedCurrent VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeEnhancedCurrentHue(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2039,6 +2150,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_EnhancedColorMo VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeEnhancedColorMode(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2049,6 +2161,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorLoopActive VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorLoopActive(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2059,6 +2172,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorLoopDirect VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorLoopDirection(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2069,6 +2183,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorLoopTime(c VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorLoopTime(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2079,6 +2194,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorLoopStartE VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorLoopStartEnhancedHue(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -2090,6 +2206,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorLoopStored VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorLoopStoredEnhancedHue(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -2101,6 +2218,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorCapabiliti VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorCapabilities(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2111,6 +2229,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorTempPhysic VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorTempPhysicalMin(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -2122,6 +2241,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorTempPhysic VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeColorTempPhysicalMax(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -2133,6 +2253,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_CoupleColorTemp VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCoupleColorTempToLevelMinMireds(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -2144,6 +2265,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_StartUpColorTem VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeStartUpColorTemperatureMireds(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -2166,6 +2288,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ClusterRevision VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2203,6 +2326,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ContentLauncher_AcceptsHeade VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ContentLauncherCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster .ReadAttributeAcceptsHeaderList(gContentLauncherAcceptsHeaderListListAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) @@ -2216,6 +2340,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ContentLauncher_SupportedStr VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ContentLauncherCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster .ReadAttributeSupportedStreamingTypes(gContentLauncherSupportedStreamingTypesListAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) @@ -2229,6 +2354,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ContentLauncher_ClusterRevis VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ContentLauncherCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2242,6 +2368,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Descriptor_DeviceList(chip:: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::DescriptorCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeDeviceList(gDescriptorDeviceListListAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -2253,6 +2380,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Descriptor_ServerList(chip:: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::DescriptorCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeServerList(gDescriptorServerListListAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -2264,6 +2392,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Descriptor_ClientList(chip:: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::DescriptorCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClientList(gDescriptorClientListListAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -2275,6 +2404,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Descriptor_PartsList(chip::C VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::DescriptorCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePartsList(gDescriptorPartsListListAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -2286,6 +2416,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Descriptor_ClusterRevision(c VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::DescriptorCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2528,6 +2659,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_DoorLock_LockState(chip::Con VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::DoorLockCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeLockState(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2550,6 +2682,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_DoorLock_LockType(chip::Cont VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::DoorLockCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeLockType(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2560,6 +2693,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_DoorLock_ActuatorEnabled(chi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::DoorLockCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeActuatorEnabled(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2570,6 +2704,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_DoorLock_ClusterRevision(chi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::DoorLockCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2583,6 +2718,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_Measur VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ElectricalMeasurementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMeasurementType(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2593,6 +2729,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_TotalA VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ElectricalMeasurementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeTotalActivePower(gInt32sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2603,6 +2740,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_RmsVol VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ElectricalMeasurementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeRmsVoltage(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2613,6 +2751,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_RmsVol VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ElectricalMeasurementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeRmsVoltageMin(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2623,6 +2762,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_RmsVol VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ElectricalMeasurementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeRmsVoltageMax(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2633,6 +2773,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_RmsCur VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ElectricalMeasurementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeRmsCurrent(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2643,6 +2784,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_RmsCur VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ElectricalMeasurementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeRmsCurrentMin(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2653,6 +2795,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_RmsCur VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ElectricalMeasurementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeRmsCurrentMax(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2663,6 +2806,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_Active VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ElectricalMeasurementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeActivePower(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2673,6 +2817,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_Active VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ElectricalMeasurementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeActivePowerMin(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2683,6 +2828,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_Active VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ElectricalMeasurementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeActivePowerMax(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2693,6 +2839,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_Cluste VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ElectricalMeasurementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2716,6 +2863,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_P VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::EthernetNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePacketRxCount(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2726,6 +2874,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_P VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::EthernetNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePacketTxCount(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2736,6 +2885,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_T VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::EthernetNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeTxErrCount(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2746,6 +2896,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_C VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::EthernetNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCollisionCount(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2756,6 +2907,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_O VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::EthernetNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeOverrunCount(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2766,6 +2918,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_C VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::EthernetNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2779,6 +2932,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_FixedLabel_LabelList(chip::C VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::FixedLabelCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeLabelList(gFixedLabelLabelListListAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -2790,6 +2944,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_FixedLabel_ClusterRevision(c VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::FixedLabelCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2803,6 +2958,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_FlowMeasurement_MeasuredValu VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::FlowMeasurementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMeasuredValue(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2813,6 +2969,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_FlowMeasurement_MinMeasuredV VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::FlowMeasurementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMinMeasuredValue(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2823,6 +2980,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_FlowMeasurement_MaxMeasuredV VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::FlowMeasurementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMaxMeasuredValue(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2833,6 +2991,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_FlowMeasurement_ClusterRevis VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::FlowMeasurementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2878,6 +3037,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralCommissioning_Breadcr VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::GeneralCommissioningCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeBreadcrumb(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2896,6 +3056,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralCommissioning_BasicCo VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::GeneralCommissioningCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster .ReadAttributeBasicCommissioningInfoList(gGeneralCommissioningBasicCommissioningInfoListListAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) @@ -2909,6 +3070,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralCommissioning_Cluster VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::GeneralCommissioningCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2922,6 +3084,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralDiagnostics_NetworkIn VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::GeneralDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster .ReadAttributeNetworkInterfaces(gGeneralDiagnosticsNetworkInterfacesListAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) @@ -2935,6 +3098,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralDiagnostics_RebootCou VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::GeneralDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeRebootCount(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2945,6 +3109,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralDiagnostics_ClusterRe VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::GeneralDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -2958,6 +3123,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_GroupKeyManagement_Groups(ch VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::GroupKeyManagementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeGroups(gGroupKeyManagementGroupsListAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -2969,6 +3135,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_GroupKeyManagement_GroupKeys VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::GroupKeyManagementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster .ReadAttributeGroupKeys(gGroupKeyManagementGroupKeysListAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); @@ -2981,6 +3148,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_GroupKeyManagement_ClusterRe VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::GroupKeyManagementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -3049,6 +3217,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Groups_NameSupport(chip::Con VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::GroupsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeNameSupport(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -3059,6 +3228,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Groups_ClusterRevision(chip: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::GroupsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -3090,6 +3260,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Identify_IdentifyTime(chip:: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::IdentifyCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeIdentifyTime(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -3110,6 +3281,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Identify_ClusterRevision(chi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::IdentifyCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -3133,6 +3305,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_KeypadInput_ClusterRevision( VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::KeypadInputCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -3222,6 +3395,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_CurrentLevel(ch VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::LevelControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCurrentLevel(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -3246,6 +3420,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_ClusterRevision VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::LevelControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -3268,6 +3443,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_LowPower_ClusterRevision(chi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::LowPowerCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -3316,6 +3492,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_MediaInput_MediaInputList(ch VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::MediaInputCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster .ReadAttributeMediaInputList(gMediaInputMediaInputListListAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); @@ -3328,6 +3505,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_MediaInput_CurrentMediaInput VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::MediaInputCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCurrentMediaInput(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -3338,6 +3516,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_MediaInput_ClusterRevision(c VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::MediaInputCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -3443,6 +3622,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_MediaPlayback_ClusterRevisio VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::MediaPlaybackCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -3554,6 +3734,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_NetworkCommissioning_Feature VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::NetworkCommissioningCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeFeatureMap(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -3564,6 +3745,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_NetworkCommissioning_Cluster VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::NetworkCommissioningCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -3610,6 +3792,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OtaSoftwareUpdateProvider_Cl VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OtaSoftwareUpdateProviderCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -3623,6 +3806,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OccupancySensing_Occupancy(c VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OccupancySensingCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeOccupancy(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -3645,6 +3829,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OccupancySensing_OccupancySe VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OccupancySensingCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeOccupancySensorType(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -3655,6 +3840,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OccupancySensing_OccupancySe VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OccupancySensingCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeOccupancySensorTypeBitmap(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -3666,6 +3852,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OccupancySensing_ClusterRevi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OccupancySensingCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -3730,6 +3917,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OnOff_OnOff(chip::Controller VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OnOffCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeOnOff(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -3752,6 +3940,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OnOff_GlobalSceneControl(chi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OnOffCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeGlobalSceneControl(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -3762,6 +3951,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OnOff_OnTime(chip::Controlle VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OnOffCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeOnTime(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -3780,6 +3970,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OnOff_OffWaitTime(chip::Cont VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OnOffCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeOffWaitTime(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -3799,6 +3990,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OnOff_StartUpOnOff(chip::Con VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OnOffCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeStartUpOnOff(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -3818,6 +4010,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OnOff_FeatureMap(chip::Contr VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OnOffCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeFeatureMap(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -3828,6 +4021,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OnOff_ClusterRevision(chip:: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OnOffCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -3841,6 +4035,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OnOffSwitchConfiguration_Swi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OnOffSwitchConfigurationCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeSwitchType(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -3851,6 +4046,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OnOffSwitchConfiguration_Swi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OnOffSwitchConfigurationCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeSwitchActions(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -3871,6 +4067,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OnOffSwitchConfiguration_Clu VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OnOffSwitchConfigurationCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -3955,6 +4152,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OperationalCredentials_Fabri VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OperationalCredentialsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster .ReadAttributeFabricsList(gOperationalCredentialsFabricsListListAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) @@ -3968,6 +4166,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OperationalCredentials_Suppo VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OperationalCredentialsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeSupportedFabrics(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -3978,6 +4177,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OperationalCredentials_Commi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OperationalCredentialsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCommissionedFabrics(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -3988,6 +4188,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OperationalCredentials_Clust VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OperationalCredentialsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4001,6 +4202,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PressureMeasurement_Measured VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::PressureMeasurementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMeasuredValue(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4025,6 +4227,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PressureMeasurement_MinMeasu VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::PressureMeasurementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMinMeasuredValue(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4035,6 +4238,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PressureMeasurement_MaxMeasu VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::PressureMeasurementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMaxMeasuredValue(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4045,6 +4249,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PressureMeasurement_ClusterR VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::PressureMeasurementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4058,6 +4263,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMaxPressure(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4068,6 +4274,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMaxSpeed(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4078,6 +4285,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMaxFlow(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4087,6 +4295,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeEffectiveOperationMode(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -4097,6 +4306,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeEffectiveControlMode(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -4108,6 +4318,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCapacity(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4132,6 +4343,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeOperationMode(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4152,6 +4364,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4165,6 +4378,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_RelativeHumidityMeasurement_ VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::RelativeHumidityMeasurementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMeasuredValue(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4187,6 +4401,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_RelativeHumidityMeasurement_ VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::RelativeHumidityMeasurementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMinMeasuredValue(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4197,6 +4412,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_RelativeHumidityMeasurement_ VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::RelativeHumidityMeasurementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMaxMeasuredValue(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4207,6 +4423,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_RelativeHumidityMeasurement_ VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::RelativeHumidityMeasurementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4289,6 +4506,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Scenes_SceneCount(chip::Cont VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ScenesCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeSceneCount(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4299,6 +4517,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Scenes_CurrentScene(chip::Co VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ScenesCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCurrentScene(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4309,6 +4528,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Scenes_CurrentGroup(chip::Co VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ScenesCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCurrentGroup(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4319,6 +4539,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Scenes_SceneValid(chip::Cont VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ScenesCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeSceneValid(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4329,6 +4550,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Scenes_NameSupport(chip::Con VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ScenesCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeNameSupport(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4339,6 +4561,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Scenes_ClusterRevision(chip: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ScenesCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4362,6 +4585,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_SoftwareDiagnostics_CurrentH VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::SoftwareDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCurrentHeapHighWatermark(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -4373,6 +4597,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_SoftwareDiagnostics_ClusterR VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::SoftwareDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4386,6 +4611,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Switch_NumberOfPositions(chi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::SwitchCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeNumberOfPositions(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4396,6 +4622,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Switch_CurrentPosition(chip: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::SwitchCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCurrentPosition(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4420,6 +4647,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Switch_ClusterRevision(chip: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::SwitchCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4461,6 +4689,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TvChannel_TvChannelList(chip VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TvChannelCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster .ReadAttributeTvChannelList(gTvChannelTvChannelListListAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); @@ -4473,6 +4702,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TvChannel_TvChannelLineup(ch VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TvChannelCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeTvChannelLineup(gOctetStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -4484,6 +4714,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TvChannel_CurrentTvChannel(c VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TvChannelCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCurrentTvChannel(gOctetStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -4495,6 +4726,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TvChannel_ClusterRevision(ch VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TvChannelCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4519,6 +4751,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TargetNavigator_TargetNaviga VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TargetNavigatorCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster .ReadAttributeTargetNavigatorList(gTargetNavigatorTargetNavigatorListListAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) @@ -4532,6 +4765,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TargetNavigator_ClusterRevis VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TargetNavigatorCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4545,6 +4779,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TemperatureMeasurement_Measu VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TemperatureMeasurementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMeasuredValue(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4569,6 +4804,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TemperatureMeasurement_MinMe VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TemperatureMeasurementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMinMeasuredValue(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4579,6 +4815,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TemperatureMeasurement_MaxMe VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TemperatureMeasurementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMaxMeasuredValue(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4589,6 +4826,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TemperatureMeasurement_Clust VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TemperatureMeasurementCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4644,6 +4882,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Boolean(chip::Co VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeBoolean(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4662,6 +4901,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Bitmap8(chip::Co VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeBitmap8(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4681,6 +4921,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Bitmap16(chip::C VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeBitmap16(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4700,6 +4941,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Bitmap32(chip::C VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeBitmap32(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4719,6 +4961,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Bitmap64(chip::C VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeBitmap64(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4738,6 +4981,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int8u(chip::Cont VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeInt8u(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4756,6 +5000,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int16u(chip::Con VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeInt16u(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4775,6 +5020,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int32u(chip::Con VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeInt32u(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4794,6 +5040,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int64u(chip::Con VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeInt64u(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4813,6 +5060,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int8s(chip::Cont VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeInt8s(gInt8sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4831,6 +5079,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int16s(chip::Con VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeInt16s(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4850,6 +5099,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int32s(chip::Con VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeInt32s(gInt32sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4869,6 +5119,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int64s(chip::Con VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeInt64s(gInt64sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4888,6 +5139,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Enum8(chip::Cont VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeEnum8(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4906,6 +5158,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Enum16(chip::Con VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeEnum16(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4925,6 +5178,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_OctetString(chip VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeOctetString(gOctetStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -4946,6 +5200,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_ListInt8u(chip:: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeListInt8u(gTestClusterListInt8uListAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -4957,6 +5212,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_ListOctetString( VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster .ReadAttributeListOctetString(gTestClusterListOctetStringListAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); @@ -4969,6 +5225,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_ListStructOctetS VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster .ReadAttributeListStructOctetString(gTestClusterListStructOctetStringListAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) @@ -4982,6 +5239,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_LongOctetString( VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeLongOctetString(gOctetStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -5005,6 +5263,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_CharString(chip: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCharString(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5026,6 +5285,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_LongCharString(c VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeLongCharString(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5041,6 +5301,18 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_LongCharString( chip::ByteSpan(value, len)) .AsInteger(); } +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_SimpleStruct(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, ZCLendpointId); + + return cluster.ReadAttributeSimpleStruct(gTestClusterSimpleStructAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) + .AsInteger(); +} + chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Unsupported(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) @@ -5048,6 +5320,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Unsupported(chip VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeUnsupported(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5067,6 +5340,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_ClusterRevision( VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5128,6 +5402,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_LocalTemperature( VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThermostatCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeLocalTemperature(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5152,6 +5427,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_AbsMinHeatSetpoin VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThermostatCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeAbsMinHeatSetpointLimit(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -5163,6 +5439,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_AbsMaxHeatSetpoin VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThermostatCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeAbsMaxHeatSetpointLimit(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -5174,6 +5451,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_AbsMinCoolSetpoin VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThermostatCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeAbsMinCoolSetpointLimit(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -5185,6 +5463,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_AbsMaxCoolSetpoin VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThermostatCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeAbsMaxCoolSetpointLimit(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -5196,6 +5475,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_OccupiedCoolingSe VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThermostatCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeOccupiedCoolingSetpoint(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -5217,6 +5497,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_OccupiedHeatingSe VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThermostatCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeOccupiedHeatingSetpoint(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -5238,6 +5519,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_MinHeatSetpointLi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThermostatCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMinHeatSetpointLimit(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -5259,6 +5541,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_MaxHeatSetpointLi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThermostatCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMaxHeatSetpointLimit(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -5280,6 +5563,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_MinCoolSetpointLi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThermostatCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMinCoolSetpointLimit(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -5301,6 +5585,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_MaxCoolSetpointLi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThermostatCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMaxCoolSetpointLimit(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -5322,6 +5607,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_ControlSequenceOf VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThermostatCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeControlSequenceOfOperation(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -5344,6 +5630,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_SystemMode(chip:: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThermostatCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeSystemMode(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5363,6 +5650,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_StartOfWeek(chip: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThermostatCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeStartOfWeek(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5373,6 +5661,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_NumberOfWeeklyTra VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThermostatCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeNumberOfWeeklyTransitions(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -5384,6 +5673,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_NumberOfDailyTran VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThermostatCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeNumberOfDailyTransitions(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -5395,6 +5685,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_FeatureMap(chip:: VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThermostatCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeFeatureMap(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5405,6 +5696,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_ClusterRevision(c VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThermostatCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5417,6 +5709,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThermostatUserInterfaceConfi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThermostatUserInterfaceConfigurationCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeTemperatureDisplayMode(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -5436,6 +5729,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThermostatUserInterfaceConfi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThermostatUserInterfaceConfigurationCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeKeypadLockout(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5454,6 +5748,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThermostatUserInterfaceConfi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThermostatUserInterfaceConfigurationCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeScheduleProgrammingVisibility(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -5474,6 +5769,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThermostatUserInterfaceConfi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThermostatUserInterfaceConfigurationCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5497,6 +5793,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Cha VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeChannel(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5507,6 +5804,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Rou VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeRoutingRole(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5517,6 +5815,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Net VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeNetworkName(gOctetStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5527,6 +5826,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Pan VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePanId(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5537,6 +5837,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Ext VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeExtendedPanId(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5547,6 +5848,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Mes VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMeshLocalPrefix(gOctetStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -5558,6 +5860,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Ove VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeOverrunCount(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5568,6 +5871,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Nei VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster .ReadAttributeNeighborTableList(gThreadNetworkDiagnosticsNeighborTableListListAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) @@ -5581,6 +5885,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Rou VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster .ReadAttributeRouteTableList(gThreadNetworkDiagnosticsRouteTableListListAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) @@ -5594,6 +5899,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Par VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePartitionId(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5604,6 +5910,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Wei VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeWeighting(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5614,6 +5921,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Dat VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeDataVersion(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5624,6 +5932,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Sta VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeStableDataVersion(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5634,6 +5943,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Lea VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeLeaderRouterId(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5644,6 +5954,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Det VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeDetachedRoleCount(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5654,6 +5965,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Chi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeChildRoleCount(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5664,6 +5976,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Rou VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeRouterRoleCount(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5674,6 +5987,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Lea VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeLeaderRoleCount(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5684,6 +5998,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Att VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeAttachAttemptCount(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5693,6 +6008,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Par VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePartitionIdChangeCount(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -5703,6 +6019,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Bet VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster .ReadAttributeBetterPartitionAttachAttemptCount(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); @@ -5715,6 +6032,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Par VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeParentChangeCount(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5725,6 +6043,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxT VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeTxTotalCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5735,6 +6054,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxU VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeTxUnicastCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5745,6 +6065,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxB VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeTxBroadcastCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5755,6 +6076,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxA VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeTxAckRequestedCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -5766,6 +6088,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxA VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeTxAckedCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5775,6 +6098,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxN VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeTxNoAckRequestedCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -5786,6 +6110,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxD VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeTxDataCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5796,6 +6121,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxD VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeTxDataPollCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5806,6 +6132,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxB VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeTxBeaconCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5816,6 +6143,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxB VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeTxBeaconRequestCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -5827,6 +6155,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxO VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeTxOtherCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5837,6 +6166,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxR VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeTxRetryCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5846,6 +6176,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxD VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeTxDirectMaxRetryExpiryCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -5856,6 +6187,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxI VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeTxIndirectMaxRetryExpiryCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -5867,6 +6199,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxE VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeTxErrCcaCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5877,6 +6210,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxE VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeTxErrAbortCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5886,6 +6220,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxE VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeTxErrBusyChannelCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -5897,6 +6232,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxT VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeRxTotalCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5907,6 +6243,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxU VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeRxUnicastCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5917,6 +6254,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxB VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeRxBroadcastCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5927,6 +6265,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxD VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeRxDataCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5937,6 +6276,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxD VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeRxDataPollCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5947,6 +6287,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxB VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeRxBeaconCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5957,6 +6298,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxB VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeRxBeaconRequestCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -5968,6 +6310,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxO VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeRxOtherCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -5977,6 +6320,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxA VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeRxAddressFilteredCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -5987,6 +6331,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxD VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeRxDestAddrFilteredCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -5998,6 +6343,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxD VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeRxDuplicatedCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -6008,6 +6354,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxE VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeRxErrNoFrameCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -6017,6 +6364,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxE VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeRxErrUnknownNeighborCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -6027,6 +6375,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxE VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeRxErrInvalidSrcAddrCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -6038,6 +6387,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxE VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeRxErrSecCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -6048,6 +6398,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxE VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeRxErrFcsCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -6058,6 +6409,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxE VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeRxErrOtherCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -6068,6 +6420,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Sec VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster .ReadAttributeSecurityPolicy(gThreadNetworkDiagnosticsSecurityPolicyListAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) @@ -6081,6 +6434,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Cha VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeChannelMask(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -6090,6 +6444,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Ope VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster .ReadAttributeOperationalDatasetComponents( gThreadNetworkDiagnosticsOperationalDatasetComponentsListAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) @@ -6102,6 +6457,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Act VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster .ReadAttributeActiveNetworkFaultsList(gThreadNetworkDiagnosticsActiveNetworkFaultsListListAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) @@ -6115,6 +6471,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Clu VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -6128,6 +6485,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WakeOnLan_WakeOnLanMacAddres VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WakeOnLanCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeWakeOnLanMacAddress(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -6139,6 +6497,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WakeOnLan_ClusterRevision(ch VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WakeOnLanCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -6162,6 +6521,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_Bssid VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WiFiNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeBssid(gOctetStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -6172,6 +6532,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_Secur VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WiFiNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeSecurityType(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -6182,6 +6543,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_WiFiV VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WiFiNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeWiFiVersion(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -6192,6 +6554,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_Chann VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WiFiNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeChannelNumber(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -6202,6 +6565,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_Rssi( VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WiFiNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeRssi(gInt8sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -6212,6 +6576,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_Clust VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WiFiNetworkDiagnosticsCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -6288,6 +6653,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_Type(chip::Co VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeType(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -6298,6 +6664,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_CurrentPositi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCurrentPositionLift(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -6309,6 +6676,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_CurrentPositi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCurrentPositionTilt(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -6320,6 +6688,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_ConfigStatus( VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeConfigStatus(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -6330,6 +6699,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_CurrentPositi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCurrentPositionLiftPercentage(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -6353,6 +6723,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_CurrentPositi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCurrentPositionTiltPercentage(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -6376,6 +6747,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_OperationalSt VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeOperationalStatus(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -6399,6 +6771,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_TargetPositio VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeTargetPositionLiftPercent100ths(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -6421,6 +6794,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_TargetPositio VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeTargetPositionTiltPercent100ths(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -6444,6 +6818,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_EndProductTyp VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeEndProductType(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -6453,6 +6828,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_CurrentPositi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster .ReadAttributeCurrentPositionLiftPercent100ths(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); @@ -6476,6 +6852,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_CurrentPositi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster .ReadAttributeCurrentPositionTiltPercent100ths(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); @@ -6500,6 +6877,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_InstalledOpen VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeInstalledOpenLimitLift(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -6511,6 +6889,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_InstalledClos VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeInstalledClosedLimitLift(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -6522,6 +6901,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_InstalledOpen VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeInstalledOpenLimitTilt(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -6533,6 +6913,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_InstalledClos VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeInstalledClosedLimitTilt(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) .AsInteger(); } @@ -6544,6 +6925,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_Mode(chip::Co VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeMode(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -6563,6 +6945,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_SafetyStatus( VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeSafetyStatus(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } @@ -6586,6 +6969,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_ClusterRevisi VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 9c255daabb6eba..b3a8400a4f8fcd 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -2826,6 +2826,11 @@ class ChipClusters: "type": "str", "writable": True, }, + 0x00000020: { + "attributeName": "SimpleStruct", + "attributeId": 0x00000020, + "type": "", + }, 0x000000FF: { "attributeName": "Unsupported", "attributeId": 0x000000FF, @@ -4984,6 +4989,8 @@ def ClusterTestCluster_ReadAttributeLongCharString(self, device: ctypes.c_void_p def ClusterTestCluster_WriteAttributeLongCharString(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, value: bytes): value = value.encode("utf-8") return self._chipLib.chip_ime_WriteAttribute_TestCluster_LongCharString(device, ZCLendpoint, ZCLgroupid, value, len(value)) + def ClusterTestCluster_ReadAttributeSimpleStruct(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_SimpleStruct(device, ZCLendpoint, ZCLgroupid) def ClusterTestCluster_ReadAttributeUnsupported(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): return self._chipLib.chip_ime_ReadAttribute_TestCluster_Unsupported(device, ZCLendpoint, ZCLgroupid) def ClusterTestCluster_WriteAttributeUnsupported(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, value: bool): @@ -6657,6 +6664,9 @@ def InitLib(self, chipLib): # Cluster TestCluster WriteAttribute LongCharString self._chipLib.chip_ime_WriteAttribute_TestCluster_LongCharString.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_char_p, ctypes.c_uint32] self._chipLib.chip_ime_WriteAttribute_TestCluster_LongCharString.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute SimpleStruct + self._chipLib.chip_ime_ReadAttribute_TestCluster_SimpleStruct.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_SimpleStruct.restype = ctypes.c_uint32 # Cluster TestCluster ReadAttribute Unsupported self._chipLib.chip_ime_ReadAttribute_TestCluster_Unsupported.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] self._chipLib.chip_ime_ReadAttribute_TestCluster_Unsupported.restype = ctypes.c_uint32 diff --git a/zzz_generated/all-clusters-app/zap-generated/attribute-size.cpp b/zzz_generated/all-clusters-app/zap-generated/attribute-size.cpp index 68632836dadd58..86c0bdf899e6dd 100644 --- a/zzz_generated/all-clusters-app/zap-generated/attribute-size.cpp +++ b/zzz_generated/all-clusters-app/zap-generated/attribute-size.cpp @@ -21,10 +21,13 @@ #include #include #include +#include +#include #include #include using namespace chip; +using namespace chip::app; using namespace chip::app::List; // The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid @@ -45,6 +48,635 @@ void copyListMember(uint8_t * dest, uint8_t * src, bool write, uint16_t * offset *offset = static_cast(*offset + length); } +CHIP_ERROR CopyStructAttributeToCHIPTLV(ClusterId clusterId, AttributeId attributeId, uint8_t * src, uint16_t len, + TLV::TLVWriter & writer, uint64_t tag) +{ + switch (clusterId) + { + case 0x050F: // Test Cluster Cluster + { + switch (attributeId) + { + case 0x0020: // simple_struct + { + // Struct _simplestruct + _simplestruct entry; + ReturnErrorOnFailure(_simplestruct::FromEmberBuffer(&entry, src, 12)); + return writer.Put(TLV::AnonymousTag, entry); + } + } + break; + } + } + return CHIP_ERROR_INVALID_ARGUMENT; +} + +CHIP_ERROR EmberListToCHIPTLV(ClusterId clusterId, AttributeId attributeId, uint8_t * src, uint16_t len, TLV::TLVWriter & writer, + uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + size_t count = *reinterpret_cast(src); + uint16_t entryLength = 0; + // Suppress error of unused variable. + (void) entryLength; + (void) count; + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Array, tmpType)); + switch (clusterId) + { + case 0x050C: // Application Launcher Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // application launcher list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 2; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + uint16_t entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // INT16U + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + } + break; + } + case 0x050B: // Audio Output Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // audio output list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 36; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _AudioOutputInfo + _AudioOutputInfo entry; + SuccessOrExit(err = _AudioOutputInfo::FromEmberBuffer(&entry, src + entryOffset, 36)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x050A: // Content Launcher Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // accepts header list + { + for (size_t index = 0; index < count; index++) + { + entryOffset = GetByteSpanOffsetFromIndex(src, len, static_cast(index)); + if (entryOffset == 0) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + + chip::ByteSpan acceptsHeaderListSpan; // OCTET_STRING + uint16_t acceptsHeaderListRemainingSpace = static_cast(len - entryOffset); + if (CHIP_NO_ERROR != ReadByteSpan(src + entryOffset, acceptsHeaderListRemainingSpace, &acceptsHeaderListSpan)) + { + ChipLogError(Zcl, "Index %zu is invalid. Not enough remaining space", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + writer.Put(TLV::AnonymousTag, acceptsHeaderListSpan); + } + break; + } + case 0x0001: // supported streaming types + { + for (size_t index = 0; index < count; index++) + { + entryLength = 1; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + uint8_t entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, + entryLength); // ContentLaunchStreamingType + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + } + break; + } + case 0x001D: // Descriptor Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // device list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 6; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _DeviceType + _DeviceType entry; + SuccessOrExit(err = _DeviceType::FromEmberBuffer(&entry, src + entryOffset, 6)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x0001: // server list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 4; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + chip::ClusterId entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // CLUSTER_ID + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + case 0x0002: // client list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 4; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + chip::ClusterId entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // CLUSTER_ID + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + case 0x0003: // parts list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 2; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + chip::EndpointId entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // ENDPOINT_NO + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + } + break; + } + case 0x0040: // Fixed Label Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // label list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 36; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _LabelStruct + _LabelStruct entry; + SuccessOrExit(err = _LabelStruct::FromEmberBuffer(&entry, src + entryOffset, 36)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x0030: // General Commissioning Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0001: // BasicCommissioningInfoList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 4; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _BasicCommissioningInfoType + _BasicCommissioningInfoType entry; + SuccessOrExit(err = _BasicCommissioningInfoType::FromEmberBuffer(&entry, src + entryOffset, 4)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x0033: // General Diagnostics Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // NetworkInterfaces + { + for (size_t index = 0; index < count; index++) + { + entryLength = 48; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _NetworkInterfaceType + _NetworkInterfaceType entry; + SuccessOrExit(err = _NetworkInterfaceType::FromEmberBuffer(&entry, src + entryOffset, 48)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0xF004: // Group Key Management Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // groups + { + for (size_t index = 0; index < count; index++) + { + entryLength = 6; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _GroupState + _GroupState entry; + SuccessOrExit(err = _GroupState::FromEmberBuffer(&entry, src + entryOffset, 6)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x0001: // group keys + { + for (size_t index = 0; index < count; index++) + { + entryLength = 31; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _GroupKey + _GroupKey entry; + SuccessOrExit(err = _GroupKey::FromEmberBuffer(&entry, src + entryOffset, 31)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x0507: // Media Input Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // media input list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 70; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _MediaInputInfo + _MediaInputInfo entry; + SuccessOrExit(err = _MediaInputInfo::FromEmberBuffer(&entry, src + entryOffset, 70)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x003E: // Operational Credentials Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0001: // fabrics list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 120; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _FabricDescriptor + _FabricDescriptor entry; + SuccessOrExit(err = _FabricDescriptor::FromEmberBuffer(&entry, src + entryOffset, 120)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x0004: // TrustedRootCertificates + { + for (size_t index = 0; index < count; index++) + { + entryOffset = GetByteSpanOffsetFromIndex(src, len, static_cast(index)); + if (entryOffset == 0) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + + chip::ByteSpan trustedRootCertificatesSpan; // OCTET_STRING + uint16_t trustedRootCertificatesRemainingSpace = static_cast(len - entryOffset); + if (CHIP_NO_ERROR != + ReadByteSpan(src + entryOffset, trustedRootCertificatesRemainingSpace, &trustedRootCertificatesSpan)) + { + ChipLogError(Zcl, "Index %zu is invalid. Not enough remaining space", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + writer.Put(TLV::AnonymousTag, trustedRootCertificatesSpan); + } + break; + } + } + break; + } + case 0x0504: // TV Channel Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // tv channel list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 106; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _TvChannelInfo + _TvChannelInfo entry; + SuccessOrExit(err = _TvChannelInfo::FromEmberBuffer(&entry, src + entryOffset, 106)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x0505: // Target Navigator Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // target navigator list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 35; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _NavigateTargetTargetInfo + _NavigateTargetTargetInfo entry; + SuccessOrExit(err = _NavigateTargetTargetInfo::FromEmberBuffer(&entry, src + entryOffset, 35)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x050F: // Test Cluster Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x001A: // list_int8u + { + for (size_t index = 0; index < count; index++) + { + entryLength = 1; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + uint8_t entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // INT8U + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + case 0x001B: // list_octet_string + { + for (size_t index = 0; index < count; index++) + { + entryOffset = GetByteSpanOffsetFromIndex(src, len, static_cast(index)); + if (entryOffset == 0) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + + chip::ByteSpan listOctetStringSpan; // OCTET_STRING + uint16_t listOctetStringRemainingSpace = static_cast(len - entryOffset); + if (CHIP_NO_ERROR != ReadByteSpan(src + entryOffset, listOctetStringRemainingSpace, &listOctetStringSpan)) + { + ChipLogError(Zcl, "Index %zu is invalid. Not enough remaining space", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + writer.Put(TLV::AnonymousTag, listOctetStringSpan); + } + break; + } + case 0x001C: // list_struct_octet_string + { + for (size_t index = 0; index < count; index++) + { + entryLength = 42; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _TestListStructOctet + _TestListStructOctet entry; + SuccessOrExit(err = _TestListStructOctet::FromEmberBuffer(&entry, src + entryOffset, 42)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x0035: // Thread Network Diagnostics Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0007: // NeighborTableList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 31; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _NeighborTable + _NeighborTable entry; + SuccessOrExit(err = _NeighborTable::FromEmberBuffer(&entry, src + entryOffset, 31)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x0008: // RouteTableList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 18; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _RouteTable + _RouteTable entry; + SuccessOrExit(err = _RouteTable::FromEmberBuffer(&entry, src + entryOffset, 18)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x003B: // SecurityPolicy + { + for (size_t index = 0; index < count; index++) + { + entryLength = 3; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _SecurityPolicy + _SecurityPolicy entry; + SuccessOrExit(err = _SecurityPolicy::FromEmberBuffer(&entry, src + entryOffset, 3)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x003D: // OperationalDatasetComponents + { + for (size_t index = 0; index < count; index++) + { + entryLength = 12; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _OperationalDatasetComponents + _OperationalDatasetComponents entry; + SuccessOrExit(err = _OperationalDatasetComponents::FromEmberBuffer(&entry, src + entryOffset, 12)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x003E: // ActiveNetworkFaultsList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 1; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + uint8_t entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // NetworkFault + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + } + break; + } + } +exit: + err = writer.EndContainer(tmpType); + return err; +} + uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, bool write, uint8_t * dest, uint8_t * src, int32_t index) { @@ -80,8 +712,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo { case 0x050C: // Application Launcher Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // application launcher list { @@ -100,8 +733,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x050B: // Audio Output Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // audio output list { @@ -114,18 +748,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _AudioOutputInfo _AudioOutputInfo * entry = reinterpret_cast<_AudioOutputInfo *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->index, write ? (uint8_t *) &entry->index : src, write, &entryOffset, - sizeof(entry->index)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->outputType, write ? (uint8_t *) &entry->outputType : src, write, - &entryOffset, sizeof(entry->outputType)); // AudioOutputType - ByteSpan * nameSpan = &entry->name; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _AudioOutputInfo::ToEmberBuffer(entry, dest + entryOffset, 36, unusedLen); + } + else + { + _AudioOutputInfo::FromEmberBuffer(entry, src + entryOffset, 36); } - entryOffset = static_cast(entryOffset + 34); break; } } @@ -133,8 +764,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x050A: // Content Launcher Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // accepts header list { @@ -180,8 +812,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x001D: // Descriptor Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // device list { @@ -194,10 +827,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _DeviceType _DeviceType * entry = reinterpret_cast<_DeviceType *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->type, write ? (uint8_t *) &entry->type : src, write, &entryOffset, - sizeof(entry->type)); // DEVTYPE_ID - copyListMember(write ? dest : (uint8_t *) &entry->revision, write ? (uint8_t *) &entry->revision : src, write, - &entryOffset, sizeof(entry->revision)); // INT16U + if (write) + { + size_t unusedLen; + _DeviceType::ToEmberBuffer(entry, dest + entryOffset, 6, unusedLen); + } + else + { + _DeviceType::FromEmberBuffer(entry, src + entryOffset, 6); + } break; } case 0x0001: // server list @@ -241,8 +879,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0040: // Fixed Label Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // label list { @@ -255,22 +894,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _LabelStruct _LabelStruct * entry = reinterpret_cast<_LabelStruct *>(write ? src : dest); - ByteSpan * labelSpan = &entry->label; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 18, labelSpan) : ReadByteSpan(src + entryOffset, 18, labelSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _LabelStruct::ToEmberBuffer(entry, dest + entryOffset, 36, unusedLen); } - entryOffset = static_cast(entryOffset + 18); - ByteSpan * valueSpan = &entry->value; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 18, valueSpan) : ReadByteSpan(src + entryOffset, 18, valueSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _LabelStruct::FromEmberBuffer(entry, src + entryOffset, 36); } - entryOffset = static_cast(entryOffset + 18); break; } } @@ -278,8 +910,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0030: // General Commissioning Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0001: // BasicCommissioningInfoList { @@ -292,9 +925,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _BasicCommissioningInfoType _BasicCommissioningInfoType * entry = reinterpret_cast<_BasicCommissioningInfoType *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->FailSafeExpiryLengthMs, - write ? (uint8_t *) &entry->FailSafeExpiryLengthMs : src, write, &entryOffset, - sizeof(entry->FailSafeExpiryLengthMs)); // INT32U + if (write) + { + size_t unusedLen; + _BasicCommissioningInfoType::ToEmberBuffer(entry, dest + entryOffset, 4, unusedLen); + } + else + { + _BasicCommissioningInfoType::FromEmberBuffer(entry, src + entryOffset, 4); + } break; } } @@ -302,8 +941,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0033: // General Diagnostics Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // NetworkInterfaces { @@ -316,33 +956,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NetworkInterfaceType _NetworkInterfaceType * entry = reinterpret_cast<_NetworkInterfaceType *>(write ? src : dest); - ByteSpan * NameSpan = &entry->Name; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, NameSpan) : ReadByteSpan(src + entryOffset, 34, NameSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _NetworkInterfaceType::ToEmberBuffer(entry, dest + entryOffset, 48, unusedLen); } - entryOffset = static_cast(entryOffset + 34); - copyListMember(write ? dest : (uint8_t *) &entry->FabricConnected, write ? (uint8_t *) &entry->FabricConnected : src, - write, &entryOffset, sizeof(entry->FabricConnected)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->OffPremiseServicesReachableIPv4, - write ? (uint8_t *) &entry->OffPremiseServicesReachableIPv4 : src, write, &entryOffset, - sizeof(entry->OffPremiseServicesReachableIPv4)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->OffPremiseServicesReachableIPv6, - write ? (uint8_t *) &entry->OffPremiseServicesReachableIPv6 : src, write, &entryOffset, - sizeof(entry->OffPremiseServicesReachableIPv6)); // BOOLEAN - ByteSpan * HardwareAddressSpan = &entry->HardwareAddress; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 10, HardwareAddressSpan) - : ReadByteSpan(src + entryOffset, 10, HardwareAddressSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _NetworkInterfaceType::FromEmberBuffer(entry, src + entryOffset, 48); } - entryOffset = static_cast(entryOffset + 10); - copyListMember(write ? dest : (uint8_t *) &entry->Type, write ? (uint8_t *) &entry->Type : src, write, &entryOffset, - sizeof(entry->Type)); // ENUM8 break; } } @@ -350,8 +972,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0xF004: // Group Key Management Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // groups { @@ -364,12 +987,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _GroupState _GroupState * entry = reinterpret_cast<_GroupState *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->VendorId, write ? (uint8_t *) &entry->VendorId : src, write, - &entryOffset, sizeof(entry->VendorId)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->VendorGroupId, write ? (uint8_t *) &entry->VendorGroupId : src, write, - &entryOffset, sizeof(entry->VendorGroupId)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->GroupKeySetIndex, write ? (uint8_t *) &entry->GroupKeySetIndex : src, - write, &entryOffset, sizeof(entry->GroupKeySetIndex)); // INT16U + if (write) + { + size_t unusedLen; + _GroupState::ToEmberBuffer(entry, dest + entryOffset, 6, unusedLen); + } + else + { + _GroupState::FromEmberBuffer(entry, src + entryOffset, 6); + } break; } case 0x0001: // group keys @@ -383,25 +1009,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _GroupKey _GroupKey * entry = reinterpret_cast<_GroupKey *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->VendorId, write ? (uint8_t *) &entry->VendorId : src, write, - &entryOffset, sizeof(entry->VendorId)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->GroupKeyIndex, write ? (uint8_t *) &entry->GroupKeyIndex : src, write, - &entryOffset, sizeof(entry->GroupKeyIndex)); // INT16U - ByteSpan * GroupKeyRootSpan = &entry->GroupKeyRoot; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 18, GroupKeyRootSpan) - : ReadByteSpan(src + entryOffset, 18, GroupKeyRootSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _GroupKey::ToEmberBuffer(entry, dest + entryOffset, 31, unusedLen); + } + else + { + _GroupKey::FromEmberBuffer(entry, src + entryOffset, 31); } - entryOffset = static_cast(entryOffset + 18); - copyListMember(write ? dest : (uint8_t *) &entry->GroupKeyEpochStartTime, - write ? (uint8_t *) &entry->GroupKeyEpochStartTime : src, write, &entryOffset, - sizeof(entry->GroupKeyEpochStartTime)); // INT64U - copyListMember(write ? dest : (uint8_t *) &entry->GroupKeySecurityPolicy, - write ? (uint8_t *) &entry->GroupKeySecurityPolicy : src, write, &entryOffset, - sizeof(entry->GroupKeySecurityPolicy)); // GroupKeySecurityPolicy break; } } @@ -409,8 +1025,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0507: // Media Input Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // media input list { @@ -423,27 +1040,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _MediaInputInfo _MediaInputInfo * entry = reinterpret_cast<_MediaInputInfo *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->index, write ? (uint8_t *) &entry->index : src, write, &entryOffset, - sizeof(entry->index)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->inputType, write ? (uint8_t *) &entry->inputType : src, write, - &entryOffset, sizeof(entry->inputType)); // MediaInputType - ByteSpan * nameSpan = &entry->name; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _MediaInputInfo::ToEmberBuffer(entry, dest + entryOffset, 70, unusedLen); } - entryOffset = static_cast(entryOffset + 34); - ByteSpan * descriptionSpan = &entry->description; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, descriptionSpan) - : ReadByteSpan(src + entryOffset, 34, descriptionSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _MediaInputInfo::FromEmberBuffer(entry, src + entryOffset, 70); } - entryOffset = static_cast(entryOffset + 34); break; } } @@ -451,8 +1056,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x003E: // Operational Credentials Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0001: // fabrics list { @@ -465,31 +1071,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _FabricDescriptor _FabricDescriptor * entry = reinterpret_cast<_FabricDescriptor *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->FabricIndex, write ? (uint8_t *) &entry->FabricIndex : src, write, - &entryOffset, sizeof(entry->FabricIndex)); // INT8U - ByteSpan * RootPublicKeySpan = &entry->RootPublicKey; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 67, RootPublicKeySpan) - : ReadByteSpan(src + entryOffset, 67, RootPublicKeySpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _FabricDescriptor::ToEmberBuffer(entry, dest + entryOffset, 120, unusedLen); } - entryOffset = static_cast(entryOffset + 67); - copyListMember(write ? dest : (uint8_t *) &entry->VendorId, write ? (uint8_t *) &entry->VendorId : src, write, - &entryOffset, sizeof(entry->VendorId)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->FabricId, write ? (uint8_t *) &entry->FabricId : src, write, - &entryOffset, sizeof(entry->FabricId)); // FABRIC_ID - copyListMember(write ? dest : (uint8_t *) &entry->NodeId, write ? (uint8_t *) &entry->NodeId : src, write, &entryOffset, - sizeof(entry->NodeId)); // NODE_ID - ByteSpan * LabelSpan = &entry->Label; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, LabelSpan) : ReadByteSpan(src + entryOffset, 34, LabelSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _FabricDescriptor::FromEmberBuffer(entry, src + entryOffset, 120); } - entryOffset = static_cast(entryOffset + 34); break; } case 0x0004: // TrustedRootCertificates @@ -524,8 +1114,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0504: // TV Channel Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // tv channel list { @@ -538,35 +1129,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _TvChannelInfo _TvChannelInfo * entry = reinterpret_cast<_TvChannelInfo *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->majorNumber, write ? (uint8_t *) &entry->majorNumber : src, write, - &entryOffset, sizeof(entry->majorNumber)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->minorNumber, write ? (uint8_t *) &entry->minorNumber : src, write, - &entryOffset, sizeof(entry->minorNumber)); // INT16U - ByteSpan * nameSpan = &entry->name; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _TvChannelInfo::ToEmberBuffer(entry, dest + entryOffset, 106, unusedLen); } - entryOffset = static_cast(entryOffset + 34); - ByteSpan * callSignSpan = &entry->callSign; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, callSignSpan) : ReadByteSpan(src + entryOffset, 34, callSignSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _TvChannelInfo::FromEmberBuffer(entry, src + entryOffset, 106); } - entryOffset = static_cast(entryOffset + 34); - ByteSpan * affiliateCallSignSpan = &entry->affiliateCallSign; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, affiliateCallSignSpan) - : ReadByteSpan(src + entryOffset, 34, affiliateCallSignSpan))) - { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; - } - entryOffset = static_cast(entryOffset + 34); break; } } @@ -574,8 +1145,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0505: // Target Navigator Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // target navigator list { @@ -588,16 +1160,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NavigateTargetTargetInfo _NavigateTargetTargetInfo * entry = reinterpret_cast<_NavigateTargetTargetInfo *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->identifier, write ? (uint8_t *) &entry->identifier : src, write, - &entryOffset, sizeof(entry->identifier)); // INT8U - ByteSpan * nameSpan = &entry->name; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _NavigateTargetTargetInfo::ToEmberBuffer(entry, dest + entryOffset, 35, unusedLen); + } + else + { + _NavigateTargetTargetInfo::FromEmberBuffer(entry, src + entryOffset, 35); } - entryOffset = static_cast(entryOffset + 34); break; } } @@ -605,8 +1176,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x050F: // Test Cluster Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x001A: // list_int8u { @@ -658,17 +1230,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _TestListStructOctet _TestListStructOctet * entry = reinterpret_cast<_TestListStructOctet *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->fabricIndex, write ? (uint8_t *) &entry->fabricIndex : src, write, - &entryOffset, sizeof(entry->fabricIndex)); // INT64U - ByteSpan * operationalCertSpan = &entry->operationalCert; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, operationalCertSpan) - : ReadByteSpan(src + entryOffset, 34, operationalCertSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _TestListStructOctet::ToEmberBuffer(entry, dest + entryOffset, 42, unusedLen); + } + else + { + _TestListStructOctet::FromEmberBuffer(entry, src + entryOffset, 42); } - entryOffset = static_cast(entryOffset + 34); break; } } @@ -676,8 +1246,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0035: // Thread Network Diagnostics Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0007: // NeighborTableList { @@ -690,34 +1261,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NeighborTable _NeighborTable * entry = reinterpret_cast<_NeighborTable *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->ExtAddress, write ? (uint8_t *) &entry->ExtAddress : src, write, - &entryOffset, sizeof(entry->ExtAddress)); // INT64U - copyListMember(write ? dest : (uint8_t *) &entry->Age, write ? (uint8_t *) &entry->Age : src, write, &entryOffset, - sizeof(entry->Age)); // INT32U - copyListMember(write ? dest : (uint8_t *) &entry->Rloc16, write ? (uint8_t *) &entry->Rloc16 : src, write, &entryOffset, - sizeof(entry->Rloc16)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->LinkFrameCounter, write ? (uint8_t *) &entry->LinkFrameCounter : src, - write, &entryOffset, sizeof(entry->LinkFrameCounter)); // INT32U - copyListMember(write ? dest : (uint8_t *) &entry->MleFrameCounter, write ? (uint8_t *) &entry->MleFrameCounter : src, - write, &entryOffset, sizeof(entry->MleFrameCounter)); // INT32U - copyListMember(write ? dest : (uint8_t *) &entry->LQI, write ? (uint8_t *) &entry->LQI : src, write, &entryOffset, - sizeof(entry->LQI)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->AverageRssi, write ? (uint8_t *) &entry->AverageRssi : src, write, - &entryOffset, sizeof(entry->AverageRssi)); // INT8S - copyListMember(write ? dest : (uint8_t *) &entry->LastRssi, write ? (uint8_t *) &entry->LastRssi : src, write, - &entryOffset, sizeof(entry->LastRssi)); // INT8S - copyListMember(write ? dest : (uint8_t *) &entry->FrameErrorRate, write ? (uint8_t *) &entry->FrameErrorRate : src, - write, &entryOffset, sizeof(entry->FrameErrorRate)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->MessageErrorRate, write ? (uint8_t *) &entry->MessageErrorRate : src, - write, &entryOffset, sizeof(entry->MessageErrorRate)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->RxOnWhenIdle, write ? (uint8_t *) &entry->RxOnWhenIdle : src, write, - &entryOffset, sizeof(entry->RxOnWhenIdle)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->FullThreadDevice, write ? (uint8_t *) &entry->FullThreadDevice : src, - write, &entryOffset, sizeof(entry->FullThreadDevice)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->FullNetworkData, write ? (uint8_t *) &entry->FullNetworkData : src, - write, &entryOffset, sizeof(entry->FullNetworkData)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->IsChild, write ? (uint8_t *) &entry->IsChild : src, write, - &entryOffset, sizeof(entry->IsChild)); // BOOLEAN + if (write) + { + size_t unusedLen; + _NeighborTable::ToEmberBuffer(entry, dest + entryOffset, 31, unusedLen); + } + else + { + _NeighborTable::FromEmberBuffer(entry, src + entryOffset, 31); + } break; } case 0x0008: // RouteTableList @@ -731,26 +1283,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _RouteTable _RouteTable * entry = reinterpret_cast<_RouteTable *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->ExtAddress, write ? (uint8_t *) &entry->ExtAddress : src, write, - &entryOffset, sizeof(entry->ExtAddress)); // INT64U - copyListMember(write ? dest : (uint8_t *) &entry->Rloc16, write ? (uint8_t *) &entry->Rloc16 : src, write, &entryOffset, - sizeof(entry->Rloc16)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->RouterId, write ? (uint8_t *) &entry->RouterId : src, write, - &entryOffset, sizeof(entry->RouterId)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->NextHop, write ? (uint8_t *) &entry->NextHop : src, write, - &entryOffset, sizeof(entry->NextHop)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->PathCost, write ? (uint8_t *) &entry->PathCost : src, write, - &entryOffset, sizeof(entry->PathCost)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->LQIIn, write ? (uint8_t *) &entry->LQIIn : src, write, &entryOffset, - sizeof(entry->LQIIn)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->LQIOut, write ? (uint8_t *) &entry->LQIOut : src, write, &entryOffset, - sizeof(entry->LQIOut)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->Age, write ? (uint8_t *) &entry->Age : src, write, &entryOffset, - sizeof(entry->Age)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->Allocated, write ? (uint8_t *) &entry->Allocated : src, write, - &entryOffset, sizeof(entry->Allocated)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->LinkEstablished, write ? (uint8_t *) &entry->LinkEstablished : src, - write, &entryOffset, sizeof(entry->LinkEstablished)); // BOOLEAN + if (write) + { + size_t unusedLen; + _RouteTable::ToEmberBuffer(entry, dest + entryOffset, 18, unusedLen); + } + else + { + _RouteTable::FromEmberBuffer(entry, src + entryOffset, 18); + } break; } case 0x003B: // SecurityPolicy @@ -764,10 +1305,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _SecurityPolicy _SecurityPolicy * entry = reinterpret_cast<_SecurityPolicy *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->RotationTime, write ? (uint8_t *) &entry->RotationTime : src, write, - &entryOffset, sizeof(entry->RotationTime)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->Flags, write ? (uint8_t *) &entry->Flags : src, write, &entryOffset, - sizeof(entry->Flags)); // INT8U + if (write) + { + size_t unusedLen; + _SecurityPolicy::ToEmberBuffer(entry, dest + entryOffset, 3, unusedLen); + } + else + { + _SecurityPolicy::FromEmberBuffer(entry, src + entryOffset, 3); + } break; } case 0x003D: // OperationalDatasetComponents @@ -781,37 +1327,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _OperationalDatasetComponents _OperationalDatasetComponents * entry = reinterpret_cast<_OperationalDatasetComponents *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->ActiveTimestampPresent, - write ? (uint8_t *) &entry->ActiveTimestampPresent : src, write, &entryOffset, - sizeof(entry->ActiveTimestampPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->PendingTimestampPresent, - write ? (uint8_t *) &entry->PendingTimestampPresent : src, write, &entryOffset, - sizeof(entry->PendingTimestampPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->MasterKeyPresent, write ? (uint8_t *) &entry->MasterKeyPresent : src, - write, &entryOffset, sizeof(entry->MasterKeyPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->NetworkNamePresent, - write ? (uint8_t *) &entry->NetworkNamePresent : src, write, &entryOffset, - sizeof(entry->NetworkNamePresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->ExtendedPanIdPresent, - write ? (uint8_t *) &entry->ExtendedPanIdPresent : src, write, &entryOffset, - sizeof(entry->ExtendedPanIdPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->MeshLocalPrefixPresent, - write ? (uint8_t *) &entry->MeshLocalPrefixPresent : src, write, &entryOffset, - sizeof(entry->MeshLocalPrefixPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->DelayPresent, write ? (uint8_t *) &entry->DelayPresent : src, write, - &entryOffset, sizeof(entry->DelayPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->PanIdPresent, write ? (uint8_t *) &entry->PanIdPresent : src, write, - &entryOffset, sizeof(entry->PanIdPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->ChannelPresent, write ? (uint8_t *) &entry->ChannelPresent : src, - write, &entryOffset, sizeof(entry->ChannelPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->PskcPresent, write ? (uint8_t *) &entry->PskcPresent : src, write, - &entryOffset, sizeof(entry->PskcPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->SecurityPolicyPresent, - write ? (uint8_t *) &entry->SecurityPolicyPresent : src, write, &entryOffset, - sizeof(entry->SecurityPolicyPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->ChannelMaskPresent, - write ? (uint8_t *) &entry->ChannelMaskPresent : src, write, &entryOffset, - sizeof(entry->ChannelMaskPresent)); // BOOLEAN + if (write) + { + size_t unusedLen; + _OperationalDatasetComponents::ToEmberBuffer(entry, dest + entryOffset, 12, unusedLen); + } + else + { + _OperationalDatasetComponents::FromEmberBuffer(entry, src + entryOffset, 12); + } break; } case 0x003E: // ActiveNetworkFaultsList 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 c9e51aa4b57e8b..3ebdfdb14f7ce3 100644 --- a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h +++ b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h @@ -1000,17 +1000,20 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ + /* 11130 - simple_struct, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ /* Endpoint: 1, Cluster: Electrical Measurement (server), big-endian */ \ \ - /* 11130 - measurement type, */ \ + /* 11146 - measurement type, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 11134 - total active power, */ \ + /* 11150 - total active power, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 2, Cluster: On/Off (server), big-endian */ \ \ - /* 11138 - FeatureMap, */ \ + /* 11154 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ } @@ -1991,23 +1994,26 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ + /* 11130 - simple_struct, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ /* Endpoint: 1, Cluster: Electrical Measurement (server), little-endian */ \ \ - /* 11130 - measurement type, */ \ + /* 11146 - measurement type, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 11134 - total active power, */ \ + /* 11150 - total active power, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 2, Cluster: On/Off (server), little-endian */ \ \ - /* 11138 - FeatureMap, */ \ + /* 11154 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ } #endif // BIGENDIAN_CPU -#define GENERATED_DEFAULTS_COUNT (130) +#define GENERATED_DEFAULTS_COUNT (131) #define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE #define ZAP_LONG_DEFAULTS_INDEX(index) \ @@ -2035,7 +2041,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 400 +#define GENERATED_ATTRIBUTE_COUNT 401 #define GENERATED_ATTRIBUTES \ { \ \ @@ -2542,12 +2548,13 @@ ZAP_LONG_DEFAULTS_INDEX(9120) }, /* long_octet_string */ \ { 0x001E, ZAP_TYPE(CHAR_STRING), 10, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(10120) }, /* char_string */ \ { 0x001F, ZAP_TYPE(LONG_CHAR_STRING), 1000, ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_LONG_DEFAULTS_INDEX(10130) }, /* long_char_string */ \ - { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ + ZAP_LONG_DEFAULTS_INDEX(10130) }, /* long_char_string */ \ + { 0x0020, ZAP_TYPE(SIMPLESTRUCT), 16, 0, ZAP_LONG_DEFAULTS_INDEX(11130) }, /* simple_struct */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Electrical Measurement (server) */ \ - { 0x0000, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(11130) }, /* measurement type */ \ - { 0x0304, ZAP_TYPE(INT32S), 4, 0, ZAP_LONG_DEFAULTS_INDEX(11134) }, /* total active power */ \ + { 0x0000, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(11146) }, /* measurement type */ \ + { 0x0304, ZAP_TYPE(INT32S), 4, 0, ZAP_LONG_DEFAULTS_INDEX(11150) }, /* total active power */ \ { 0x0505, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0xffff) }, /* rms voltage */ \ { 0x0506, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x8000) }, /* rms voltage min */ \ { 0x0507, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x8000) }, /* rms voltage max */ \ @@ -2568,7 +2575,7 @@ { 0x4001, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* OnTime */ \ { 0x4002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* OffWaitTime */ \ { 0x4003, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_EMPTY_DEFAULT() }, /* StartUpOnOff */ \ - { 0xFFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(11138) }, /* FeatureMap */ \ + { 0xFFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(11154) }, /* FeatureMap */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* ClusterRevision */ \ \ /* Endpoint: 2, Cluster: Occupancy Sensing (server) */ \ @@ -2818,22 +2825,22 @@ 0x050E, ZAP_ATTRIBUTE_INDEX(352), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Account Login (server) */ \ { \ - 0x050F, ZAP_ATTRIBUTE_INDEX(353), 23, 2589, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050F, ZAP_ATTRIBUTE_INDEX(353), 24, 2605, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Test Cluster (server) */ \ { \ - 0x0B04, ZAP_ATTRIBUTE_INDEX(376), 12, 28, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0B04, ZAP_ATTRIBUTE_INDEX(377), 12, 28, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Electrical Measurement (server) */ \ { \ - 0xF000, ZAP_ATTRIBUTE_INDEX(388), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0xF000, ZAP_ATTRIBUTE_INDEX(389), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Binding (server) */ \ { 0x0006, \ - ZAP_ATTRIBUTE_INDEX(389), \ + ZAP_ATTRIBUTE_INDEX(390), \ 7, \ 13, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayOnOffServer }, /* Endpoint: 2, Cluster: On/Off (server) */ \ { 0x0406, \ - ZAP_ATTRIBUTE_INDEX(396), \ + ZAP_ATTRIBUTE_INDEX(397), \ 4, \ 5, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -2845,7 +2852,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 16, 4280 }, { ZAP_CLUSTER_INDEX(16), 39, 7288 }, { ZAP_CLUSTER_INDEX(55), 2, 18 }, \ + { ZAP_CLUSTER_INDEX(0), 16, 4280 }, { ZAP_CLUSTER_INDEX(16), 39, 7304 }, { ZAP_CLUSTER_INDEX(55), 2, 18 }, \ } // Largest attribute size is needed for various buffers @@ -2855,7 +2862,7 @@ #define ATTRIBUTE_SINGLETONS_SIZE (1497) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (11586) +#define ATTRIBUTE_MAX_SIZE (11602) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (3) diff --git a/zzz_generated/app-common/app-common/zap-generated/af-structs.cpp b/zzz_generated/app-common/app-common/zap-generated/af-structs.cpp new file mode 100644 index 00000000000000..3ceb90bed64d16 --- /dev/null +++ b/zzz_generated/app-common/app-common/zap-generated/af-structs.cpp @@ -0,0 +1,6002 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// THIS FILE IS GENERATED BY ZAP + +#include "af-structs.h" +#include "enums.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// TODO: This still not resolves issue for lists inside struct, however, it resolves lists of structs. + +using namespace chip; +using namespace chip::app; +using namespace chip::app::List; + +// Struct for ApplicationLauncherApp +CHIP_ERROR _ApplicationLauncherApp::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _ApplicationLauncherApp & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.catalogVendorId)); + SuccessOrExit(err = writer.PutString(TLV::ContextTag(seq++), chip::Uint8::to_const_char(val.applicationId))); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _ApplicationLauncherApp::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _ApplicationLauncherApp & val = *reinterpret_cast<_ApplicationLauncherApp *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.catalogVendorId)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.GetDataPtr(val.applicationId)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _ApplicationLauncherApp::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _ApplicationLauncherApp & val = *reinterpret_cast<_ApplicationLauncherApp *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.catalogVendorId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.catalogVendorId), buf + offset, sizeof(val.catalogVendorId)); // INT16U + offset = static_cast(offset + sizeof(val.catalogVendorId)); + } + { + uint8_t len; + memcpy(&len, buf + offset, sizeof(len)); + val.applicationId = buf + offset; + offset = static_cast(offset + len + sizeof(len)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _ApplicationLauncherApp::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _ApplicationLauncherApp & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.catalogVendorId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.catalogVendorId), sizeof(val.catalogVendorId)); // INT16U + offset = static_cast(offset + sizeof(val.catalogVendorId)); + } + { + uint8_t stringLen = emberAfStringLength(val.applicationId); + VerifyOrReturnError(offset + stringLen + sizeof(stringLen) <= bufLength, CHIP_ERROR_NO_MEMORY); + emberAfCopyString(buf + offset, val.applicationId, bufLength - offset); + } + return CHIP_NO_ERROR; +} + +// Struct for AudioOutputInfo +CHIP_ERROR _AudioOutputInfo::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _AudioOutputInfo & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.index)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.outputType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.name)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _AudioOutputInfo::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _AudioOutputInfo & val = *reinterpret_cast<_AudioOutputInfo *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.index)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.outputType)); + break; + } + case 2: { + { + const uint8_t * data = nullptr; + ReturnErrorOnFailure(reader.GetDataPtr(data)); + val.name = chip::ByteSpan(data, reader.GetLength()); + } + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _AudioOutputInfo::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _AudioOutputInfo & val = *reinterpret_cast<_AudioOutputInfo *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.index) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.index), buf + offset, sizeof(val.index)); // INT8U + offset = static_cast(offset + sizeof(val.index)); + } + { + VerifyOrReturnError(offset + sizeof(val.outputType) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.outputType), buf + offset, sizeof(val.outputType)); // AudioOutputType + offset = static_cast(offset + sizeof(val.outputType)); + } + { + constexpr uint16_t kLengthSize = 2; + chip::ByteSpan & nameSpan = val.name; // OCTET_STRING + ReturnErrorOnFailure(ReadByteSpan(buf + offset, static_cast(bufLength - offset), &nameSpan)); + offset = static_cast(offset + kLengthSize + nameSpan.size()); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _AudioOutputInfo::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _AudioOutputInfo & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.index) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.index), sizeof(val.index)); // INT8U + offset = static_cast(offset + sizeof(val.index)); + } + { + VerifyOrReturnError(offset + sizeof(val.outputType) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.outputType), sizeof(val.outputType)); // AudioOutputType + offset = static_cast(offset + sizeof(val.outputType)); + } + { + constexpr uint16_t kLengthSize = 2; + const chip::ByteSpan & nameSpan = val.name; // OCTET_STRING + ReturnErrorOnFailure(WriteByteSpan(buf + offset, static_cast(bufLength - offset), &nameSpan)); + offset = static_cast(offset + kLengthSize + nameSpan.size()); + } + return CHIP_NO_ERROR; +} + +// Struct for BasicCommissioningInfoType +CHIP_ERROR _BasicCommissioningInfoType::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _BasicCommissioningInfoType & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.FailSafeExpiryLengthMs)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _BasicCommissioningInfoType::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _BasicCommissioningInfoType & val = *reinterpret_cast<_BasicCommissioningInfoType *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.FailSafeExpiryLengthMs)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _BasicCommissioningInfoType::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _BasicCommissioningInfoType & val = *reinterpret_cast<_BasicCommissioningInfoType *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.FailSafeExpiryLengthMs) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.FailSafeExpiryLengthMs), buf + offset, sizeof(val.FailSafeExpiryLengthMs)); // INT32U + offset = static_cast(offset + sizeof(val.FailSafeExpiryLengthMs)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _BasicCommissioningInfoType::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _BasicCommissioningInfoType & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.FailSafeExpiryLengthMs) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.FailSafeExpiryLengthMs), sizeof(val.FailSafeExpiryLengthMs)); // INT32U + offset = static_cast(offset + sizeof(val.FailSafeExpiryLengthMs)); + } + return CHIP_NO_ERROR; +} + +// Struct for ConfigureReportingRecord +CHIP_ERROR _ConfigureReportingRecord::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _ConfigureReportingRecord & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.direction)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.attributeId)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.attributeType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.minimumReportingInterval)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.maximumReportingInterval)); + SuccessOrExit(err = writer.PutNull(TLV::ContextTag(seq++))); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.timeoutPeriod)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _ConfigureReportingRecord::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _ConfigureReportingRecord & val = *reinterpret_cast<_ConfigureReportingRecord *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.direction)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.attributeId)); + break; + } + case 2: { + ReturnErrorOnFailure(reader.Get(val.attributeType)); + break; + } + case 3: { + ReturnErrorOnFailure(reader.Get(val.minimumReportingInterval)); + break; + } + case 4: { + ReturnErrorOnFailure(reader.Get(val.maximumReportingInterval)); + break; + } + case 5: { + // Nothing; + break; + } + case 6: { + ReturnErrorOnFailure(reader.Get(val.timeoutPeriod)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _ConfigureReportingRecord::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _ConfigureReportingRecord & val = *reinterpret_cast<_ConfigureReportingRecord *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.direction) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.direction), buf + offset, sizeof(val.direction)); // INT8U + offset = static_cast(offset + sizeof(val.direction)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.attributeId), buf + offset, sizeof(val.attributeId)); // ATTRIB_ID + offset = static_cast(offset + sizeof(val.attributeId)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeType) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.attributeType), buf + offset, sizeof(val.attributeType)); // INT8U + offset = static_cast(offset + sizeof(val.attributeType)); + } + { + VerifyOrReturnError(offset + sizeof(val.minimumReportingInterval) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.minimumReportingInterval), buf + offset, sizeof(val.minimumReportingInterval)); // INT16U + offset = static_cast(offset + sizeof(val.minimumReportingInterval)); + } + { + VerifyOrReturnError(offset + sizeof(val.maximumReportingInterval) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.maximumReportingInterval), buf + offset, sizeof(val.maximumReportingInterval)); // INT16U + offset = static_cast(offset + sizeof(val.maximumReportingInterval)); + } + { + VerifyOrReturnError(offset + sizeof(val.reportableChangeLocation) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.reportableChangeLocation), buf + offset, sizeof(val.reportableChangeLocation)); // NO_DATA + offset = static_cast(offset + sizeof(val.reportableChangeLocation)); + } + { + VerifyOrReturnError(offset + sizeof(val.timeoutPeriod) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.timeoutPeriod), buf + offset, sizeof(val.timeoutPeriod)); // INT16U + offset = static_cast(offset + sizeof(val.timeoutPeriod)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _ConfigureReportingRecord::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _ConfigureReportingRecord & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.direction) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.direction), sizeof(val.direction)); // INT8U + offset = static_cast(offset + sizeof(val.direction)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.attributeId), sizeof(val.attributeId)); // ATTRIB_ID + offset = static_cast(offset + sizeof(val.attributeId)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeType) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.attributeType), sizeof(val.attributeType)); // INT8U + offset = static_cast(offset + sizeof(val.attributeType)); + } + { + VerifyOrReturnError(offset + sizeof(val.minimumReportingInterval) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.minimumReportingInterval), sizeof(val.minimumReportingInterval)); // INT16U + offset = static_cast(offset + sizeof(val.minimumReportingInterval)); + } + { + VerifyOrReturnError(offset + sizeof(val.maximumReportingInterval) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.maximumReportingInterval), sizeof(val.maximumReportingInterval)); // INT16U + offset = static_cast(offset + sizeof(val.maximumReportingInterval)); + } + { + VerifyOrReturnError(offset + sizeof(val.reportableChangeLocation) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.reportableChangeLocation), sizeof(val.reportableChangeLocation)); // NO_DATA + offset = static_cast(offset + sizeof(val.reportableChangeLocation)); + } + { + VerifyOrReturnError(offset + sizeof(val.timeoutPeriod) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.timeoutPeriod), sizeof(val.timeoutPeriod)); // INT16U + offset = static_cast(offset + sizeof(val.timeoutPeriod)); + } + return CHIP_NO_ERROR; +} + +// Struct for ConfigureReportingStatusRecord +CHIP_ERROR _ConfigureReportingStatusRecord::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _ConfigureReportingStatusRecord & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.status)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.direction)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.attributeId)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _ConfigureReportingStatusRecord::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _ConfigureReportingStatusRecord & val = *reinterpret_cast<_ConfigureReportingStatusRecord *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.status)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.direction)); + break; + } + case 2: { + ReturnErrorOnFailure(reader.Get(val.attributeId)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _ConfigureReportingStatusRecord::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _ConfigureReportingStatusRecord & val = *reinterpret_cast<_ConfigureReportingStatusRecord *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.status) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.status), buf + offset, sizeof(val.status)); // Status + offset = static_cast(offset + sizeof(val.status)); + } + { + VerifyOrReturnError(offset + sizeof(val.direction) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.direction), buf + offset, sizeof(val.direction)); // INT8U + offset = static_cast(offset + sizeof(val.direction)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.attributeId), buf + offset, sizeof(val.attributeId)); // ATTRIB_ID + offset = static_cast(offset + sizeof(val.attributeId)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _ConfigureReportingStatusRecord::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _ConfigureReportingStatusRecord & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.status) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.status), sizeof(val.status)); // Status + offset = static_cast(offset + sizeof(val.status)); + } + { + VerifyOrReturnError(offset + sizeof(val.direction) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.direction), sizeof(val.direction)); // INT8U + offset = static_cast(offset + sizeof(val.direction)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.attributeId), sizeof(val.attributeId)); // ATTRIB_ID + offset = static_cast(offset + sizeof(val.attributeId)); + } + return CHIP_NO_ERROR; +} + +// Struct for ContentLaunchAdditionalInfo +CHIP_ERROR _ContentLaunchAdditionalInfo::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _ContentLaunchAdditionalInfo & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.PutString(TLV::ContextTag(seq++), chip::Uint8::to_const_char(val.name))); + SuccessOrExit(err = writer.PutString(TLV::ContextTag(seq++), chip::Uint8::to_const_char(val.value))); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _ContentLaunchAdditionalInfo::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _ContentLaunchAdditionalInfo & val = *reinterpret_cast<_ContentLaunchAdditionalInfo *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.GetDataPtr(val.name)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.GetDataPtr(val.value)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _ContentLaunchAdditionalInfo::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _ContentLaunchAdditionalInfo & val = *reinterpret_cast<_ContentLaunchAdditionalInfo *>(valPtr); + { + uint8_t len; + memcpy(&len, buf + offset, sizeof(len)); + val.name = buf + offset; + offset = static_cast(offset + len + sizeof(len)); + } + { + uint8_t len; + memcpy(&len, buf + offset, sizeof(len)); + val.value = buf + offset; + offset = static_cast(offset + len + sizeof(len)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _ContentLaunchAdditionalInfo::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _ContentLaunchAdditionalInfo & val = *reinterpret_cast(valPtr); + { + uint8_t stringLen = emberAfStringLength(val.name); + VerifyOrReturnError(offset + stringLen + sizeof(stringLen) <= bufLength, CHIP_ERROR_NO_MEMORY); + emberAfCopyString(buf + offset, val.name, bufLength - offset); + } + { + uint8_t stringLen = emberAfStringLength(val.value); + VerifyOrReturnError(offset + stringLen + sizeof(stringLen) <= bufLength, CHIP_ERROR_NO_MEMORY); + emberAfCopyString(buf + offset, val.value, bufLength - offset); + } + return CHIP_NO_ERROR; +} + +// Struct for ContentLaunchBrandingInformation +CHIP_ERROR _ContentLaunchBrandingInformation::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _ContentLaunchBrandingInformation & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.PutString(TLV::ContextTag(seq++), chip::Uint8::to_const_char(val.providerName))); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.background)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.logo)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.progressBar)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.splash)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.waterMark)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _ContentLaunchBrandingInformation::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _ContentLaunchBrandingInformation & val = *reinterpret_cast<_ContentLaunchBrandingInformation *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.GetDataPtr(val.providerName)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.background)); + break; + } + case 2: { + ReturnErrorOnFailure(reader.Get(val.logo)); + break; + } + case 3: { + ReturnErrorOnFailure(reader.Get(val.progressBar)); + break; + } + case 4: { + ReturnErrorOnFailure(reader.Get(val.splash)); + break; + } + case 5: { + ReturnErrorOnFailure(reader.Get(val.waterMark)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _ContentLaunchBrandingInformation::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _ContentLaunchBrandingInformation & val = *reinterpret_cast<_ContentLaunchBrandingInformation *>(valPtr); + { + uint8_t len; + memcpy(&len, buf + offset, sizeof(len)); + val.providerName = buf + offset; + offset = static_cast(offset + len + sizeof(len)); + } + { + VerifyOrReturnError(offset + sizeof(val.background) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.background), buf + offset, sizeof(val.background)); // INT8U + offset = static_cast(offset + sizeof(val.background)); + } + { + VerifyOrReturnError(offset + sizeof(val.logo) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.logo), buf + offset, sizeof(val.logo)); // INT8U + offset = static_cast(offset + sizeof(val.logo)); + } + { + VerifyOrReturnError(offset + sizeof(val.progressBar) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.progressBar), buf + offset, sizeof(val.progressBar)); // INT8U + offset = static_cast(offset + sizeof(val.progressBar)); + } + { + VerifyOrReturnError(offset + sizeof(val.splash) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.splash), buf + offset, sizeof(val.splash)); // INT8U + offset = static_cast(offset + sizeof(val.splash)); + } + { + VerifyOrReturnError(offset + sizeof(val.waterMark) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.waterMark), buf + offset, sizeof(val.waterMark)); // INT8U + offset = static_cast(offset + sizeof(val.waterMark)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _ContentLaunchBrandingInformation::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _ContentLaunchBrandingInformation & val = *reinterpret_cast(valPtr); + { + uint8_t stringLen = emberAfStringLength(val.providerName); + VerifyOrReturnError(offset + stringLen + sizeof(stringLen) <= bufLength, CHIP_ERROR_NO_MEMORY); + emberAfCopyString(buf + offset, val.providerName, bufLength - offset); + } + { + VerifyOrReturnError(offset + sizeof(val.background) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.background), sizeof(val.background)); // INT8U + offset = static_cast(offset + sizeof(val.background)); + } + { + VerifyOrReturnError(offset + sizeof(val.logo) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.logo), sizeof(val.logo)); // INT8U + offset = static_cast(offset + sizeof(val.logo)); + } + { + VerifyOrReturnError(offset + sizeof(val.progressBar) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.progressBar), sizeof(val.progressBar)); // INT8U + offset = static_cast(offset + sizeof(val.progressBar)); + } + { + VerifyOrReturnError(offset + sizeof(val.splash) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.splash), sizeof(val.splash)); // INT8U + offset = static_cast(offset + sizeof(val.splash)); + } + { + VerifyOrReturnError(offset + sizeof(val.waterMark) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.waterMark), sizeof(val.waterMark)); // INT8U + offset = static_cast(offset + sizeof(val.waterMark)); + } + return CHIP_NO_ERROR; +} + +// Struct for ContentLaunchDimension +CHIP_ERROR _ContentLaunchDimension::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _ContentLaunchDimension & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.PutString(TLV::ContextTag(seq++), chip::Uint8::to_const_char(val.width))); + SuccessOrExit(err = writer.PutString(TLV::ContextTag(seq++), chip::Uint8::to_const_char(val.height))); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.metric)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _ContentLaunchDimension::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _ContentLaunchDimension & val = *reinterpret_cast<_ContentLaunchDimension *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.GetDataPtr(val.width)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.GetDataPtr(val.height)); + break; + } + case 2: { + ReturnErrorOnFailure(reader.Get(val.metric)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _ContentLaunchDimension::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _ContentLaunchDimension & val = *reinterpret_cast<_ContentLaunchDimension *>(valPtr); + { + uint8_t len; + memcpy(&len, buf + offset, sizeof(len)); + val.width = buf + offset; + offset = static_cast(offset + len + sizeof(len)); + } + { + uint8_t len; + memcpy(&len, buf + offset, sizeof(len)); + val.height = buf + offset; + offset = static_cast(offset + len + sizeof(len)); + } + { + VerifyOrReturnError(offset + sizeof(val.metric) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.metric), buf + offset, sizeof(val.metric)); // ContentLaunchMetricType + offset = static_cast(offset + sizeof(val.metric)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _ContentLaunchDimension::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _ContentLaunchDimension & val = *reinterpret_cast(valPtr); + { + uint8_t stringLen = emberAfStringLength(val.width); + VerifyOrReturnError(offset + stringLen + sizeof(stringLen) <= bufLength, CHIP_ERROR_NO_MEMORY); + emberAfCopyString(buf + offset, val.width, bufLength - offset); + } + { + uint8_t stringLen = emberAfStringLength(val.height); + VerifyOrReturnError(offset + stringLen + sizeof(stringLen) <= bufLength, CHIP_ERROR_NO_MEMORY); + emberAfCopyString(buf + offset, val.height, bufLength - offset); + } + { + VerifyOrReturnError(offset + sizeof(val.metric) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.metric), sizeof(val.metric)); // ContentLaunchMetricType + offset = static_cast(offset + sizeof(val.metric)); + } + return CHIP_NO_ERROR; +} + +// Struct for ContentLaunchParamater +CHIP_ERROR _ContentLaunchParamater::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _ContentLaunchParamater & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.Type)); + SuccessOrExit(err = writer.PutString(TLV::ContextTag(seq++), chip::Uint8::to_const_char(val.Value))); + SuccessOrExit(err = writer.PutNull(TLV::ContextTag(seq++)) /* TODO: List inside struct is not implemented. */ + ); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _ContentLaunchParamater::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _ContentLaunchParamater & val = *reinterpret_cast<_ContentLaunchParamater *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.Type)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.GetDataPtr(val.Value)); + break; + } + case 2: { + ReturnErrorOnFailure(reader.GetDataPtr(val.ExternalIDList)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _ContentLaunchParamater::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _ContentLaunchParamater & val = *reinterpret_cast<_ContentLaunchParamater *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.Type) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.Type), buf + offset, sizeof(val.Type)); // ContentLaunchParameterEnum + offset = static_cast(offset + sizeof(val.Type)); + } + { + uint8_t len; + memcpy(&len, buf + offset, sizeof(len)); + val.Value = buf + offset; + offset = static_cast(offset + len + sizeof(len)); + } + { + VerifyOrReturnError(offset + sizeof(val.ExternalIDList) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.ExternalIDList), buf + offset, sizeof(val.ExternalIDList)); // ARRAY + offset = static_cast(offset + sizeof(val.ExternalIDList)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _ContentLaunchParamater::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _ContentLaunchParamater & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.Type) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.Type), sizeof(val.Type)); // ContentLaunchParameterEnum + offset = static_cast(offset + sizeof(val.Type)); + } + { + uint8_t stringLen = emberAfStringLength(val.Value); + VerifyOrReturnError(offset + stringLen + sizeof(stringLen) <= bufLength, CHIP_ERROR_NO_MEMORY); + emberAfCopyString(buf + offset, val.Value, bufLength - offset); + } + { + VerifyOrReturnError(offset + sizeof(val.ExternalIDList) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.ExternalIDList), sizeof(val.ExternalIDList)); // ARRAY + offset = static_cast(offset + sizeof(val.ExternalIDList)); + } + return CHIP_NO_ERROR; +} + +// Struct for ContentLaunchStyleInformation +CHIP_ERROR _ContentLaunchStyleInformation::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _ContentLaunchStyleInformation & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.PutString(TLV::ContextTag(seq++), chip::Uint8::to_const_char(val.imageUrl))); + SuccessOrExit(err = writer.PutString(TLV::ContextTag(seq++), chip::Uint8::to_const_char(val.color))); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.size)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _ContentLaunchStyleInformation::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _ContentLaunchStyleInformation & val = *reinterpret_cast<_ContentLaunchStyleInformation *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.GetDataPtr(val.imageUrl)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.GetDataPtr(val.color)); + break; + } + case 2: { + ReturnErrorOnFailure(reader.Get(val.size)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _ContentLaunchStyleInformation::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _ContentLaunchStyleInformation & val = *reinterpret_cast<_ContentLaunchStyleInformation *>(valPtr); + { + uint8_t len; + memcpy(&len, buf + offset, sizeof(len)); + val.imageUrl = buf + offset; + offset = static_cast(offset + len + sizeof(len)); + } + { + uint8_t len; + memcpy(&len, buf + offset, sizeof(len)); + val.color = buf + offset; + offset = static_cast(offset + len + sizeof(len)); + } + { + VerifyOrReturnError(offset + sizeof(val.size) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.size), buf + offset, sizeof(val.size)); // INT8U + offset = static_cast(offset + sizeof(val.size)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _ContentLaunchStyleInformation::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _ContentLaunchStyleInformation & val = *reinterpret_cast(valPtr); + { + uint8_t stringLen = emberAfStringLength(val.imageUrl); + VerifyOrReturnError(offset + stringLen + sizeof(stringLen) <= bufLength, CHIP_ERROR_NO_MEMORY); + emberAfCopyString(buf + offset, val.imageUrl, bufLength - offset); + } + { + uint8_t stringLen = emberAfStringLength(val.color); + VerifyOrReturnError(offset + stringLen + sizeof(stringLen) <= bufLength, CHIP_ERROR_NO_MEMORY); + emberAfCopyString(buf + offset, val.color, bufLength - offset); + } + { + VerifyOrReturnError(offset + sizeof(val.size) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.size), sizeof(val.size)); // INT8U + offset = static_cast(offset + sizeof(val.size)); + } + return CHIP_NO_ERROR; +} + +// Struct for DeviceType +CHIP_ERROR _DeviceType::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _DeviceType & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.type)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.revision)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _DeviceType::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _DeviceType & val = *reinterpret_cast<_DeviceType *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.type)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.revision)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _DeviceType::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _DeviceType & val = *reinterpret_cast<_DeviceType *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.type) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.type), buf + offset, sizeof(val.type)); // DEVTYPE_ID + offset = static_cast(offset + sizeof(val.type)); + } + { + VerifyOrReturnError(offset + sizeof(val.revision) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.revision), buf + offset, sizeof(val.revision)); // INT16U + offset = static_cast(offset + sizeof(val.revision)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _DeviceType::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _DeviceType & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.type) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.type), sizeof(val.type)); // DEVTYPE_ID + offset = static_cast(offset + sizeof(val.type)); + } + { + VerifyOrReturnError(offset + sizeof(val.revision) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.revision), sizeof(val.revision)); // INT16U + offset = static_cast(offset + sizeof(val.revision)); + } + return CHIP_NO_ERROR; +} + +// Struct for DiscoverAttributesInfoRecord +CHIP_ERROR _DiscoverAttributesInfoRecord::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _DiscoverAttributesInfoRecord & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.attributeId)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.attributeType)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _DiscoverAttributesInfoRecord::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _DiscoverAttributesInfoRecord & val = *reinterpret_cast<_DiscoverAttributesInfoRecord *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.attributeId)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.attributeType)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _DiscoverAttributesInfoRecord::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _DiscoverAttributesInfoRecord & val = *reinterpret_cast<_DiscoverAttributesInfoRecord *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.attributeId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.attributeId), buf + offset, sizeof(val.attributeId)); // ATTRIB_ID + offset = static_cast(offset + sizeof(val.attributeId)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeType) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.attributeType), buf + offset, sizeof(val.attributeType)); // INT8U + offset = static_cast(offset + sizeof(val.attributeType)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _DiscoverAttributesInfoRecord::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _DiscoverAttributesInfoRecord & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.attributeId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.attributeId), sizeof(val.attributeId)); // ATTRIB_ID + offset = static_cast(offset + sizeof(val.attributeId)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeType) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.attributeType), sizeof(val.attributeType)); // INT8U + offset = static_cast(offset + sizeof(val.attributeType)); + } + return CHIP_NO_ERROR; +} + +// Struct for ExtendedDiscoverAttributesInfoRecord +CHIP_ERROR _ExtendedDiscoverAttributesInfoRecord::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _ExtendedDiscoverAttributesInfoRecord & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.attributeId)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.attributeType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.attributeAccessControl)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _ExtendedDiscoverAttributesInfoRecord::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _ExtendedDiscoverAttributesInfoRecord & val = *reinterpret_cast<_ExtendedDiscoverAttributesInfoRecord *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.attributeId)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.attributeType)); + break; + } + case 2: { + ReturnErrorOnFailure(reader.Get(val.attributeAccessControl)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _ExtendedDiscoverAttributesInfoRecord::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _ExtendedDiscoverAttributesInfoRecord & val = *reinterpret_cast<_ExtendedDiscoverAttributesInfoRecord *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.attributeId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.attributeId), buf + offset, sizeof(val.attributeId)); // ATTRIB_ID + offset = static_cast(offset + sizeof(val.attributeId)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeType) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.attributeType), buf + offset, sizeof(val.attributeType)); // INT8U + offset = static_cast(offset + sizeof(val.attributeType)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeAccessControl) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.attributeAccessControl), buf + offset, sizeof(val.attributeAccessControl)); // INT8U + offset = static_cast(offset + sizeof(val.attributeAccessControl)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _ExtendedDiscoverAttributesInfoRecord::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _ExtendedDiscoverAttributesInfoRecord & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.attributeId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.attributeId), sizeof(val.attributeId)); // ATTRIB_ID + offset = static_cast(offset + sizeof(val.attributeId)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeType) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.attributeType), sizeof(val.attributeType)); // INT8U + offset = static_cast(offset + sizeof(val.attributeType)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeAccessControl) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.attributeAccessControl), sizeof(val.attributeAccessControl)); // INT8U + offset = static_cast(offset + sizeof(val.attributeAccessControl)); + } + return CHIP_NO_ERROR; +} + +// Struct for FabricDescriptor +CHIP_ERROR _FabricDescriptor::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _FabricDescriptor & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.FabricIndex)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.RootPublicKey)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.VendorId)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.FabricId)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.NodeId)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.Label)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _FabricDescriptor::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _FabricDescriptor & val = *reinterpret_cast<_FabricDescriptor *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.FabricIndex)); + break; + } + case 1: { + { + const uint8_t * data = nullptr; + ReturnErrorOnFailure(reader.GetDataPtr(data)); + val.RootPublicKey = chip::ByteSpan(data, reader.GetLength()); + } + break; + } + case 2: { + ReturnErrorOnFailure(reader.Get(val.VendorId)); + break; + } + case 3: { + ReturnErrorOnFailure(reader.Get(val.FabricId)); + break; + } + case 4: { + ReturnErrorOnFailure(reader.Get(val.NodeId)); + break; + } + case 5: { + { + const uint8_t * data = nullptr; + ReturnErrorOnFailure(reader.GetDataPtr(data)); + val.Label = chip::ByteSpan(data, reader.GetLength()); + } + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _FabricDescriptor::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _FabricDescriptor & val = *reinterpret_cast<_FabricDescriptor *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.FabricIndex) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.FabricIndex), buf + offset, sizeof(val.FabricIndex)); // INT8U + offset = static_cast(offset + sizeof(val.FabricIndex)); + } + { + constexpr uint16_t kLengthSize = 2; + chip::ByteSpan & RootPublicKeySpan = val.RootPublicKey; // OCTET_STRING + ReturnErrorOnFailure(ReadByteSpan(buf + offset, static_cast(bufLength - offset), &RootPublicKeySpan)); + offset = static_cast(offset + kLengthSize + RootPublicKeySpan.size()); + } + { + VerifyOrReturnError(offset + sizeof(val.VendorId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.VendorId), buf + offset, sizeof(val.VendorId)); // INT16U + offset = static_cast(offset + sizeof(val.VendorId)); + } + { + VerifyOrReturnError(offset + sizeof(val.FabricId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.FabricId), buf + offset, sizeof(val.FabricId)); // FABRIC_ID + offset = static_cast(offset + sizeof(val.FabricId)); + } + { + VerifyOrReturnError(offset + sizeof(val.NodeId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.NodeId), buf + offset, sizeof(val.NodeId)); // NODE_ID + offset = static_cast(offset + sizeof(val.NodeId)); + } + { + constexpr uint16_t kLengthSize = 2; + chip::ByteSpan & LabelSpan = val.Label; // OCTET_STRING + ReturnErrorOnFailure(ReadByteSpan(buf + offset, static_cast(bufLength - offset), &LabelSpan)); + offset = static_cast(offset + kLengthSize + LabelSpan.size()); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _FabricDescriptor::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _FabricDescriptor & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.FabricIndex) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.FabricIndex), sizeof(val.FabricIndex)); // INT8U + offset = static_cast(offset + sizeof(val.FabricIndex)); + } + { + constexpr uint16_t kLengthSize = 2; + const chip::ByteSpan & RootPublicKeySpan = val.RootPublicKey; // OCTET_STRING + ReturnErrorOnFailure(WriteByteSpan(buf + offset, static_cast(bufLength - offset), &RootPublicKeySpan)); + offset = static_cast(offset + kLengthSize + RootPublicKeySpan.size()); + } + { + VerifyOrReturnError(offset + sizeof(val.VendorId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.VendorId), sizeof(val.VendorId)); // INT16U + offset = static_cast(offset + sizeof(val.VendorId)); + } + { + VerifyOrReturnError(offset + sizeof(val.FabricId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.FabricId), sizeof(val.FabricId)); // FABRIC_ID + offset = static_cast(offset + sizeof(val.FabricId)); + } + { + VerifyOrReturnError(offset + sizeof(val.NodeId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.NodeId), sizeof(val.NodeId)); // NODE_ID + offset = static_cast(offset + sizeof(val.NodeId)); + } + { + constexpr uint16_t kLengthSize = 2; + const chip::ByteSpan & LabelSpan = val.Label; // OCTET_STRING + ReturnErrorOnFailure(WriteByteSpan(buf + offset, static_cast(bufLength - offset), &LabelSpan)); + offset = static_cast(offset + kLengthSize + LabelSpan.size()); + } + return CHIP_NO_ERROR; +} + +// Struct for GroupKey +CHIP_ERROR _GroupKey::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _GroupKey & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.VendorId)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.GroupKeyIndex)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.GroupKeyRoot)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.GroupKeyEpochStartTime)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.GroupKeySecurityPolicy)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _GroupKey::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _GroupKey & val = *reinterpret_cast<_GroupKey *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.VendorId)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.GroupKeyIndex)); + break; + } + case 2: { + { + const uint8_t * data = nullptr; + ReturnErrorOnFailure(reader.GetDataPtr(data)); + val.GroupKeyRoot = chip::ByteSpan(data, reader.GetLength()); + } + break; + } + case 3: { + ReturnErrorOnFailure(reader.Get(val.GroupKeyEpochStartTime)); + break; + } + case 4: { + ReturnErrorOnFailure(reader.Get(val.GroupKeySecurityPolicy)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _GroupKey::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _GroupKey & val = *reinterpret_cast<_GroupKey *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.VendorId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.VendorId), buf + offset, sizeof(val.VendorId)); // INT16U + offset = static_cast(offset + sizeof(val.VendorId)); + } + { + VerifyOrReturnError(offset + sizeof(val.GroupKeyIndex) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.GroupKeyIndex), buf + offset, sizeof(val.GroupKeyIndex)); // INT16U + offset = static_cast(offset + sizeof(val.GroupKeyIndex)); + } + { + constexpr uint16_t kLengthSize = 2; + chip::ByteSpan & GroupKeyRootSpan = val.GroupKeyRoot; // OCTET_STRING + ReturnErrorOnFailure(ReadByteSpan(buf + offset, static_cast(bufLength - offset), &GroupKeyRootSpan)); + offset = static_cast(offset + kLengthSize + GroupKeyRootSpan.size()); + } + { + VerifyOrReturnError(offset + sizeof(val.GroupKeyEpochStartTime) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.GroupKeyEpochStartTime), buf + offset, sizeof(val.GroupKeyEpochStartTime)); // INT64U + offset = static_cast(offset + sizeof(val.GroupKeyEpochStartTime)); + } + { + VerifyOrReturnError(offset + sizeof(val.GroupKeySecurityPolicy) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.GroupKeySecurityPolicy), buf + offset, + sizeof(val.GroupKeySecurityPolicy)); // GroupKeySecurityPolicy + offset = static_cast(offset + sizeof(val.GroupKeySecurityPolicy)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _GroupKey::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _GroupKey & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.VendorId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.VendorId), sizeof(val.VendorId)); // INT16U + offset = static_cast(offset + sizeof(val.VendorId)); + } + { + VerifyOrReturnError(offset + sizeof(val.GroupKeyIndex) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.GroupKeyIndex), sizeof(val.GroupKeyIndex)); // INT16U + offset = static_cast(offset + sizeof(val.GroupKeyIndex)); + } + { + constexpr uint16_t kLengthSize = 2; + const chip::ByteSpan & GroupKeyRootSpan = val.GroupKeyRoot; // OCTET_STRING + ReturnErrorOnFailure(WriteByteSpan(buf + offset, static_cast(bufLength - offset), &GroupKeyRootSpan)); + offset = static_cast(offset + kLengthSize + GroupKeyRootSpan.size()); + } + { + VerifyOrReturnError(offset + sizeof(val.GroupKeyEpochStartTime) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.GroupKeyEpochStartTime), sizeof(val.GroupKeyEpochStartTime)); // INT64U + offset = static_cast(offset + sizeof(val.GroupKeyEpochStartTime)); + } + { + VerifyOrReturnError(offset + sizeof(val.GroupKeySecurityPolicy) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.GroupKeySecurityPolicy), + sizeof(val.GroupKeySecurityPolicy)); // GroupKeySecurityPolicy + offset = static_cast(offset + sizeof(val.GroupKeySecurityPolicy)); + } + return CHIP_NO_ERROR; +} + +// Struct for GroupState +CHIP_ERROR _GroupState::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _GroupState & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.VendorId)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.VendorGroupId)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.GroupKeySetIndex)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _GroupState::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _GroupState & val = *reinterpret_cast<_GroupState *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.VendorId)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.VendorGroupId)); + break; + } + case 2: { + ReturnErrorOnFailure(reader.Get(val.GroupKeySetIndex)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _GroupState::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _GroupState & val = *reinterpret_cast<_GroupState *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.VendorId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.VendorId), buf + offset, sizeof(val.VendorId)); // INT16U + offset = static_cast(offset + sizeof(val.VendorId)); + } + { + VerifyOrReturnError(offset + sizeof(val.VendorGroupId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.VendorGroupId), buf + offset, sizeof(val.VendorGroupId)); // INT16U + offset = static_cast(offset + sizeof(val.VendorGroupId)); + } + { + VerifyOrReturnError(offset + sizeof(val.GroupKeySetIndex) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.GroupKeySetIndex), buf + offset, sizeof(val.GroupKeySetIndex)); // INT16U + offset = static_cast(offset + sizeof(val.GroupKeySetIndex)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _GroupState::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _GroupState & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.VendorId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.VendorId), sizeof(val.VendorId)); // INT16U + offset = static_cast(offset + sizeof(val.VendorId)); + } + { + VerifyOrReturnError(offset + sizeof(val.VendorGroupId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.VendorGroupId), sizeof(val.VendorGroupId)); // INT16U + offset = static_cast(offset + sizeof(val.VendorGroupId)); + } + { + VerifyOrReturnError(offset + sizeof(val.GroupKeySetIndex) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.GroupKeySetIndex), sizeof(val.GroupKeySetIndex)); // INT16U + offset = static_cast(offset + sizeof(val.GroupKeySetIndex)); + } + return CHIP_NO_ERROR; +} + +// Struct for IasAceZoneStatusResult +CHIP_ERROR _IasAceZoneStatusResult::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _IasAceZoneStatusResult & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.zoneId)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.zoneStatus)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _IasAceZoneStatusResult::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _IasAceZoneStatusResult & val = *reinterpret_cast<_IasAceZoneStatusResult *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.zoneId)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.zoneStatus)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _IasAceZoneStatusResult::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _IasAceZoneStatusResult & val = *reinterpret_cast<_IasAceZoneStatusResult *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.zoneId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.zoneId), buf + offset, sizeof(val.zoneId)); // INT8U + offset = static_cast(offset + sizeof(val.zoneId)); + } + { + VerifyOrReturnError(offset + sizeof(val.zoneStatus) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.zoneStatus), buf + offset, sizeof(val.zoneStatus)); // IasZoneStatus + offset = static_cast(offset + sizeof(val.zoneStatus)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _IasAceZoneStatusResult::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _IasAceZoneStatusResult & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.zoneId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.zoneId), sizeof(val.zoneId)); // INT8U + offset = static_cast(offset + sizeof(val.zoneId)); + } + { + VerifyOrReturnError(offset + sizeof(val.zoneStatus) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.zoneStatus), sizeof(val.zoneStatus)); // IasZoneStatus + offset = static_cast(offset + sizeof(val.zoneStatus)); + } + return CHIP_NO_ERROR; +} + +// Struct for LabelStruct +CHIP_ERROR _LabelStruct::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _LabelStruct & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.label)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.value)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _LabelStruct::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _LabelStruct & val = *reinterpret_cast<_LabelStruct *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + { + const uint8_t * data = nullptr; + ReturnErrorOnFailure(reader.GetDataPtr(data)); + val.label = chip::ByteSpan(data, reader.GetLength()); + } + break; + } + case 1: { + { + const uint8_t * data = nullptr; + ReturnErrorOnFailure(reader.GetDataPtr(data)); + val.value = chip::ByteSpan(data, reader.GetLength()); + } + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _LabelStruct::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _LabelStruct & val = *reinterpret_cast<_LabelStruct *>(valPtr); + { + constexpr uint16_t kLengthSize = 2; + chip::ByteSpan & labelSpan = val.label; // OCTET_STRING + ReturnErrorOnFailure(ReadByteSpan(buf + offset, static_cast(bufLength - offset), &labelSpan)); + offset = static_cast(offset + kLengthSize + labelSpan.size()); + } + { + constexpr uint16_t kLengthSize = 2; + chip::ByteSpan & valueSpan = val.value; // OCTET_STRING + ReturnErrorOnFailure(ReadByteSpan(buf + offset, static_cast(bufLength - offset), &valueSpan)); + offset = static_cast(offset + kLengthSize + valueSpan.size()); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _LabelStruct::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _LabelStruct & val = *reinterpret_cast(valPtr); + { + constexpr uint16_t kLengthSize = 2; + const chip::ByteSpan & labelSpan = val.label; // OCTET_STRING + ReturnErrorOnFailure(WriteByteSpan(buf + offset, static_cast(bufLength - offset), &labelSpan)); + offset = static_cast(offset + kLengthSize + labelSpan.size()); + } + { + constexpr uint16_t kLengthSize = 2; + const chip::ByteSpan & valueSpan = val.value; // OCTET_STRING + ReturnErrorOnFailure(WriteByteSpan(buf + offset, static_cast(bufLength - offset), &valueSpan)); + offset = static_cast(offset + kLengthSize + valueSpan.size()); + } + return CHIP_NO_ERROR; +} + +// Struct for MediaInputInfo +CHIP_ERROR _MediaInputInfo::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _MediaInputInfo & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.index)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.inputType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.name)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.description)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _MediaInputInfo::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _MediaInputInfo & val = *reinterpret_cast<_MediaInputInfo *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.index)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.inputType)); + break; + } + case 2: { + { + const uint8_t * data = nullptr; + ReturnErrorOnFailure(reader.GetDataPtr(data)); + val.name = chip::ByteSpan(data, reader.GetLength()); + } + break; + } + case 3: { + { + const uint8_t * data = nullptr; + ReturnErrorOnFailure(reader.GetDataPtr(data)); + val.description = chip::ByteSpan(data, reader.GetLength()); + } + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _MediaInputInfo::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _MediaInputInfo & val = *reinterpret_cast<_MediaInputInfo *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.index) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.index), buf + offset, sizeof(val.index)); // INT8U + offset = static_cast(offset + sizeof(val.index)); + } + { + VerifyOrReturnError(offset + sizeof(val.inputType) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.inputType), buf + offset, sizeof(val.inputType)); // MediaInputType + offset = static_cast(offset + sizeof(val.inputType)); + } + { + constexpr uint16_t kLengthSize = 2; + chip::ByteSpan & nameSpan = val.name; // OCTET_STRING + ReturnErrorOnFailure(ReadByteSpan(buf + offset, static_cast(bufLength - offset), &nameSpan)); + offset = static_cast(offset + kLengthSize + nameSpan.size()); + } + { + constexpr uint16_t kLengthSize = 2; + chip::ByteSpan & descriptionSpan = val.description; // OCTET_STRING + ReturnErrorOnFailure(ReadByteSpan(buf + offset, static_cast(bufLength - offset), &descriptionSpan)); + offset = static_cast(offset + kLengthSize + descriptionSpan.size()); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _MediaInputInfo::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _MediaInputInfo & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.index) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.index), sizeof(val.index)); // INT8U + offset = static_cast(offset + sizeof(val.index)); + } + { + VerifyOrReturnError(offset + sizeof(val.inputType) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.inputType), sizeof(val.inputType)); // MediaInputType + offset = static_cast(offset + sizeof(val.inputType)); + } + { + constexpr uint16_t kLengthSize = 2; + const chip::ByteSpan & nameSpan = val.name; // OCTET_STRING + ReturnErrorOnFailure(WriteByteSpan(buf + offset, static_cast(bufLength - offset), &nameSpan)); + offset = static_cast(offset + kLengthSize + nameSpan.size()); + } + { + constexpr uint16_t kLengthSize = 2; + const chip::ByteSpan & descriptionSpan = val.description; // OCTET_STRING + ReturnErrorOnFailure(WriteByteSpan(buf + offset, static_cast(bufLength - offset), &descriptionSpan)); + offset = static_cast(offset + kLengthSize + descriptionSpan.size()); + } + return CHIP_NO_ERROR; +} + +// Struct for MediaPlaybackPosition +CHIP_ERROR _MediaPlaybackPosition::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _MediaPlaybackPosition & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.updatedAt)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.position)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _MediaPlaybackPosition::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _MediaPlaybackPosition & val = *reinterpret_cast<_MediaPlaybackPosition *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.updatedAt)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.position)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _MediaPlaybackPosition::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _MediaPlaybackPosition & val = *reinterpret_cast<_MediaPlaybackPosition *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.updatedAt) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.updatedAt), buf + offset, sizeof(val.updatedAt)); // INT64U + offset = static_cast(offset + sizeof(val.updatedAt)); + } + { + VerifyOrReturnError(offset + sizeof(val.position) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.position), buf + offset, sizeof(val.position)); // INT64U + offset = static_cast(offset + sizeof(val.position)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _MediaPlaybackPosition::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _MediaPlaybackPosition & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.updatedAt) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.updatedAt), sizeof(val.updatedAt)); // INT64U + offset = static_cast(offset + sizeof(val.updatedAt)); + } + { + VerifyOrReturnError(offset + sizeof(val.position) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.position), sizeof(val.position)); // INT64U + offset = static_cast(offset + sizeof(val.position)); + } + return CHIP_NO_ERROR; +} + +// Struct for NOCStruct +CHIP_ERROR _NOCStruct::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _NOCStruct & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.FabricIndex)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.NOC)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _NOCStruct::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _NOCStruct & val = *reinterpret_cast<_NOCStruct *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.FabricIndex)); + break; + } + case 1: { + { + const uint8_t * data = nullptr; + ReturnErrorOnFailure(reader.GetDataPtr(data)); + val.NOC = chip::ByteSpan(data, reader.GetLength()); + } + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _NOCStruct::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _NOCStruct & val = *reinterpret_cast<_NOCStruct *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.FabricIndex) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.FabricIndex), buf + offset, sizeof(val.FabricIndex)); // INT8U + offset = static_cast(offset + sizeof(val.FabricIndex)); + } + { + constexpr uint16_t kLengthSize = 2; + chip::ByteSpan & NOCSpan = val.NOC; // OCTET_STRING + ReturnErrorOnFailure(ReadByteSpan(buf + offset, static_cast(bufLength - offset), &NOCSpan)); + offset = static_cast(offset + kLengthSize + NOCSpan.size()); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _NOCStruct::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _NOCStruct & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.FabricIndex) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.FabricIndex), sizeof(val.FabricIndex)); // INT8U + offset = static_cast(offset + sizeof(val.FabricIndex)); + } + { + constexpr uint16_t kLengthSize = 2; + const chip::ByteSpan & NOCSpan = val.NOC; // OCTET_STRING + ReturnErrorOnFailure(WriteByteSpan(buf + offset, static_cast(bufLength - offset), &NOCSpan)); + offset = static_cast(offset + kLengthSize + NOCSpan.size()); + } + return CHIP_NO_ERROR; +} + +// Struct for NavigateTargetTargetInfo +CHIP_ERROR _NavigateTargetTargetInfo::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _NavigateTargetTargetInfo & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.identifier)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.name)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _NavigateTargetTargetInfo::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _NavigateTargetTargetInfo & val = *reinterpret_cast<_NavigateTargetTargetInfo *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.identifier)); + break; + } + case 1: { + { + const uint8_t * data = nullptr; + ReturnErrorOnFailure(reader.GetDataPtr(data)); + val.name = chip::ByteSpan(data, reader.GetLength()); + } + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _NavigateTargetTargetInfo::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _NavigateTargetTargetInfo & val = *reinterpret_cast<_NavigateTargetTargetInfo *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.identifier) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.identifier), buf + offset, sizeof(val.identifier)); // INT8U + offset = static_cast(offset + sizeof(val.identifier)); + } + { + constexpr uint16_t kLengthSize = 2; + chip::ByteSpan & nameSpan = val.name; // OCTET_STRING + ReturnErrorOnFailure(ReadByteSpan(buf + offset, static_cast(bufLength - offset), &nameSpan)); + offset = static_cast(offset + kLengthSize + nameSpan.size()); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _NavigateTargetTargetInfo::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _NavigateTargetTargetInfo & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.identifier) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.identifier), sizeof(val.identifier)); // INT8U + offset = static_cast(offset + sizeof(val.identifier)); + } + { + constexpr uint16_t kLengthSize = 2; + const chip::ByteSpan & nameSpan = val.name; // OCTET_STRING + ReturnErrorOnFailure(WriteByteSpan(buf + offset, static_cast(bufLength - offset), &nameSpan)); + offset = static_cast(offset + kLengthSize + nameSpan.size()); + } + return CHIP_NO_ERROR; +} + +// Struct for NeighborTable +CHIP_ERROR _NeighborTable::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _NeighborTable & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.ExtAddress)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.Age)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.Rloc16)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.LinkFrameCounter)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.MleFrameCounter)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.LQI)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.AverageRssi)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.LastRssi)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.FrameErrorRate)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.MessageErrorRate)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.RxOnWhenIdle)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.FullThreadDevice)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.FullNetworkData)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.IsChild)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _NeighborTable::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _NeighborTable & val = *reinterpret_cast<_NeighborTable *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.ExtAddress)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.Age)); + break; + } + case 2: { + ReturnErrorOnFailure(reader.Get(val.Rloc16)); + break; + } + case 3: { + ReturnErrorOnFailure(reader.Get(val.LinkFrameCounter)); + break; + } + case 4: { + ReturnErrorOnFailure(reader.Get(val.MleFrameCounter)); + break; + } + case 5: { + ReturnErrorOnFailure(reader.Get(val.LQI)); + break; + } + case 6: { + ReturnErrorOnFailure(reader.Get(val.AverageRssi)); + break; + } + case 7: { + ReturnErrorOnFailure(reader.Get(val.LastRssi)); + break; + } + case 8: { + ReturnErrorOnFailure(reader.Get(val.FrameErrorRate)); + break; + } + case 9: { + ReturnErrorOnFailure(reader.Get(val.MessageErrorRate)); + break; + } + case 10: { + ReturnErrorOnFailure(reader.Get(val.RxOnWhenIdle)); + break; + } + case 11: { + ReturnErrorOnFailure(reader.Get(val.FullThreadDevice)); + break; + } + case 12: { + ReturnErrorOnFailure(reader.Get(val.FullNetworkData)); + break; + } + case 13: { + ReturnErrorOnFailure(reader.Get(val.IsChild)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _NeighborTable::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _NeighborTable & val = *reinterpret_cast<_NeighborTable *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.ExtAddress) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.ExtAddress), buf + offset, sizeof(val.ExtAddress)); // INT64U + offset = static_cast(offset + sizeof(val.ExtAddress)); + } + { + VerifyOrReturnError(offset + sizeof(val.Age) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.Age), buf + offset, sizeof(val.Age)); // INT32U + offset = static_cast(offset + sizeof(val.Age)); + } + { + VerifyOrReturnError(offset + sizeof(val.Rloc16) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.Rloc16), buf + offset, sizeof(val.Rloc16)); // INT16U + offset = static_cast(offset + sizeof(val.Rloc16)); + } + { + VerifyOrReturnError(offset + sizeof(val.LinkFrameCounter) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.LinkFrameCounter), buf + offset, sizeof(val.LinkFrameCounter)); // INT32U + offset = static_cast(offset + sizeof(val.LinkFrameCounter)); + } + { + VerifyOrReturnError(offset + sizeof(val.MleFrameCounter) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.MleFrameCounter), buf + offset, sizeof(val.MleFrameCounter)); // INT32U + offset = static_cast(offset + sizeof(val.MleFrameCounter)); + } + { + VerifyOrReturnError(offset + sizeof(val.LQI) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.LQI), buf + offset, sizeof(val.LQI)); // INT8U + offset = static_cast(offset + sizeof(val.LQI)); + } + { + VerifyOrReturnError(offset + sizeof(val.AverageRssi) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.AverageRssi), buf + offset, sizeof(val.AverageRssi)); // INT8S + offset = static_cast(offset + sizeof(val.AverageRssi)); + } + { + VerifyOrReturnError(offset + sizeof(val.LastRssi) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.LastRssi), buf + offset, sizeof(val.LastRssi)); // INT8S + offset = static_cast(offset + sizeof(val.LastRssi)); + } + { + VerifyOrReturnError(offset + sizeof(val.FrameErrorRate) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.FrameErrorRate), buf + offset, sizeof(val.FrameErrorRate)); // INT8U + offset = static_cast(offset + sizeof(val.FrameErrorRate)); + } + { + VerifyOrReturnError(offset + sizeof(val.MessageErrorRate) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.MessageErrorRate), buf + offset, sizeof(val.MessageErrorRate)); // INT8U + offset = static_cast(offset + sizeof(val.MessageErrorRate)); + } + { + VerifyOrReturnError(offset + sizeof(val.RxOnWhenIdle) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.RxOnWhenIdle), buf + offset, sizeof(val.RxOnWhenIdle)); // BOOLEAN + offset = static_cast(offset + sizeof(val.RxOnWhenIdle)); + } + { + VerifyOrReturnError(offset + sizeof(val.FullThreadDevice) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.FullThreadDevice), buf + offset, sizeof(val.FullThreadDevice)); // BOOLEAN + offset = static_cast(offset + sizeof(val.FullThreadDevice)); + } + { + VerifyOrReturnError(offset + sizeof(val.FullNetworkData) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.FullNetworkData), buf + offset, sizeof(val.FullNetworkData)); // BOOLEAN + offset = static_cast(offset + sizeof(val.FullNetworkData)); + } + { + VerifyOrReturnError(offset + sizeof(val.IsChild) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.IsChild), buf + offset, sizeof(val.IsChild)); // BOOLEAN + offset = static_cast(offset + sizeof(val.IsChild)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _NeighborTable::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _NeighborTable & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.ExtAddress) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.ExtAddress), sizeof(val.ExtAddress)); // INT64U + offset = static_cast(offset + sizeof(val.ExtAddress)); + } + { + VerifyOrReturnError(offset + sizeof(val.Age) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.Age), sizeof(val.Age)); // INT32U + offset = static_cast(offset + sizeof(val.Age)); + } + { + VerifyOrReturnError(offset + sizeof(val.Rloc16) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.Rloc16), sizeof(val.Rloc16)); // INT16U + offset = static_cast(offset + sizeof(val.Rloc16)); + } + { + VerifyOrReturnError(offset + sizeof(val.LinkFrameCounter) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.LinkFrameCounter), sizeof(val.LinkFrameCounter)); // INT32U + offset = static_cast(offset + sizeof(val.LinkFrameCounter)); + } + { + VerifyOrReturnError(offset + sizeof(val.MleFrameCounter) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.MleFrameCounter), sizeof(val.MleFrameCounter)); // INT32U + offset = static_cast(offset + sizeof(val.MleFrameCounter)); + } + { + VerifyOrReturnError(offset + sizeof(val.LQI) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.LQI), sizeof(val.LQI)); // INT8U + offset = static_cast(offset + sizeof(val.LQI)); + } + { + VerifyOrReturnError(offset + sizeof(val.AverageRssi) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.AverageRssi), sizeof(val.AverageRssi)); // INT8S + offset = static_cast(offset + sizeof(val.AverageRssi)); + } + { + VerifyOrReturnError(offset + sizeof(val.LastRssi) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.LastRssi), sizeof(val.LastRssi)); // INT8S + offset = static_cast(offset + sizeof(val.LastRssi)); + } + { + VerifyOrReturnError(offset + sizeof(val.FrameErrorRate) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.FrameErrorRate), sizeof(val.FrameErrorRate)); // INT8U + offset = static_cast(offset + sizeof(val.FrameErrorRate)); + } + { + VerifyOrReturnError(offset + sizeof(val.MessageErrorRate) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.MessageErrorRate), sizeof(val.MessageErrorRate)); // INT8U + offset = static_cast(offset + sizeof(val.MessageErrorRate)); + } + { + VerifyOrReturnError(offset + sizeof(val.RxOnWhenIdle) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.RxOnWhenIdle), sizeof(val.RxOnWhenIdle)); // BOOLEAN + offset = static_cast(offset + sizeof(val.RxOnWhenIdle)); + } + { + VerifyOrReturnError(offset + sizeof(val.FullThreadDevice) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.FullThreadDevice), sizeof(val.FullThreadDevice)); // BOOLEAN + offset = static_cast(offset + sizeof(val.FullThreadDevice)); + } + { + VerifyOrReturnError(offset + sizeof(val.FullNetworkData) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.FullNetworkData), sizeof(val.FullNetworkData)); // BOOLEAN + offset = static_cast(offset + sizeof(val.FullNetworkData)); + } + { + VerifyOrReturnError(offset + sizeof(val.IsChild) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.IsChild), sizeof(val.IsChild)); // BOOLEAN + offset = static_cast(offset + sizeof(val.IsChild)); + } + return CHIP_NO_ERROR; +} + +// Struct for NetworkInterfaceType +CHIP_ERROR _NetworkInterfaceType::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _NetworkInterfaceType & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.Name)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.FabricConnected)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.OffPremiseServicesReachableIPv4)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.OffPremiseServicesReachableIPv6)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.HardwareAddress)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.Type)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _NetworkInterfaceType::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _NetworkInterfaceType & val = *reinterpret_cast<_NetworkInterfaceType *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + { + const uint8_t * data = nullptr; + ReturnErrorOnFailure(reader.GetDataPtr(data)); + val.Name = chip::ByteSpan(data, reader.GetLength()); + } + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.FabricConnected)); + break; + } + case 2: { + ReturnErrorOnFailure(reader.Get(val.OffPremiseServicesReachableIPv4)); + break; + } + case 3: { + ReturnErrorOnFailure(reader.Get(val.OffPremiseServicesReachableIPv6)); + break; + } + case 4: { + { + const uint8_t * data = nullptr; + ReturnErrorOnFailure(reader.GetDataPtr(data)); + val.HardwareAddress = chip::ByteSpan(data, reader.GetLength()); + } + break; + } + case 5: { + ReturnErrorOnFailure(reader.Get(val.Type)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _NetworkInterfaceType::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _NetworkInterfaceType & val = *reinterpret_cast<_NetworkInterfaceType *>(valPtr); + { + constexpr uint16_t kLengthSize = 2; + chip::ByteSpan & NameSpan = val.Name; // OCTET_STRING + ReturnErrorOnFailure(ReadByteSpan(buf + offset, static_cast(bufLength - offset), &NameSpan)); + offset = static_cast(offset + kLengthSize + NameSpan.size()); + } + { + VerifyOrReturnError(offset + sizeof(val.FabricConnected) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.FabricConnected), buf + offset, sizeof(val.FabricConnected)); // BOOLEAN + offset = static_cast(offset + sizeof(val.FabricConnected)); + } + { + VerifyOrReturnError(offset + sizeof(val.OffPremiseServicesReachableIPv4) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.OffPremiseServicesReachableIPv4), buf + offset, + sizeof(val.OffPremiseServicesReachableIPv4)); // BOOLEAN + offset = static_cast(offset + sizeof(val.OffPremiseServicesReachableIPv4)); + } + { + VerifyOrReturnError(offset + sizeof(val.OffPremiseServicesReachableIPv6) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.OffPremiseServicesReachableIPv6), buf + offset, + sizeof(val.OffPremiseServicesReachableIPv6)); // BOOLEAN + offset = static_cast(offset + sizeof(val.OffPremiseServicesReachableIPv6)); + } + { + constexpr uint16_t kLengthSize = 2; + chip::ByteSpan & HardwareAddressSpan = val.HardwareAddress; // OCTET_STRING + ReturnErrorOnFailure(ReadByteSpan(buf + offset, static_cast(bufLength - offset), &HardwareAddressSpan)); + offset = static_cast(offset + kLengthSize + HardwareAddressSpan.size()); + } + { + VerifyOrReturnError(offset + sizeof(val.Type) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.Type), buf + offset, sizeof(val.Type)); // ENUM8 + offset = static_cast(offset + sizeof(val.Type)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _NetworkInterfaceType::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _NetworkInterfaceType & val = *reinterpret_cast(valPtr); + { + constexpr uint16_t kLengthSize = 2; + const chip::ByteSpan & NameSpan = val.Name; // OCTET_STRING + ReturnErrorOnFailure(WriteByteSpan(buf + offset, static_cast(bufLength - offset), &NameSpan)); + offset = static_cast(offset + kLengthSize + NameSpan.size()); + } + { + VerifyOrReturnError(offset + sizeof(val.FabricConnected) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.FabricConnected), sizeof(val.FabricConnected)); // BOOLEAN + offset = static_cast(offset + sizeof(val.FabricConnected)); + } + { + VerifyOrReturnError(offset + sizeof(val.OffPremiseServicesReachableIPv4) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.OffPremiseServicesReachableIPv4), + sizeof(val.OffPremiseServicesReachableIPv4)); // BOOLEAN + offset = static_cast(offset + sizeof(val.OffPremiseServicesReachableIPv4)); + } + { + VerifyOrReturnError(offset + sizeof(val.OffPremiseServicesReachableIPv6) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.OffPremiseServicesReachableIPv6), + sizeof(val.OffPremiseServicesReachableIPv6)); // BOOLEAN + offset = static_cast(offset + sizeof(val.OffPremiseServicesReachableIPv6)); + } + { + constexpr uint16_t kLengthSize = 2; + const chip::ByteSpan & HardwareAddressSpan = val.HardwareAddress; // OCTET_STRING + ReturnErrorOnFailure(WriteByteSpan(buf + offset, static_cast(bufLength - offset), &HardwareAddressSpan)); + offset = static_cast(offset + kLengthSize + HardwareAddressSpan.size()); + } + { + VerifyOrReturnError(offset + sizeof(val.Type) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.Type), sizeof(val.Type)); // ENUM8 + offset = static_cast(offset + sizeof(val.Type)); + } + return CHIP_NO_ERROR; +} + +// Struct for Notification +CHIP_ERROR _Notification::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _Notification & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.contentId)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.statusFeedback)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _Notification::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _Notification & val = *reinterpret_cast<_Notification *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.contentId)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.statusFeedback)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _Notification::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _Notification & val = *reinterpret_cast<_Notification *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.contentId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.contentId), buf + offset, sizeof(val.contentId)); // INT16U + offset = static_cast(offset + sizeof(val.contentId)); + } + { + VerifyOrReturnError(offset + sizeof(val.statusFeedback) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.statusFeedback), buf + offset, sizeof(val.statusFeedback)); // Status + offset = static_cast(offset + sizeof(val.statusFeedback)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _Notification::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _Notification & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.contentId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.contentId), sizeof(val.contentId)); // INT16U + offset = static_cast(offset + sizeof(val.contentId)); + } + { + VerifyOrReturnError(offset + sizeof(val.statusFeedback) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.statusFeedback), sizeof(val.statusFeedback)); // Status + offset = static_cast(offset + sizeof(val.statusFeedback)); + } + return CHIP_NO_ERROR; +} + +// Struct for OperationalDatasetComponents +CHIP_ERROR _OperationalDatasetComponents::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _OperationalDatasetComponents & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.ActiveTimestampPresent)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.PendingTimestampPresent)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.MasterKeyPresent)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.NetworkNamePresent)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.ExtendedPanIdPresent)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.MeshLocalPrefixPresent)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.DelayPresent)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.PanIdPresent)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.ChannelPresent)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.PskcPresent)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.SecurityPolicyPresent)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.ChannelMaskPresent)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _OperationalDatasetComponents::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _OperationalDatasetComponents & val = *reinterpret_cast<_OperationalDatasetComponents *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.ActiveTimestampPresent)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.PendingTimestampPresent)); + break; + } + case 2: { + ReturnErrorOnFailure(reader.Get(val.MasterKeyPresent)); + break; + } + case 3: { + ReturnErrorOnFailure(reader.Get(val.NetworkNamePresent)); + break; + } + case 4: { + ReturnErrorOnFailure(reader.Get(val.ExtendedPanIdPresent)); + break; + } + case 5: { + ReturnErrorOnFailure(reader.Get(val.MeshLocalPrefixPresent)); + break; + } + case 6: { + ReturnErrorOnFailure(reader.Get(val.DelayPresent)); + break; + } + case 7: { + ReturnErrorOnFailure(reader.Get(val.PanIdPresent)); + break; + } + case 8: { + ReturnErrorOnFailure(reader.Get(val.ChannelPresent)); + break; + } + case 9: { + ReturnErrorOnFailure(reader.Get(val.PskcPresent)); + break; + } + case 10: { + ReturnErrorOnFailure(reader.Get(val.SecurityPolicyPresent)); + break; + } + case 11: { + ReturnErrorOnFailure(reader.Get(val.ChannelMaskPresent)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _OperationalDatasetComponents::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _OperationalDatasetComponents & val = *reinterpret_cast<_OperationalDatasetComponents *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.ActiveTimestampPresent) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.ActiveTimestampPresent), buf + offset, sizeof(val.ActiveTimestampPresent)); // BOOLEAN + offset = static_cast(offset + sizeof(val.ActiveTimestampPresent)); + } + { + VerifyOrReturnError(offset + sizeof(val.PendingTimestampPresent) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.PendingTimestampPresent), buf + offset, sizeof(val.PendingTimestampPresent)); // BOOLEAN + offset = static_cast(offset + sizeof(val.PendingTimestampPresent)); + } + { + VerifyOrReturnError(offset + sizeof(val.MasterKeyPresent) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.MasterKeyPresent), buf + offset, sizeof(val.MasterKeyPresent)); // BOOLEAN + offset = static_cast(offset + sizeof(val.MasterKeyPresent)); + } + { + VerifyOrReturnError(offset + sizeof(val.NetworkNamePresent) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.NetworkNamePresent), buf + offset, sizeof(val.NetworkNamePresent)); // BOOLEAN + offset = static_cast(offset + sizeof(val.NetworkNamePresent)); + } + { + VerifyOrReturnError(offset + sizeof(val.ExtendedPanIdPresent) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.ExtendedPanIdPresent), buf + offset, sizeof(val.ExtendedPanIdPresent)); // BOOLEAN + offset = static_cast(offset + sizeof(val.ExtendedPanIdPresent)); + } + { + VerifyOrReturnError(offset + sizeof(val.MeshLocalPrefixPresent) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.MeshLocalPrefixPresent), buf + offset, sizeof(val.MeshLocalPrefixPresent)); // BOOLEAN + offset = static_cast(offset + sizeof(val.MeshLocalPrefixPresent)); + } + { + VerifyOrReturnError(offset + sizeof(val.DelayPresent) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.DelayPresent), buf + offset, sizeof(val.DelayPresent)); // BOOLEAN + offset = static_cast(offset + sizeof(val.DelayPresent)); + } + { + VerifyOrReturnError(offset + sizeof(val.PanIdPresent) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.PanIdPresent), buf + offset, sizeof(val.PanIdPresent)); // BOOLEAN + offset = static_cast(offset + sizeof(val.PanIdPresent)); + } + { + VerifyOrReturnError(offset + sizeof(val.ChannelPresent) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.ChannelPresent), buf + offset, sizeof(val.ChannelPresent)); // BOOLEAN + offset = static_cast(offset + sizeof(val.ChannelPresent)); + } + { + VerifyOrReturnError(offset + sizeof(val.PskcPresent) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.PskcPresent), buf + offset, sizeof(val.PskcPresent)); // BOOLEAN + offset = static_cast(offset + sizeof(val.PskcPresent)); + } + { + VerifyOrReturnError(offset + sizeof(val.SecurityPolicyPresent) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.SecurityPolicyPresent), buf + offset, sizeof(val.SecurityPolicyPresent)); // BOOLEAN + offset = static_cast(offset + sizeof(val.SecurityPolicyPresent)); + } + { + VerifyOrReturnError(offset + sizeof(val.ChannelMaskPresent) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.ChannelMaskPresent), buf + offset, sizeof(val.ChannelMaskPresent)); // BOOLEAN + offset = static_cast(offset + sizeof(val.ChannelMaskPresent)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _OperationalDatasetComponents::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _OperationalDatasetComponents & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.ActiveTimestampPresent) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.ActiveTimestampPresent), sizeof(val.ActiveTimestampPresent)); // BOOLEAN + offset = static_cast(offset + sizeof(val.ActiveTimestampPresent)); + } + { + VerifyOrReturnError(offset + sizeof(val.PendingTimestampPresent) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.PendingTimestampPresent), sizeof(val.PendingTimestampPresent)); // BOOLEAN + offset = static_cast(offset + sizeof(val.PendingTimestampPresent)); + } + { + VerifyOrReturnError(offset + sizeof(val.MasterKeyPresent) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.MasterKeyPresent), sizeof(val.MasterKeyPresent)); // BOOLEAN + offset = static_cast(offset + sizeof(val.MasterKeyPresent)); + } + { + VerifyOrReturnError(offset + sizeof(val.NetworkNamePresent) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.NetworkNamePresent), sizeof(val.NetworkNamePresent)); // BOOLEAN + offset = static_cast(offset + sizeof(val.NetworkNamePresent)); + } + { + VerifyOrReturnError(offset + sizeof(val.ExtendedPanIdPresent) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.ExtendedPanIdPresent), sizeof(val.ExtendedPanIdPresent)); // BOOLEAN + offset = static_cast(offset + sizeof(val.ExtendedPanIdPresent)); + } + { + VerifyOrReturnError(offset + sizeof(val.MeshLocalPrefixPresent) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.MeshLocalPrefixPresent), sizeof(val.MeshLocalPrefixPresent)); // BOOLEAN + offset = static_cast(offset + sizeof(val.MeshLocalPrefixPresent)); + } + { + VerifyOrReturnError(offset + sizeof(val.DelayPresent) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.DelayPresent), sizeof(val.DelayPresent)); // BOOLEAN + offset = static_cast(offset + sizeof(val.DelayPresent)); + } + { + VerifyOrReturnError(offset + sizeof(val.PanIdPresent) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.PanIdPresent), sizeof(val.PanIdPresent)); // BOOLEAN + offset = static_cast(offset + sizeof(val.PanIdPresent)); + } + { + VerifyOrReturnError(offset + sizeof(val.ChannelPresent) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.ChannelPresent), sizeof(val.ChannelPresent)); // BOOLEAN + offset = static_cast(offset + sizeof(val.ChannelPresent)); + } + { + VerifyOrReturnError(offset + sizeof(val.PskcPresent) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.PskcPresent), sizeof(val.PskcPresent)); // BOOLEAN + offset = static_cast(offset + sizeof(val.PskcPresent)); + } + { + VerifyOrReturnError(offset + sizeof(val.SecurityPolicyPresent) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.SecurityPolicyPresent), sizeof(val.SecurityPolicyPresent)); // BOOLEAN + offset = static_cast(offset + sizeof(val.SecurityPolicyPresent)); + } + { + VerifyOrReturnError(offset + sizeof(val.ChannelMaskPresent) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.ChannelMaskPresent), sizeof(val.ChannelMaskPresent)); // BOOLEAN + offset = static_cast(offset + sizeof(val.ChannelMaskPresent)); + } + return CHIP_NO_ERROR; +} + +// Struct for PowerProfileRecord +CHIP_ERROR _PowerProfileRecord::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _PowerProfileRecord & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.powerProfileId)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.energyPhaseId)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.powerProfileRemoteControl)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.powerProfileState)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _PowerProfileRecord::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _PowerProfileRecord & val = *reinterpret_cast<_PowerProfileRecord *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.powerProfileId)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.energyPhaseId)); + break; + } + case 2: { + ReturnErrorOnFailure(reader.Get(val.powerProfileRemoteControl)); + break; + } + case 3: { + ReturnErrorOnFailure(reader.Get(val.powerProfileState)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _PowerProfileRecord::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _PowerProfileRecord & val = *reinterpret_cast<_PowerProfileRecord *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.powerProfileId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.powerProfileId), buf + offset, sizeof(val.powerProfileId)); // INT8U + offset = static_cast(offset + sizeof(val.powerProfileId)); + } + { + VerifyOrReturnError(offset + sizeof(val.energyPhaseId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.energyPhaseId), buf + offset, sizeof(val.energyPhaseId)); // INT8U + offset = static_cast(offset + sizeof(val.energyPhaseId)); + } + { + VerifyOrReturnError(offset + sizeof(val.powerProfileRemoteControl) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.powerProfileRemoteControl), buf + offset, sizeof(val.powerProfileRemoteControl)); // BOOLEAN + offset = static_cast(offset + sizeof(val.powerProfileRemoteControl)); + } + { + VerifyOrReturnError(offset + sizeof(val.powerProfileState) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.powerProfileState), buf + offset, sizeof(val.powerProfileState)); // ENUM8 + offset = static_cast(offset + sizeof(val.powerProfileState)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _PowerProfileRecord::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _PowerProfileRecord & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.powerProfileId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.powerProfileId), sizeof(val.powerProfileId)); // INT8U + offset = static_cast(offset + sizeof(val.powerProfileId)); + } + { + VerifyOrReturnError(offset + sizeof(val.energyPhaseId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.energyPhaseId), sizeof(val.energyPhaseId)); // INT8U + offset = static_cast(offset + sizeof(val.energyPhaseId)); + } + { + VerifyOrReturnError(offset + sizeof(val.powerProfileRemoteControl) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.powerProfileRemoteControl), sizeof(val.powerProfileRemoteControl)); // BOOLEAN + offset = static_cast(offset + sizeof(val.powerProfileRemoteControl)); + } + { + VerifyOrReturnError(offset + sizeof(val.powerProfileState) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.powerProfileState), sizeof(val.powerProfileState)); // ENUM8 + offset = static_cast(offset + sizeof(val.powerProfileState)); + } + return CHIP_NO_ERROR; +} + +// Struct for ReadAttributeStatusRecord +CHIP_ERROR _ReadAttributeStatusRecord::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _ReadAttributeStatusRecord & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.attributeId)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.status)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.attributeType)); + SuccessOrExit(err = writer.PutNull(TLV::ContextTag(seq++))); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _ReadAttributeStatusRecord::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _ReadAttributeStatusRecord & val = *reinterpret_cast<_ReadAttributeStatusRecord *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.attributeId)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.status)); + break; + } + case 2: { + ReturnErrorOnFailure(reader.Get(val.attributeType)); + break; + } + case 3: { + // Nothing; + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _ReadAttributeStatusRecord::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _ReadAttributeStatusRecord & val = *reinterpret_cast<_ReadAttributeStatusRecord *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.attributeId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.attributeId), buf + offset, sizeof(val.attributeId)); // ATTRIB_ID + offset = static_cast(offset + sizeof(val.attributeId)); + } + { + VerifyOrReturnError(offset + sizeof(val.status) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.status), buf + offset, sizeof(val.status)); // Status + offset = static_cast(offset + sizeof(val.status)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeType) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.attributeType), buf + offset, sizeof(val.attributeType)); // INT8U + offset = static_cast(offset + sizeof(val.attributeType)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeLocation) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.attributeLocation), buf + offset, sizeof(val.attributeLocation)); // NO_DATA + offset = static_cast(offset + sizeof(val.attributeLocation)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _ReadAttributeStatusRecord::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _ReadAttributeStatusRecord & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.attributeId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.attributeId), sizeof(val.attributeId)); // ATTRIB_ID + offset = static_cast(offset + sizeof(val.attributeId)); + } + { + VerifyOrReturnError(offset + sizeof(val.status) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.status), sizeof(val.status)); // Status + offset = static_cast(offset + sizeof(val.status)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeType) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.attributeType), sizeof(val.attributeType)); // INT8U + offset = static_cast(offset + sizeof(val.attributeType)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeLocation) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.attributeLocation), sizeof(val.attributeLocation)); // NO_DATA + offset = static_cast(offset + sizeof(val.attributeLocation)); + } + return CHIP_NO_ERROR; +} + +// Struct for ReadReportingConfigurationAttributeRecord +CHIP_ERROR _ReadReportingConfigurationAttributeRecord::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _ReadReportingConfigurationAttributeRecord & val = + *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.direction)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.attributeId)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _ReadReportingConfigurationAttributeRecord::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _ReadReportingConfigurationAttributeRecord & val = *reinterpret_cast<_ReadReportingConfigurationAttributeRecord *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.direction)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.attributeId)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _ReadReportingConfigurationAttributeRecord::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _ReadReportingConfigurationAttributeRecord & val = *reinterpret_cast<_ReadReportingConfigurationAttributeRecord *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.direction) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.direction), buf + offset, sizeof(val.direction)); // INT8U + offset = static_cast(offset + sizeof(val.direction)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.attributeId), buf + offset, sizeof(val.attributeId)); // ATTRIB_ID + offset = static_cast(offset + sizeof(val.attributeId)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _ReadReportingConfigurationAttributeRecord::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, + size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _ReadReportingConfigurationAttributeRecord & val = + *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.direction) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.direction), sizeof(val.direction)); // INT8U + offset = static_cast(offset + sizeof(val.direction)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.attributeId), sizeof(val.attributeId)); // ATTRIB_ID + offset = static_cast(offset + sizeof(val.attributeId)); + } + return CHIP_NO_ERROR; +} + +// Struct for ReadReportingConfigurationRecord +CHIP_ERROR _ReadReportingConfigurationRecord::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _ReadReportingConfigurationRecord & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.status)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.direction)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.attributeId)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.attributeType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.minimumReportingInterval)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.maximumReportingInterval)); + SuccessOrExit(err = writer.PutNull(TLV::ContextTag(seq++))); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.timeoutPeriod)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _ReadReportingConfigurationRecord::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _ReadReportingConfigurationRecord & val = *reinterpret_cast<_ReadReportingConfigurationRecord *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.status)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.direction)); + break; + } + case 2: { + ReturnErrorOnFailure(reader.Get(val.attributeId)); + break; + } + case 3: { + ReturnErrorOnFailure(reader.Get(val.attributeType)); + break; + } + case 4: { + ReturnErrorOnFailure(reader.Get(val.minimumReportingInterval)); + break; + } + case 5: { + ReturnErrorOnFailure(reader.Get(val.maximumReportingInterval)); + break; + } + case 6: { + // Nothing; + break; + } + case 7: { + ReturnErrorOnFailure(reader.Get(val.timeoutPeriod)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _ReadReportingConfigurationRecord::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _ReadReportingConfigurationRecord & val = *reinterpret_cast<_ReadReportingConfigurationRecord *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.status) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.status), buf + offset, sizeof(val.status)); // Status + offset = static_cast(offset + sizeof(val.status)); + } + { + VerifyOrReturnError(offset + sizeof(val.direction) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.direction), buf + offset, sizeof(val.direction)); // INT8U + offset = static_cast(offset + sizeof(val.direction)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.attributeId), buf + offset, sizeof(val.attributeId)); // ATTRIB_ID + offset = static_cast(offset + sizeof(val.attributeId)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeType) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.attributeType), buf + offset, sizeof(val.attributeType)); // INT8U + offset = static_cast(offset + sizeof(val.attributeType)); + } + { + VerifyOrReturnError(offset + sizeof(val.minimumReportingInterval) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.minimumReportingInterval), buf + offset, sizeof(val.minimumReportingInterval)); // INT16U + offset = static_cast(offset + sizeof(val.minimumReportingInterval)); + } + { + VerifyOrReturnError(offset + sizeof(val.maximumReportingInterval) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.maximumReportingInterval), buf + offset, sizeof(val.maximumReportingInterval)); // INT16U + offset = static_cast(offset + sizeof(val.maximumReportingInterval)); + } + { + VerifyOrReturnError(offset + sizeof(val.reportableChangeLocation) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.reportableChangeLocation), buf + offset, sizeof(val.reportableChangeLocation)); // NO_DATA + offset = static_cast(offset + sizeof(val.reportableChangeLocation)); + } + { + VerifyOrReturnError(offset + sizeof(val.timeoutPeriod) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.timeoutPeriod), buf + offset, sizeof(val.timeoutPeriod)); // INT16U + offset = static_cast(offset + sizeof(val.timeoutPeriod)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _ReadReportingConfigurationRecord::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _ReadReportingConfigurationRecord & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.status) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.status), sizeof(val.status)); // Status + offset = static_cast(offset + sizeof(val.status)); + } + { + VerifyOrReturnError(offset + sizeof(val.direction) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.direction), sizeof(val.direction)); // INT8U + offset = static_cast(offset + sizeof(val.direction)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.attributeId), sizeof(val.attributeId)); // ATTRIB_ID + offset = static_cast(offset + sizeof(val.attributeId)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeType) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.attributeType), sizeof(val.attributeType)); // INT8U + offset = static_cast(offset + sizeof(val.attributeType)); + } + { + VerifyOrReturnError(offset + sizeof(val.minimumReportingInterval) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.minimumReportingInterval), sizeof(val.minimumReportingInterval)); // INT16U + offset = static_cast(offset + sizeof(val.minimumReportingInterval)); + } + { + VerifyOrReturnError(offset + sizeof(val.maximumReportingInterval) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.maximumReportingInterval), sizeof(val.maximumReportingInterval)); // INT16U + offset = static_cast(offset + sizeof(val.maximumReportingInterval)); + } + { + VerifyOrReturnError(offset + sizeof(val.reportableChangeLocation) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.reportableChangeLocation), sizeof(val.reportableChangeLocation)); // NO_DATA + offset = static_cast(offset + sizeof(val.reportableChangeLocation)); + } + { + VerifyOrReturnError(offset + sizeof(val.timeoutPeriod) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.timeoutPeriod), sizeof(val.timeoutPeriod)); // INT16U + offset = static_cast(offset + sizeof(val.timeoutPeriod)); + } + return CHIP_NO_ERROR; +} + +// Struct for ReadStructuredAttributeRecord +CHIP_ERROR _ReadStructuredAttributeRecord::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _ReadStructuredAttributeRecord & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.attributeId)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.indicator)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.indicies)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _ReadStructuredAttributeRecord::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _ReadStructuredAttributeRecord & val = *reinterpret_cast<_ReadStructuredAttributeRecord *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.attributeId)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.indicator)); + break; + } + case 2: { + ReturnErrorOnFailure(reader.Get(val.indicies)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _ReadStructuredAttributeRecord::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _ReadStructuredAttributeRecord & val = *reinterpret_cast<_ReadStructuredAttributeRecord *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.attributeId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.attributeId), buf + offset, sizeof(val.attributeId)); // ATTRIB_ID + offset = static_cast(offset + sizeof(val.attributeId)); + } + { + VerifyOrReturnError(offset + sizeof(val.indicator) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.indicator), buf + offset, sizeof(val.indicator)); // INT8U + offset = static_cast(offset + sizeof(val.indicator)); + } + { + VerifyOrReturnError(offset + sizeof(val.indicies) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.indicies), buf + offset, sizeof(val.indicies)); // INT16U + offset = static_cast(offset + sizeof(val.indicies)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _ReadStructuredAttributeRecord::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _ReadStructuredAttributeRecord & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.attributeId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.attributeId), sizeof(val.attributeId)); // ATTRIB_ID + offset = static_cast(offset + sizeof(val.attributeId)); + } + { + VerifyOrReturnError(offset + sizeof(val.indicator) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.indicator), sizeof(val.indicator)); // INT8U + offset = static_cast(offset + sizeof(val.indicator)); + } + { + VerifyOrReturnError(offset + sizeof(val.indicies) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.indicies), sizeof(val.indicies)); // INT16U + offset = static_cast(offset + sizeof(val.indicies)); + } + return CHIP_NO_ERROR; +} + +// Struct for ReportAttributeRecord +CHIP_ERROR _ReportAttributeRecord::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _ReportAttributeRecord & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.attributeId)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.attributeType)); + SuccessOrExit(err = writer.PutNull(TLV::ContextTag(seq++))); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _ReportAttributeRecord::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _ReportAttributeRecord & val = *reinterpret_cast<_ReportAttributeRecord *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.attributeId)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.attributeType)); + break; + } + case 2: { + // Nothing; + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _ReportAttributeRecord::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _ReportAttributeRecord & val = *reinterpret_cast<_ReportAttributeRecord *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.attributeId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.attributeId), buf + offset, sizeof(val.attributeId)); // ATTRIB_ID + offset = static_cast(offset + sizeof(val.attributeId)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeType) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.attributeType), buf + offset, sizeof(val.attributeType)); // INT8U + offset = static_cast(offset + sizeof(val.attributeType)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeLocation) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.attributeLocation), buf + offset, sizeof(val.attributeLocation)); // NO_DATA + offset = static_cast(offset + sizeof(val.attributeLocation)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _ReportAttributeRecord::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _ReportAttributeRecord & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.attributeId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.attributeId), sizeof(val.attributeId)); // ATTRIB_ID + offset = static_cast(offset + sizeof(val.attributeId)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeType) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.attributeType), sizeof(val.attributeType)); // INT8U + offset = static_cast(offset + sizeof(val.attributeType)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeLocation) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.attributeLocation), sizeof(val.attributeLocation)); // NO_DATA + offset = static_cast(offset + sizeof(val.attributeLocation)); + } + return CHIP_NO_ERROR; +} + +// Struct for RouteTable +CHIP_ERROR _RouteTable::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _RouteTable & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.ExtAddress)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.Rloc16)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.RouterId)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.NextHop)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.PathCost)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.LQIIn)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.LQIOut)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.Age)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.Allocated)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.LinkEstablished)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _RouteTable::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _RouteTable & val = *reinterpret_cast<_RouteTable *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.ExtAddress)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.Rloc16)); + break; + } + case 2: { + ReturnErrorOnFailure(reader.Get(val.RouterId)); + break; + } + case 3: { + ReturnErrorOnFailure(reader.Get(val.NextHop)); + break; + } + case 4: { + ReturnErrorOnFailure(reader.Get(val.PathCost)); + break; + } + case 5: { + ReturnErrorOnFailure(reader.Get(val.LQIIn)); + break; + } + case 6: { + ReturnErrorOnFailure(reader.Get(val.LQIOut)); + break; + } + case 7: { + ReturnErrorOnFailure(reader.Get(val.Age)); + break; + } + case 8: { + ReturnErrorOnFailure(reader.Get(val.Allocated)); + break; + } + case 9: { + ReturnErrorOnFailure(reader.Get(val.LinkEstablished)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _RouteTable::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _RouteTable & val = *reinterpret_cast<_RouteTable *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.ExtAddress) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.ExtAddress), buf + offset, sizeof(val.ExtAddress)); // INT64U + offset = static_cast(offset + sizeof(val.ExtAddress)); + } + { + VerifyOrReturnError(offset + sizeof(val.Rloc16) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.Rloc16), buf + offset, sizeof(val.Rloc16)); // INT16U + offset = static_cast(offset + sizeof(val.Rloc16)); + } + { + VerifyOrReturnError(offset + sizeof(val.RouterId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.RouterId), buf + offset, sizeof(val.RouterId)); // INT8U + offset = static_cast(offset + sizeof(val.RouterId)); + } + { + VerifyOrReturnError(offset + sizeof(val.NextHop) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.NextHop), buf + offset, sizeof(val.NextHop)); // INT8U + offset = static_cast(offset + sizeof(val.NextHop)); + } + { + VerifyOrReturnError(offset + sizeof(val.PathCost) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.PathCost), buf + offset, sizeof(val.PathCost)); // INT8U + offset = static_cast(offset + sizeof(val.PathCost)); + } + { + VerifyOrReturnError(offset + sizeof(val.LQIIn) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.LQIIn), buf + offset, sizeof(val.LQIIn)); // INT8U + offset = static_cast(offset + sizeof(val.LQIIn)); + } + { + VerifyOrReturnError(offset + sizeof(val.LQIOut) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.LQIOut), buf + offset, sizeof(val.LQIOut)); // INT8U + offset = static_cast(offset + sizeof(val.LQIOut)); + } + { + VerifyOrReturnError(offset + sizeof(val.Age) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.Age), buf + offset, sizeof(val.Age)); // INT8U + offset = static_cast(offset + sizeof(val.Age)); + } + { + VerifyOrReturnError(offset + sizeof(val.Allocated) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.Allocated), buf + offset, sizeof(val.Allocated)); // BOOLEAN + offset = static_cast(offset + sizeof(val.Allocated)); + } + { + VerifyOrReturnError(offset + sizeof(val.LinkEstablished) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.LinkEstablished), buf + offset, sizeof(val.LinkEstablished)); // BOOLEAN + offset = static_cast(offset + sizeof(val.LinkEstablished)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _RouteTable::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _RouteTable & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.ExtAddress) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.ExtAddress), sizeof(val.ExtAddress)); // INT64U + offset = static_cast(offset + sizeof(val.ExtAddress)); + } + { + VerifyOrReturnError(offset + sizeof(val.Rloc16) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.Rloc16), sizeof(val.Rloc16)); // INT16U + offset = static_cast(offset + sizeof(val.Rloc16)); + } + { + VerifyOrReturnError(offset + sizeof(val.RouterId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.RouterId), sizeof(val.RouterId)); // INT8U + offset = static_cast(offset + sizeof(val.RouterId)); + } + { + VerifyOrReturnError(offset + sizeof(val.NextHop) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.NextHop), sizeof(val.NextHop)); // INT8U + offset = static_cast(offset + sizeof(val.NextHop)); + } + { + VerifyOrReturnError(offset + sizeof(val.PathCost) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.PathCost), sizeof(val.PathCost)); // INT8U + offset = static_cast(offset + sizeof(val.PathCost)); + } + { + VerifyOrReturnError(offset + sizeof(val.LQIIn) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.LQIIn), sizeof(val.LQIIn)); // INT8U + offset = static_cast(offset + sizeof(val.LQIIn)); + } + { + VerifyOrReturnError(offset + sizeof(val.LQIOut) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.LQIOut), sizeof(val.LQIOut)); // INT8U + offset = static_cast(offset + sizeof(val.LQIOut)); + } + { + VerifyOrReturnError(offset + sizeof(val.Age) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.Age), sizeof(val.Age)); // INT8U + offset = static_cast(offset + sizeof(val.Age)); + } + { + VerifyOrReturnError(offset + sizeof(val.Allocated) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.Allocated), sizeof(val.Allocated)); // BOOLEAN + offset = static_cast(offset + sizeof(val.Allocated)); + } + { + VerifyOrReturnError(offset + sizeof(val.LinkEstablished) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.LinkEstablished), sizeof(val.LinkEstablished)); // BOOLEAN + offset = static_cast(offset + sizeof(val.LinkEstablished)); + } + return CHIP_NO_ERROR; +} + +// Struct for SceneExtensionAttributeInfo +CHIP_ERROR _SceneExtensionAttributeInfo::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _SceneExtensionAttributeInfo & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.attributeType)); + SuccessOrExit(err = writer.PutNull(TLV::ContextTag(seq++))); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _SceneExtensionAttributeInfo::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _SceneExtensionAttributeInfo & val = *reinterpret_cast<_SceneExtensionAttributeInfo *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.attributeType)); + break; + } + case 1: { + // Nothing; + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _SceneExtensionAttributeInfo::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _SceneExtensionAttributeInfo & val = *reinterpret_cast<_SceneExtensionAttributeInfo *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.attributeType) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.attributeType), buf + offset, sizeof(val.attributeType)); // INT8U + offset = static_cast(offset + sizeof(val.attributeType)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeLocation) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.attributeLocation), buf + offset, sizeof(val.attributeLocation)); // NO_DATA + offset = static_cast(offset + sizeof(val.attributeLocation)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _SceneExtensionAttributeInfo::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _SceneExtensionAttributeInfo & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.attributeType) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.attributeType), sizeof(val.attributeType)); // INT8U + offset = static_cast(offset + sizeof(val.attributeType)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeLocation) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.attributeLocation), sizeof(val.attributeLocation)); // NO_DATA + offset = static_cast(offset + sizeof(val.attributeLocation)); + } + return CHIP_NO_ERROR; +} + +// Struct for SceneExtensionFieldSet +CHIP_ERROR _SceneExtensionFieldSet::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _SceneExtensionFieldSet & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.clusterId)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.length)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.value)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _SceneExtensionFieldSet::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _SceneExtensionFieldSet & val = *reinterpret_cast<_SceneExtensionFieldSet *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.clusterId)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.length)); + break; + } + case 2: { + ReturnErrorOnFailure(reader.Get(val.value)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _SceneExtensionFieldSet::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _SceneExtensionFieldSet & val = *reinterpret_cast<_SceneExtensionFieldSet *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.clusterId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.clusterId), buf + offset, sizeof(val.clusterId)); // CLUSTER_ID + offset = static_cast(offset + sizeof(val.clusterId)); + } + { + VerifyOrReturnError(offset + sizeof(val.length) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.length), buf + offset, sizeof(val.length)); // INT8U + offset = static_cast(offset + sizeof(val.length)); + } + { + VerifyOrReturnError(offset + sizeof(val.value) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.value), buf + offset, sizeof(val.value)); // INT8U + offset = static_cast(offset + sizeof(val.value)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _SceneExtensionFieldSet::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _SceneExtensionFieldSet & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.clusterId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.clusterId), sizeof(val.clusterId)); // CLUSTER_ID + offset = static_cast(offset + sizeof(val.clusterId)); + } + { + VerifyOrReturnError(offset + sizeof(val.length) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.length), sizeof(val.length)); // INT8U + offset = static_cast(offset + sizeof(val.length)); + } + { + VerifyOrReturnError(offset + sizeof(val.value) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.value), sizeof(val.value)); // INT8U + offset = static_cast(offset + sizeof(val.value)); + } + return CHIP_NO_ERROR; +} + +// Struct for ScheduledPhase +CHIP_ERROR _ScheduledPhase::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _ScheduledPhase & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.energyPhaseId)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.scheduledTime)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _ScheduledPhase::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _ScheduledPhase & val = *reinterpret_cast<_ScheduledPhase *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.energyPhaseId)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.scheduledTime)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _ScheduledPhase::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _ScheduledPhase & val = *reinterpret_cast<_ScheduledPhase *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.energyPhaseId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.energyPhaseId), buf + offset, sizeof(val.energyPhaseId)); // INT8U + offset = static_cast(offset + sizeof(val.energyPhaseId)); + } + { + VerifyOrReturnError(offset + sizeof(val.scheduledTime) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.scheduledTime), buf + offset, sizeof(val.scheduledTime)); // INT16U + offset = static_cast(offset + sizeof(val.scheduledTime)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _ScheduledPhase::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _ScheduledPhase & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.energyPhaseId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.energyPhaseId), sizeof(val.energyPhaseId)); // INT8U + offset = static_cast(offset + sizeof(val.energyPhaseId)); + } + { + VerifyOrReturnError(offset + sizeof(val.scheduledTime) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.scheduledTime), sizeof(val.scheduledTime)); // INT16U + offset = static_cast(offset + sizeof(val.scheduledTime)); + } + return CHIP_NO_ERROR; +} + +// Struct for SecurityPolicy +CHIP_ERROR _SecurityPolicy::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _SecurityPolicy & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.RotationTime)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.Flags)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _SecurityPolicy::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _SecurityPolicy & val = *reinterpret_cast<_SecurityPolicy *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.RotationTime)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.Flags)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _SecurityPolicy::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _SecurityPolicy & val = *reinterpret_cast<_SecurityPolicy *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.RotationTime) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.RotationTime), buf + offset, sizeof(val.RotationTime)); // INT16U + offset = static_cast(offset + sizeof(val.RotationTime)); + } + { + VerifyOrReturnError(offset + sizeof(val.Flags) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.Flags), buf + offset, sizeof(val.Flags)); // INT8U + offset = static_cast(offset + sizeof(val.Flags)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _SecurityPolicy::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _SecurityPolicy & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.RotationTime) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.RotationTime), sizeof(val.RotationTime)); // INT16U + offset = static_cast(offset + sizeof(val.RotationTime)); + } + { + VerifyOrReturnError(offset + sizeof(val.Flags) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.Flags), sizeof(val.Flags)); // INT8U + offset = static_cast(offset + sizeof(val.Flags)); + } + return CHIP_NO_ERROR; +} + +// Struct for TestListStructOctet +CHIP_ERROR _TestListStructOctet::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _TestListStructOctet & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.fabricIndex)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.operationalCert)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _TestListStructOctet::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _TestListStructOctet & val = *reinterpret_cast<_TestListStructOctet *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.fabricIndex)); + break; + } + case 1: { + { + const uint8_t * data = nullptr; + ReturnErrorOnFailure(reader.GetDataPtr(data)); + val.operationalCert = chip::ByteSpan(data, reader.GetLength()); + } + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _TestListStructOctet::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _TestListStructOctet & val = *reinterpret_cast<_TestListStructOctet *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.fabricIndex) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.fabricIndex), buf + offset, sizeof(val.fabricIndex)); // INT64U + offset = static_cast(offset + sizeof(val.fabricIndex)); + } + { + constexpr uint16_t kLengthSize = 2; + chip::ByteSpan & operationalCertSpan = val.operationalCert; // OCTET_STRING + ReturnErrorOnFailure(ReadByteSpan(buf + offset, static_cast(bufLength - offset), &operationalCertSpan)); + offset = static_cast(offset + kLengthSize + operationalCertSpan.size()); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _TestListStructOctet::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _TestListStructOctet & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.fabricIndex) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.fabricIndex), sizeof(val.fabricIndex)); // INT64U + offset = static_cast(offset + sizeof(val.fabricIndex)); + } + { + constexpr uint16_t kLengthSize = 2; + const chip::ByteSpan & operationalCertSpan = val.operationalCert; // OCTET_STRING + ReturnErrorOnFailure(WriteByteSpan(buf + offset, static_cast(bufLength - offset), &operationalCertSpan)); + offset = static_cast(offset + kLengthSize + operationalCertSpan.size()); + } + return CHIP_NO_ERROR; +} + +// Struct for ThreadInterfaceScanResult +CHIP_ERROR _ThreadInterfaceScanResult::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _ThreadInterfaceScanResult & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.DiscoveryResponse)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _ThreadInterfaceScanResult::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _ThreadInterfaceScanResult & val = *reinterpret_cast<_ThreadInterfaceScanResult *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + { + const uint8_t * data = nullptr; + ReturnErrorOnFailure(reader.GetDataPtr(data)); + val.DiscoveryResponse = chip::ByteSpan(data, reader.GetLength()); + } + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _ThreadInterfaceScanResult::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _ThreadInterfaceScanResult & val = *reinterpret_cast<_ThreadInterfaceScanResult *>(valPtr); + { + constexpr uint16_t kLengthSize = 2; + chip::ByteSpan & DiscoveryResponseSpan = val.DiscoveryResponse; // OCTET_STRING + ReturnErrorOnFailure(ReadByteSpan(buf + offset, static_cast(bufLength - offset), &DiscoveryResponseSpan)); + offset = static_cast(offset + kLengthSize + DiscoveryResponseSpan.size()); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _ThreadInterfaceScanResult::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _ThreadInterfaceScanResult & val = *reinterpret_cast(valPtr); + { + constexpr uint16_t kLengthSize = 2; + const chip::ByteSpan & DiscoveryResponseSpan = val.DiscoveryResponse; // OCTET_STRING + ReturnErrorOnFailure(WriteByteSpan(buf + offset, static_cast(bufLength - offset), &DiscoveryResponseSpan)); + offset = static_cast(offset + kLengthSize + DiscoveryResponseSpan.size()); + } + return CHIP_NO_ERROR; +} + +// Struct for ThreadMetrics +CHIP_ERROR _ThreadMetrics::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _ThreadMetrics & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.Id)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.Name)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.StackFreeCurrent)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.StackFreeMinimum)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.StackSize)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _ThreadMetrics::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _ThreadMetrics & val = *reinterpret_cast<_ThreadMetrics *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.Id)); + break; + } + case 1: { + { + const uint8_t * data = nullptr; + ReturnErrorOnFailure(reader.GetDataPtr(data)); + val.Name = chip::ByteSpan(data, reader.GetLength()); + } + break; + } + case 2: { + ReturnErrorOnFailure(reader.Get(val.StackFreeCurrent)); + break; + } + case 3: { + ReturnErrorOnFailure(reader.Get(val.StackFreeMinimum)); + break; + } + case 4: { + ReturnErrorOnFailure(reader.Get(val.StackSize)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _ThreadMetrics::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _ThreadMetrics & val = *reinterpret_cast<_ThreadMetrics *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.Id) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.Id), buf + offset, sizeof(val.Id)); // INT64U + offset = static_cast(offset + sizeof(val.Id)); + } + { + constexpr uint16_t kLengthSize = 2; + chip::ByteSpan & NameSpan = val.Name; // OCTET_STRING + ReturnErrorOnFailure(ReadByteSpan(buf + offset, static_cast(bufLength - offset), &NameSpan)); + offset = static_cast(offset + kLengthSize + NameSpan.size()); + } + { + VerifyOrReturnError(offset + sizeof(val.StackFreeCurrent) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.StackFreeCurrent), buf + offset, sizeof(val.StackFreeCurrent)); // INT32U + offset = static_cast(offset + sizeof(val.StackFreeCurrent)); + } + { + VerifyOrReturnError(offset + sizeof(val.StackFreeMinimum) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.StackFreeMinimum), buf + offset, sizeof(val.StackFreeMinimum)); // INT32U + offset = static_cast(offset + sizeof(val.StackFreeMinimum)); + } + { + VerifyOrReturnError(offset + sizeof(val.StackSize) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.StackSize), buf + offset, sizeof(val.StackSize)); // INT32U + offset = static_cast(offset + sizeof(val.StackSize)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _ThreadMetrics::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _ThreadMetrics & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.Id) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.Id), sizeof(val.Id)); // INT64U + offset = static_cast(offset + sizeof(val.Id)); + } + { + constexpr uint16_t kLengthSize = 2; + const chip::ByteSpan & NameSpan = val.Name; // OCTET_STRING + ReturnErrorOnFailure(WriteByteSpan(buf + offset, static_cast(bufLength - offset), &NameSpan)); + offset = static_cast(offset + kLengthSize + NameSpan.size()); + } + { + VerifyOrReturnError(offset + sizeof(val.StackFreeCurrent) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.StackFreeCurrent), sizeof(val.StackFreeCurrent)); // INT32U + offset = static_cast(offset + sizeof(val.StackFreeCurrent)); + } + { + VerifyOrReturnError(offset + sizeof(val.StackFreeMinimum) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.StackFreeMinimum), sizeof(val.StackFreeMinimum)); // INT32U + offset = static_cast(offset + sizeof(val.StackFreeMinimum)); + } + { + VerifyOrReturnError(offset + sizeof(val.StackSize) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.StackSize), sizeof(val.StackSize)); // INT32U + offset = static_cast(offset + sizeof(val.StackSize)); + } + return CHIP_NO_ERROR; +} + +// Struct for TransferredPhase +CHIP_ERROR _TransferredPhase::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _TransferredPhase & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.energyPhaseId)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.macroPhaseId)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.expectedDuration)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.peakPower)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.energy)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.maxActivationDelay)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _TransferredPhase::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _TransferredPhase & val = *reinterpret_cast<_TransferredPhase *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.energyPhaseId)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.macroPhaseId)); + break; + } + case 2: { + ReturnErrorOnFailure(reader.Get(val.expectedDuration)); + break; + } + case 3: { + ReturnErrorOnFailure(reader.Get(val.peakPower)); + break; + } + case 4: { + ReturnErrorOnFailure(reader.Get(val.energy)); + break; + } + case 5: { + ReturnErrorOnFailure(reader.Get(val.maxActivationDelay)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _TransferredPhase::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _TransferredPhase & val = *reinterpret_cast<_TransferredPhase *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.energyPhaseId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.energyPhaseId), buf + offset, sizeof(val.energyPhaseId)); // INT8U + offset = static_cast(offset + sizeof(val.energyPhaseId)); + } + { + VerifyOrReturnError(offset + sizeof(val.macroPhaseId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.macroPhaseId), buf + offset, sizeof(val.macroPhaseId)); // INT8U + offset = static_cast(offset + sizeof(val.macroPhaseId)); + } + { + VerifyOrReturnError(offset + sizeof(val.expectedDuration) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.expectedDuration), buf + offset, sizeof(val.expectedDuration)); // INT16U + offset = static_cast(offset + sizeof(val.expectedDuration)); + } + { + VerifyOrReturnError(offset + sizeof(val.peakPower) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.peakPower), buf + offset, sizeof(val.peakPower)); // INT16U + offset = static_cast(offset + sizeof(val.peakPower)); + } + { + VerifyOrReturnError(offset + sizeof(val.energy) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.energy), buf + offset, sizeof(val.energy)); // INT16U + offset = static_cast(offset + sizeof(val.energy)); + } + { + VerifyOrReturnError(offset + sizeof(val.maxActivationDelay) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.maxActivationDelay), buf + offset, sizeof(val.maxActivationDelay)); // INT16U + offset = static_cast(offset + sizeof(val.maxActivationDelay)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _TransferredPhase::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _TransferredPhase & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.energyPhaseId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.energyPhaseId), sizeof(val.energyPhaseId)); // INT8U + offset = static_cast(offset + sizeof(val.energyPhaseId)); + } + { + VerifyOrReturnError(offset + sizeof(val.macroPhaseId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.macroPhaseId), sizeof(val.macroPhaseId)); // INT8U + offset = static_cast(offset + sizeof(val.macroPhaseId)); + } + { + VerifyOrReturnError(offset + sizeof(val.expectedDuration) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.expectedDuration), sizeof(val.expectedDuration)); // INT16U + offset = static_cast(offset + sizeof(val.expectedDuration)); + } + { + VerifyOrReturnError(offset + sizeof(val.peakPower) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.peakPower), sizeof(val.peakPower)); // INT16U + offset = static_cast(offset + sizeof(val.peakPower)); + } + { + VerifyOrReturnError(offset + sizeof(val.energy) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.energy), sizeof(val.energy)); // INT16U + offset = static_cast(offset + sizeof(val.energy)); + } + { + VerifyOrReturnError(offset + sizeof(val.maxActivationDelay) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.maxActivationDelay), sizeof(val.maxActivationDelay)); // INT16U + offset = static_cast(offset + sizeof(val.maxActivationDelay)); + } + return CHIP_NO_ERROR; +} + +// Struct for TvChannelInfo +CHIP_ERROR _TvChannelInfo::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _TvChannelInfo & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.majorNumber)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.minorNumber)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.name)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.callSign)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.affiliateCallSign)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _TvChannelInfo::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _TvChannelInfo & val = *reinterpret_cast<_TvChannelInfo *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.majorNumber)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.minorNumber)); + break; + } + case 2: { + { + const uint8_t * data = nullptr; + ReturnErrorOnFailure(reader.GetDataPtr(data)); + val.name = chip::ByteSpan(data, reader.GetLength()); + } + break; + } + case 3: { + { + const uint8_t * data = nullptr; + ReturnErrorOnFailure(reader.GetDataPtr(data)); + val.callSign = chip::ByteSpan(data, reader.GetLength()); + } + break; + } + case 4: { + { + const uint8_t * data = nullptr; + ReturnErrorOnFailure(reader.GetDataPtr(data)); + val.affiliateCallSign = chip::ByteSpan(data, reader.GetLength()); + } + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _TvChannelInfo::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _TvChannelInfo & val = *reinterpret_cast<_TvChannelInfo *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.majorNumber) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.majorNumber), buf + offset, sizeof(val.majorNumber)); // INT16U + offset = static_cast(offset + sizeof(val.majorNumber)); + } + { + VerifyOrReturnError(offset + sizeof(val.minorNumber) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.minorNumber), buf + offset, sizeof(val.minorNumber)); // INT16U + offset = static_cast(offset + sizeof(val.minorNumber)); + } + { + constexpr uint16_t kLengthSize = 2; + chip::ByteSpan & nameSpan = val.name; // OCTET_STRING + ReturnErrorOnFailure(ReadByteSpan(buf + offset, static_cast(bufLength - offset), &nameSpan)); + offset = static_cast(offset + kLengthSize + nameSpan.size()); + } + { + constexpr uint16_t kLengthSize = 2; + chip::ByteSpan & callSignSpan = val.callSign; // OCTET_STRING + ReturnErrorOnFailure(ReadByteSpan(buf + offset, static_cast(bufLength - offset), &callSignSpan)); + offset = static_cast(offset + kLengthSize + callSignSpan.size()); + } + { + constexpr uint16_t kLengthSize = 2; + chip::ByteSpan & affiliateCallSignSpan = val.affiliateCallSign; // OCTET_STRING + ReturnErrorOnFailure(ReadByteSpan(buf + offset, static_cast(bufLength - offset), &affiliateCallSignSpan)); + offset = static_cast(offset + kLengthSize + affiliateCallSignSpan.size()); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _TvChannelInfo::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _TvChannelInfo & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.majorNumber) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.majorNumber), sizeof(val.majorNumber)); // INT16U + offset = static_cast(offset + sizeof(val.majorNumber)); + } + { + VerifyOrReturnError(offset + sizeof(val.minorNumber) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.minorNumber), sizeof(val.minorNumber)); // INT16U + offset = static_cast(offset + sizeof(val.minorNumber)); + } + { + constexpr uint16_t kLengthSize = 2; + const chip::ByteSpan & nameSpan = val.name; // OCTET_STRING + ReturnErrorOnFailure(WriteByteSpan(buf + offset, static_cast(bufLength - offset), &nameSpan)); + offset = static_cast(offset + kLengthSize + nameSpan.size()); + } + { + constexpr uint16_t kLengthSize = 2; + const chip::ByteSpan & callSignSpan = val.callSign; // OCTET_STRING + ReturnErrorOnFailure(WriteByteSpan(buf + offset, static_cast(bufLength - offset), &callSignSpan)); + offset = static_cast(offset + kLengthSize + callSignSpan.size()); + } + { + constexpr uint16_t kLengthSize = 2; + const chip::ByteSpan & affiliateCallSignSpan = val.affiliateCallSign; // OCTET_STRING + ReturnErrorOnFailure(WriteByteSpan(buf + offset, static_cast(bufLength - offset), &affiliateCallSignSpan)); + offset = static_cast(offset + kLengthSize + affiliateCallSignSpan.size()); + } + return CHIP_NO_ERROR; +} + +// Struct for TvChannelLineupInfo +CHIP_ERROR _TvChannelLineupInfo::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _TvChannelLineupInfo & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.PutString(TLV::ContextTag(seq++), chip::Uint8::to_const_char(val.operatorName))); + SuccessOrExit(err = writer.PutString(TLV::ContextTag(seq++), chip::Uint8::to_const_char(val.lineupName))); + SuccessOrExit(err = writer.PutString(TLV::ContextTag(seq++), chip::Uint8::to_const_char(val.postalCode))); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.lineupInfoType)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _TvChannelLineupInfo::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _TvChannelLineupInfo & val = *reinterpret_cast<_TvChannelLineupInfo *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.GetDataPtr(val.operatorName)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.GetDataPtr(val.lineupName)); + break; + } + case 2: { + ReturnErrorOnFailure(reader.GetDataPtr(val.postalCode)); + break; + } + case 3: { + ReturnErrorOnFailure(reader.Get(val.lineupInfoType)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _TvChannelLineupInfo::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _TvChannelLineupInfo & val = *reinterpret_cast<_TvChannelLineupInfo *>(valPtr); + { + uint8_t len; + memcpy(&len, buf + offset, sizeof(len)); + val.operatorName = buf + offset; + offset = static_cast(offset + len + sizeof(len)); + } + { + uint8_t len; + memcpy(&len, buf + offset, sizeof(len)); + val.lineupName = buf + offset; + offset = static_cast(offset + len + sizeof(len)); + } + { + uint8_t len; + memcpy(&len, buf + offset, sizeof(len)); + val.postalCode = buf + offset; + offset = static_cast(offset + len + sizeof(len)); + } + { + VerifyOrReturnError(offset + sizeof(val.lineupInfoType) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.lineupInfoType), buf + offset, sizeof(val.lineupInfoType)); // TvChannelLineupInfoType + offset = static_cast(offset + sizeof(val.lineupInfoType)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _TvChannelLineupInfo::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _TvChannelLineupInfo & val = *reinterpret_cast(valPtr); + { + uint8_t stringLen = emberAfStringLength(val.operatorName); + VerifyOrReturnError(offset + stringLen + sizeof(stringLen) <= bufLength, CHIP_ERROR_NO_MEMORY); + emberAfCopyString(buf + offset, val.operatorName, bufLength - offset); + } + { + uint8_t stringLen = emberAfStringLength(val.lineupName); + VerifyOrReturnError(offset + stringLen + sizeof(stringLen) <= bufLength, CHIP_ERROR_NO_MEMORY); + emberAfCopyString(buf + offset, val.lineupName, bufLength - offset); + } + { + uint8_t stringLen = emberAfStringLength(val.postalCode); + VerifyOrReturnError(offset + stringLen + sizeof(stringLen) <= bufLength, CHIP_ERROR_NO_MEMORY); + emberAfCopyString(buf + offset, val.postalCode, bufLength - offset); + } + { + VerifyOrReturnError(offset + sizeof(val.lineupInfoType) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.lineupInfoType), sizeof(val.lineupInfoType)); // TvChannelLineupInfoType + offset = static_cast(offset + sizeof(val.lineupInfoType)); + } + return CHIP_NO_ERROR; +} + +// Struct for WiFiInterfaceScanResult +CHIP_ERROR _WiFiInterfaceScanResult::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _WiFiInterfaceScanResult & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.Security)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.SSID)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.BSSID)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.Channel)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.FrequencyBand)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _WiFiInterfaceScanResult::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _WiFiInterfaceScanResult & val = *reinterpret_cast<_WiFiInterfaceScanResult *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.Security)); + break; + } + case 1: { + { + const uint8_t * data = nullptr; + ReturnErrorOnFailure(reader.GetDataPtr(data)); + val.SSID = chip::ByteSpan(data, reader.GetLength()); + } + break; + } + case 2: { + { + const uint8_t * data = nullptr; + ReturnErrorOnFailure(reader.GetDataPtr(data)); + val.BSSID = chip::ByteSpan(data, reader.GetLength()); + } + break; + } + case 3: { + ReturnErrorOnFailure(reader.Get(val.Channel)); + break; + } + case 4: { + ReturnErrorOnFailure(reader.Get(val.FrequencyBand)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _WiFiInterfaceScanResult::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _WiFiInterfaceScanResult & val = *reinterpret_cast<_WiFiInterfaceScanResult *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.Security) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.Security), buf + offset, sizeof(val.Security)); // BITMAP8 + offset = static_cast(offset + sizeof(val.Security)); + } + { + constexpr uint16_t kLengthSize = 2; + chip::ByteSpan & SSIDSpan = val.SSID; // OCTET_STRING + ReturnErrorOnFailure(ReadByteSpan(buf + offset, static_cast(bufLength - offset), &SSIDSpan)); + offset = static_cast(offset + kLengthSize + SSIDSpan.size()); + } + { + constexpr uint16_t kLengthSize = 2; + chip::ByteSpan & BSSIDSpan = val.BSSID; // OCTET_STRING + ReturnErrorOnFailure(ReadByteSpan(buf + offset, static_cast(bufLength - offset), &BSSIDSpan)); + offset = static_cast(offset + kLengthSize + BSSIDSpan.size()); + } + { + VerifyOrReturnError(offset + sizeof(val.Channel) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.Channel), buf + offset, sizeof(val.Channel)); // INT8U + offset = static_cast(offset + sizeof(val.Channel)); + } + { + VerifyOrReturnError(offset + sizeof(val.FrequencyBand) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.FrequencyBand), buf + offset, sizeof(val.FrequencyBand)); // INT32U + offset = static_cast(offset + sizeof(val.FrequencyBand)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _WiFiInterfaceScanResult::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _WiFiInterfaceScanResult & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.Security) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.Security), sizeof(val.Security)); // BITMAP8 + offset = static_cast(offset + sizeof(val.Security)); + } + { + constexpr uint16_t kLengthSize = 2; + const chip::ByteSpan & SSIDSpan = val.SSID; // OCTET_STRING + ReturnErrorOnFailure(WriteByteSpan(buf + offset, static_cast(bufLength - offset), &SSIDSpan)); + offset = static_cast(offset + kLengthSize + SSIDSpan.size()); + } + { + constexpr uint16_t kLengthSize = 2; + const chip::ByteSpan & BSSIDSpan = val.BSSID; // OCTET_STRING + ReturnErrorOnFailure(WriteByteSpan(buf + offset, static_cast(bufLength - offset), &BSSIDSpan)); + offset = static_cast(offset + kLengthSize + BSSIDSpan.size()); + } + { + VerifyOrReturnError(offset + sizeof(val.Channel) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.Channel), sizeof(val.Channel)); // INT8U + offset = static_cast(offset + sizeof(val.Channel)); + } + { + VerifyOrReturnError(offset + sizeof(val.FrequencyBand) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.FrequencyBand), sizeof(val.FrequencyBand)); // INT32U + offset = static_cast(offset + sizeof(val.FrequencyBand)); + } + return CHIP_NO_ERROR; +} + +// Struct for WriteAttributeRecord +CHIP_ERROR _WriteAttributeRecord::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _WriteAttributeRecord & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.attributeId)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.attributeType)); + SuccessOrExit(err = writer.PutNull(TLV::ContextTag(seq++))); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _WriteAttributeRecord::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _WriteAttributeRecord & val = *reinterpret_cast<_WriteAttributeRecord *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.attributeId)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.attributeType)); + break; + } + case 2: { + // Nothing; + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _WriteAttributeRecord::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _WriteAttributeRecord & val = *reinterpret_cast<_WriteAttributeRecord *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.attributeId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.attributeId), buf + offset, sizeof(val.attributeId)); // ATTRIB_ID + offset = static_cast(offset + sizeof(val.attributeId)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeType) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.attributeType), buf + offset, sizeof(val.attributeType)); // INT8U + offset = static_cast(offset + sizeof(val.attributeType)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeLocation) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.attributeLocation), buf + offset, sizeof(val.attributeLocation)); // NO_DATA + offset = static_cast(offset + sizeof(val.attributeLocation)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _WriteAttributeRecord::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _WriteAttributeRecord & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.attributeId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.attributeId), sizeof(val.attributeId)); // ATTRIB_ID + offset = static_cast(offset + sizeof(val.attributeId)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeType) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.attributeType), sizeof(val.attributeType)); // INT8U + offset = static_cast(offset + sizeof(val.attributeType)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeLocation) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.attributeLocation), sizeof(val.attributeLocation)); // NO_DATA + offset = static_cast(offset + sizeof(val.attributeLocation)); + } + return CHIP_NO_ERROR; +} + +// Struct for WriteAttributeStatusRecord +CHIP_ERROR _WriteAttributeStatusRecord::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _WriteAttributeStatusRecord & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.status)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.attributeId)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _WriteAttributeStatusRecord::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _WriteAttributeStatusRecord & val = *reinterpret_cast<_WriteAttributeStatusRecord *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.status)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.attributeId)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _WriteAttributeStatusRecord::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _WriteAttributeStatusRecord & val = *reinterpret_cast<_WriteAttributeStatusRecord *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.status) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.status), buf + offset, sizeof(val.status)); // Status + offset = static_cast(offset + sizeof(val.status)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.attributeId), buf + offset, sizeof(val.attributeId)); // ATTRIB_ID + offset = static_cast(offset + sizeof(val.attributeId)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _WriteAttributeStatusRecord::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _WriteAttributeStatusRecord & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.status) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.status), sizeof(val.status)); // Status + offset = static_cast(offset + sizeof(val.status)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.attributeId), sizeof(val.attributeId)); // ATTRIB_ID + offset = static_cast(offset + sizeof(val.attributeId)); + } + return CHIP_NO_ERROR; +} + +// Struct for WriteStructuredAttributeRecord +CHIP_ERROR _WriteStructuredAttributeRecord::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _WriteStructuredAttributeRecord & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.attributeId)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.indicator)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.indicies)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.attributeType)); + SuccessOrExit(err = writer.PutNull(TLV::ContextTag(seq++))); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _WriteStructuredAttributeRecord::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _WriteStructuredAttributeRecord & val = *reinterpret_cast<_WriteStructuredAttributeRecord *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.attributeId)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.indicator)); + break; + } + case 2: { + ReturnErrorOnFailure(reader.Get(val.indicies)); + break; + } + case 3: { + ReturnErrorOnFailure(reader.Get(val.attributeType)); + break; + } + case 4: { + // Nothing; + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _WriteStructuredAttributeRecord::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _WriteStructuredAttributeRecord & val = *reinterpret_cast<_WriteStructuredAttributeRecord *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.attributeId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.attributeId), buf + offset, sizeof(val.attributeId)); // ATTRIB_ID + offset = static_cast(offset + sizeof(val.attributeId)); + } + { + VerifyOrReturnError(offset + sizeof(val.indicator) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.indicator), buf + offset, sizeof(val.indicator)); // INT8U + offset = static_cast(offset + sizeof(val.indicator)); + } + { + VerifyOrReturnError(offset + sizeof(val.indicies) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.indicies), buf + offset, sizeof(val.indicies)); // INT16U + offset = static_cast(offset + sizeof(val.indicies)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeType) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.attributeType), buf + offset, sizeof(val.attributeType)); // INT8U + offset = static_cast(offset + sizeof(val.attributeType)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeLocation) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.attributeLocation), buf + offset, sizeof(val.attributeLocation)); // NO_DATA + offset = static_cast(offset + sizeof(val.attributeLocation)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _WriteStructuredAttributeRecord::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _WriteStructuredAttributeRecord & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.attributeId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.attributeId), sizeof(val.attributeId)); // ATTRIB_ID + offset = static_cast(offset + sizeof(val.attributeId)); + } + { + VerifyOrReturnError(offset + sizeof(val.indicator) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.indicator), sizeof(val.indicator)); // INT8U + offset = static_cast(offset + sizeof(val.indicator)); + } + { + VerifyOrReturnError(offset + sizeof(val.indicies) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.indicies), sizeof(val.indicies)); // INT16U + offset = static_cast(offset + sizeof(val.indicies)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeType) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.attributeType), sizeof(val.attributeType)); // INT8U + offset = static_cast(offset + sizeof(val.attributeType)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeLocation) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.attributeLocation), sizeof(val.attributeLocation)); // NO_DATA + offset = static_cast(offset + sizeof(val.attributeLocation)); + } + return CHIP_NO_ERROR; +} + +// Struct for WriteStructuredAttributeStatusRecord +CHIP_ERROR _WriteStructuredAttributeStatusRecord::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _WriteStructuredAttributeStatusRecord & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.status)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.attributeId)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.indicator)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.indicies)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _WriteStructuredAttributeStatusRecord::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _WriteStructuredAttributeStatusRecord & val = *reinterpret_cast<_WriteStructuredAttributeStatusRecord *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.status)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.attributeId)); + break; + } + case 2: { + ReturnErrorOnFailure(reader.Get(val.indicator)); + break; + } + case 3: { + ReturnErrorOnFailure(reader.Get(val.indicies)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _WriteStructuredAttributeStatusRecord::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _WriteStructuredAttributeStatusRecord & val = *reinterpret_cast<_WriteStructuredAttributeStatusRecord *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.status) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.status), buf + offset, sizeof(val.status)); // Status + offset = static_cast(offset + sizeof(val.status)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.attributeId), buf + offset, sizeof(val.attributeId)); // ATTRIB_ID + offset = static_cast(offset + sizeof(val.attributeId)); + } + { + VerifyOrReturnError(offset + sizeof(val.indicator) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.indicator), buf + offset, sizeof(val.indicator)); // INT8U + offset = static_cast(offset + sizeof(val.indicator)); + } + { + VerifyOrReturnError(offset + sizeof(val.indicies) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.indicies), buf + offset, sizeof(val.indicies)); // INT16U + offset = static_cast(offset + sizeof(val.indicies)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _WriteStructuredAttributeStatusRecord::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _WriteStructuredAttributeStatusRecord & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.status) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.status), sizeof(val.status)); // Status + offset = static_cast(offset + sizeof(val.status)); + } + { + VerifyOrReturnError(offset + sizeof(val.attributeId) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.attributeId), sizeof(val.attributeId)); // ATTRIB_ID + offset = static_cast(offset + sizeof(val.attributeId)); + } + { + VerifyOrReturnError(offset + sizeof(val.indicator) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.indicator), sizeof(val.indicator)); // INT8U + offset = static_cast(offset + sizeof(val.indicator)); + } + { + VerifyOrReturnError(offset + sizeof(val.indicies) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.indicies), sizeof(val.indicies)); // INT16U + offset = static_cast(offset + sizeof(val.indicies)); + } + return CHIP_NO_ERROR; +} + +// Struct for simplestruct +CHIP_ERROR _simplestruct::Encode(const void * valPtr, TLV::TLVWriter & writer, uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + uint8_t seq = 0; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + const _simplestruct & val = *reinterpret_cast(valPtr); + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Structure, tmpType)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.fieldA)); + SuccessOrExit(err = writer.Put(TLV::ContextTag(seq++), val.fieldB)); +exit: + err = writer.EndContainer(tmpType); + return err; +} + +CHIP_ERROR _simplestruct::Decode(void * valPtr, const TLV::TLVReader & aReader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVReader reader; + chip::TLV::TLVType tmpType; + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + _simplestruct & val = *reinterpret_cast<_simplestruct *>(valPtr); + reader.Init(aReader); + VerifyOrReturnError(reader.GetType() == TLV::TLVType::kTLVType_Structure, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(reader.EnterContainer(tmpType)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + uint32_t currentDecodeTagId = TLV::TagNumFromTag(reader.GetTag()); + switch (currentDecodeTagId) + { + case 0: { + ReturnErrorOnFailure(reader.Get(val.fieldA)); + break; + } + case 1: { + ReturnErrorOnFailure(reader.Get(val.fieldB)); + break; + } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + } + } + if (err == CHIP_END_OF_TLV) + { + err = CHIP_NO_ERROR; + } + return err; +} + +CHIP_ERROR _simplestruct::FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + _simplestruct & val = *reinterpret_cast<_simplestruct *>(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.fieldA) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.fieldA), buf + offset, sizeof(val.fieldA)); // INT64U + offset = static_cast(offset + sizeof(val.fieldA)); + } + { + VerifyOrReturnError(offset + sizeof(val.fieldB) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove((uint8_t *) &(val.fieldB), buf + offset, sizeof(val.fieldB)); // INT32U + offset = static_cast(offset + sizeof(val.fieldB)); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR _simplestruct::ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len) +{ + VerifyOrReturnError(valPtr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + uint16_t offset = 0; + const _simplestruct & val = *reinterpret_cast(valPtr); + { + VerifyOrReturnError(offset + sizeof(val.fieldA) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.fieldA), sizeof(val.fieldA)); // INT64U + offset = static_cast(offset + sizeof(val.fieldA)); + } + { + VerifyOrReturnError(offset + sizeof(val.fieldB) <= bufLength, CHIP_ERROR_INVALID_ARGUMENT); + memmove(buf + offset, (uint8_t *) &(val.fieldB), sizeof(val.fieldB)); // INT32U + offset = static_cast(offset + sizeof(val.fieldB)); + } + return CHIP_NO_ERROR; +} diff --git a/zzz_generated/app-common/app-common/zap-generated/af-structs.h b/zzz_generated/app-common/app-common/zap-generated/af-structs.h index b774f8162f3e57..4edf586d3aa2ab 100644 --- a/zzz_generated/app-common/app-common/zap-generated/af-structs.h +++ b/zzz_generated/app-common/app-common/zap-generated/af-structs.h @@ -22,16 +22,20 @@ #include +#include "enums.h" #include +#include #include -#include "enums.h" - // Struct for ApplicationLauncherApp typedef struct _ApplicationLauncherApp { uint16_t catalogVendorId; - uint8_t * applicationId; + const uint8_t * applicationId; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfApplicationLauncherApp; // Struct for AudioOutputInfo @@ -40,12 +44,20 @@ typedef struct _AudioOutputInfo uint8_t index; uint8_t outputType; chip::ByteSpan name; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfAudioOutputInfo; // Struct for BasicCommissioningInfoType typedef struct _BasicCommissioningInfoType { uint32_t FailSafeExpiryLengthMs; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfBasicCommissioningInfoType; // Struct for ConfigureReportingRecord @@ -58,6 +70,10 @@ typedef struct _ConfigureReportingRecord uint16_t maximumReportingInterval; uint8_t * reportableChangeLocation; uint16_t timeoutPeriod; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfConfigureReportingRecord; // Struct for ConfigureReportingStatusRecord @@ -66,48 +82,72 @@ typedef struct _ConfigureReportingStatusRecord uint8_t status; uint8_t direction; chip::AttributeId attributeId; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfConfigureReportingStatusRecord; // Struct for ContentLaunchAdditionalInfo typedef struct _ContentLaunchAdditionalInfo { - uint8_t * name; - uint8_t * value; + const uint8_t * name; + const uint8_t * value; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfContentLaunchAdditionalInfo; // Struct for ContentLaunchBrandingInformation typedef struct _ContentLaunchBrandingInformation { - uint8_t * providerName; + const uint8_t * providerName; uint8_t background; uint8_t logo; uint8_t progressBar; uint8_t splash; uint8_t waterMark; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfContentLaunchBrandingInformation; // Struct for ContentLaunchDimension typedef struct _ContentLaunchDimension { - uint8_t * width; - uint8_t * height; + const uint8_t * width; + const uint8_t * height; uint8_t metric; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfContentLaunchDimension; // Struct for ContentLaunchParamater typedef struct _ContentLaunchParamater { uint8_t Type; - uint8_t * Value; - /* TYPE WARNING: array array defaults to */ uint8_t * ExternalIDList; + const uint8_t * Value; + const /* TYPE WARNING: array array defaults to */ uint8_t * ExternalIDList; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfContentLaunchParamater; // Struct for ContentLaunchStyleInformation typedef struct _ContentLaunchStyleInformation { - uint8_t * imageUrl; - uint8_t * color; + const uint8_t * imageUrl; + const uint8_t * color; uint8_t size; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfContentLaunchStyleInformation; // Struct for DeviceType @@ -115,6 +155,10 @@ typedef struct _DeviceType { chip::DeviceTypeId type; uint16_t revision; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfDeviceType; // Struct for DiscoverAttributesInfoRecord @@ -122,6 +166,10 @@ typedef struct _DiscoverAttributesInfoRecord { chip::AttributeId attributeId; uint8_t attributeType; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfDiscoverAttributesInfoRecord; // Struct for ExtendedDiscoverAttributesInfoRecord @@ -130,6 +178,10 @@ typedef struct _ExtendedDiscoverAttributesInfoRecord chip::AttributeId attributeId; uint8_t attributeType; uint8_t attributeAccessControl; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfExtendedDiscoverAttributesInfoRecord; // Struct for FabricDescriptor @@ -141,6 +193,10 @@ typedef struct _FabricDescriptor chip::FabricId FabricId; chip::NodeId NodeId; chip::ByteSpan Label; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfFabricDescriptor; // Struct for GroupKey @@ -151,6 +207,10 @@ typedef struct _GroupKey chip::ByteSpan GroupKeyRoot; uint64_t GroupKeyEpochStartTime; uint8_t GroupKeySecurityPolicy; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfGroupKey; // Struct for GroupState @@ -159,6 +219,10 @@ typedef struct _GroupState uint16_t VendorId; uint16_t VendorGroupId; uint16_t GroupKeySetIndex; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfGroupState; // Struct for IasAceZoneStatusResult @@ -166,6 +230,10 @@ typedef struct _IasAceZoneStatusResult { uint8_t zoneId; uint16_t zoneStatus; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfIasAceZoneStatusResult; // Struct for LabelStruct @@ -173,6 +241,10 @@ typedef struct _LabelStruct { chip::ByteSpan label; chip::ByteSpan value; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfLabelStruct; // Struct for MediaInputInfo @@ -182,6 +254,10 @@ typedef struct _MediaInputInfo uint8_t inputType; chip::ByteSpan name; chip::ByteSpan description; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfMediaInputInfo; // Struct for MediaPlaybackPosition @@ -189,6 +265,10 @@ typedef struct _MediaPlaybackPosition { uint64_t updatedAt; uint64_t position; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfMediaPlaybackPosition; // Struct for NOCStruct @@ -196,6 +276,10 @@ typedef struct _NOCStruct { uint8_t FabricIndex; chip::ByteSpan NOC; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfNOCStruct; // Struct for NavigateTargetTargetInfo @@ -203,6 +287,10 @@ typedef struct _NavigateTargetTargetInfo { uint8_t identifier; chip::ByteSpan name; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfNavigateTargetTargetInfo; // Struct for NeighborTable @@ -222,6 +310,10 @@ typedef struct _NeighborTable bool FullThreadDevice; bool FullNetworkData; bool IsChild; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfNeighborTable; // Struct for NetworkInterfaceType @@ -233,6 +325,10 @@ typedef struct _NetworkInterfaceType bool OffPremiseServicesReachableIPv6; chip::ByteSpan HardwareAddress; uint8_t Type; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfNetworkInterfaceType; // Struct for Notification @@ -240,6 +336,10 @@ typedef struct _Notification { uint16_t contentId; uint8_t statusFeedback; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfNotification; // Struct for OperationalDatasetComponents @@ -257,6 +357,10 @@ typedef struct _OperationalDatasetComponents bool PskcPresent; bool SecurityPolicyPresent; bool ChannelMaskPresent; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfOperationalDatasetComponents; // Struct for PowerProfileRecord @@ -266,6 +370,10 @@ typedef struct _PowerProfileRecord uint8_t energyPhaseId; bool powerProfileRemoteControl; uint8_t powerProfileState; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfPowerProfileRecord; // Struct for ReadAttributeStatusRecord @@ -275,6 +383,10 @@ typedef struct _ReadAttributeStatusRecord uint8_t status; uint8_t attributeType; uint8_t * attributeLocation; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfReadAttributeStatusRecord; // Struct for ReadReportingConfigurationAttributeRecord @@ -282,6 +394,10 @@ typedef struct _ReadReportingConfigurationAttributeRecord { uint8_t direction; chip::AttributeId attributeId; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfReadReportingConfigurationAttributeRecord; // Struct for ReadReportingConfigurationRecord @@ -295,6 +411,10 @@ typedef struct _ReadReportingConfigurationRecord uint16_t maximumReportingInterval; uint8_t * reportableChangeLocation; uint16_t timeoutPeriod; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfReadReportingConfigurationRecord; // Struct for ReadStructuredAttributeRecord @@ -303,6 +423,10 @@ typedef struct _ReadStructuredAttributeRecord chip::AttributeId attributeId; uint8_t indicator; uint16_t indicies; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfReadStructuredAttributeRecord; // Struct for ReportAttributeRecord @@ -311,6 +435,10 @@ typedef struct _ReportAttributeRecord chip::AttributeId attributeId; uint8_t attributeType; uint8_t * attributeLocation; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfReportAttributeRecord; // Struct for RouteTable @@ -326,6 +454,10 @@ typedef struct _RouteTable uint8_t Age; bool Allocated; bool LinkEstablished; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfRouteTable; // Struct for SceneExtensionAttributeInfo @@ -333,6 +465,10 @@ typedef struct _SceneExtensionAttributeInfo { uint8_t attributeType; uint8_t * attributeLocation; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfSceneExtensionAttributeInfo; // Struct for SceneExtensionFieldSet @@ -341,6 +477,10 @@ typedef struct _SceneExtensionFieldSet chip::ClusterId clusterId; uint8_t length; uint8_t value; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfSceneExtensionFieldSet; // Struct for ScheduledPhase @@ -348,6 +488,10 @@ typedef struct _ScheduledPhase { uint8_t energyPhaseId; uint16_t scheduledTime; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfScheduledPhase; // Struct for SecurityPolicy @@ -355,6 +499,10 @@ typedef struct _SecurityPolicy { uint16_t RotationTime; uint8_t Flags; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfSecurityPolicy; // Struct for TestListStructOctet @@ -362,12 +510,20 @@ typedef struct _TestListStructOctet { uint64_t fabricIndex; chip::ByteSpan operationalCert; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfTestListStructOctet; // Struct for ThreadInterfaceScanResult typedef struct _ThreadInterfaceScanResult { chip::ByteSpan DiscoveryResponse; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfThreadInterfaceScanResult; // Struct for ThreadMetrics @@ -378,6 +534,10 @@ typedef struct _ThreadMetrics uint32_t StackFreeCurrent; uint32_t StackFreeMinimum; uint32_t StackSize; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfThreadMetrics; // Struct for TransferredPhase @@ -389,6 +549,10 @@ typedef struct _TransferredPhase uint16_t peakPower; uint16_t energy; uint16_t maxActivationDelay; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfTransferredPhase; // Struct for TvChannelInfo @@ -399,15 +563,23 @@ typedef struct _TvChannelInfo chip::ByteSpan name; chip::ByteSpan callSign; chip::ByteSpan affiliateCallSign; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfTvChannelInfo; // Struct for TvChannelLineupInfo typedef struct _TvChannelLineupInfo { - uint8_t * operatorName; - uint8_t * lineupName; - uint8_t * postalCode; + const uint8_t * operatorName; + const uint8_t * lineupName; + const uint8_t * postalCode; uint8_t lineupInfoType; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfTvChannelLineupInfo; // Struct for WiFiInterfaceScanResult @@ -418,6 +590,10 @@ typedef struct _WiFiInterfaceScanResult chip::ByteSpan BSSID; uint8_t Channel; uint32_t FrequencyBand; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfWiFiInterfaceScanResult; // Struct for WriteAttributeRecord @@ -426,6 +602,10 @@ typedef struct _WriteAttributeRecord chip::AttributeId attributeId; uint8_t attributeType; uint8_t * attributeLocation; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfWriteAttributeRecord; // Struct for WriteAttributeStatusRecord @@ -433,6 +613,10 @@ typedef struct _WriteAttributeStatusRecord { uint8_t status; chip::AttributeId attributeId; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfWriteAttributeStatusRecord; // Struct for WriteStructuredAttributeRecord @@ -443,6 +627,10 @@ typedef struct _WriteStructuredAttributeRecord uint16_t indicies; uint8_t attributeType; uint8_t * attributeLocation; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfWriteStructuredAttributeRecord; // Struct for WriteStructuredAttributeStatusRecord @@ -452,4 +640,19 @@ typedef struct _WriteStructuredAttributeStatusRecord chip::AttributeId attributeId; uint8_t indicator; uint16_t indicies; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); } EmberAfWriteStructuredAttributeStatusRecord; + +// Struct for simplestruct +typedef struct _simplestruct +{ + uint64_t fieldA; + uint32_t fieldB; + static CHIP_ERROR Encode(const void * val, chip::TLV::TLVWriter & writer, uint64_t tag); + static CHIP_ERROR Decode(void * val, const chip::TLV::TLVReader & aReader); + static CHIP_ERROR ToEmberBuffer(const void * valPtr, uint8_t * buf, size_t bufLength, size_t & len); + static CHIP_ERROR FromEmberBuffer(void * valPtr, const uint8_t * buf, size_t bufLength); +} EmberAfsimplestruct; diff --git a/zzz_generated/app-common/app-common/zap-generated/attribute-id.h b/zzz_generated/app-common/app-common/zap-generated/attribute-id.h index 478e98d7e904e0..9c5f5e62103ecb 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attribute-id.h +++ b/zzz_generated/app-common/app-common/zap-generated/attribute-id.h @@ -1326,6 +1326,7 @@ #define ZCL_LONG_OCTET_STRING_ATTRIBUTE_ID (0x001D) #define ZCL_CHAR_STRING_ATTRIBUTE_ID (0x001E) #define ZCL_LONG_CHAR_STRING_ATTRIBUTE_ID (0x001F) +#define ZCL_SIMPLE_STRUCT_ATTRIBUTE_ID (0x0020) #define ZCL_UNSUPPORTED_ATTRIBUTE_ID (0x00FF) // Attribute ids for cluster: Messaging diff --git a/zzz_generated/app-common/app-common/zap-generated/attribute-type.h b/zzz_generated/app-common/app-common/zap-generated/attribute-type.h index e4bee3e509ab69..d801b361cb0486 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attribute-type.h +++ b/zzz_generated/app-common/app-common/zap-generated/attribute-type.h @@ -86,4 +86,54 @@ enum ZCL_IPV6PRE_ATTRIBUTE_TYPE = 0xFD, // IPv6 Prefix ZCL_HWADR_ATTRIBUTE_TYPE = 0xFE, // Hardware Address ZCL_UNKNOWN_ATTRIBUTE_TYPE = 0xFF, // Unknown + // TODO: workaround for structs, should emit ZCL_STRUCT_ATTRIBUTE_TYPE for structs, this is a issue of zap. + ZCL_APPLICATION_LAUNCHER_APP_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_AUDIO_OUTPUT_INFO_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_BASIC_COMMISSIONING_INFO_TYPE_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_CONFIGURE_REPORTING_RECORD_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_CONFIGURE_REPORTING_STATUS_RECORD_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_CONTENT_LAUNCH_ADDITIONAL_INFO_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_CONTENT_LAUNCH_BRANDING_INFORMATION_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_CONTENT_LAUNCH_DIMENSION_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_CONTENT_LAUNCH_PARAMATER_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_CONTENT_LAUNCH_STYLE_INFORMATION_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_DEVICE_TYPE_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_DISCOVER_ATTRIBUTES_INFO_RECORD_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_EXTENDED_DISCOVER_ATTRIBUTES_INFO_RECORD_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_FABRIC_DESCRIPTOR_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_GROUP_KEY_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_GROUP_STATE_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_IAS_ACE_ZONE_STATUS_RESULT_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_LABEL_STRUCT_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_MEDIA_INPUT_INFO_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_MEDIA_PLAYBACK_POSITION_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_NOC_STRUCT_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_NAVIGATE_TARGET_TARGET_INFO_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_NEIGHBOR_TABLE_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_NETWORK_INTERFACE_TYPE_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_NOTIFICATION_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_OPERATIONAL_DATASET_COMPONENTS_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_POWER_PROFILE_RECORD_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_READ_ATTRIBUTE_STATUS_RECORD_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_READ_REPORTING_CONFIGURATION_ATTRIBUTE_RECORD_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_READ_REPORTING_CONFIGURATION_RECORD_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_READ_STRUCTURED_ATTRIBUTE_RECORD_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_REPORT_ATTRIBUTE_RECORD_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_ROUTE_TABLE_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_SCENE_EXTENSION_ATTRIBUTE_INFO_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_SCENE_EXTENSION_FIELD_SET_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_SCHEDULED_PHASE_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_SECURITY_POLICY_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_TEST_LIST_STRUCT_OCTET_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_THREAD_INTERFACE_SCAN_RESULT_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_THREAD_METRICS_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_TRANSFERRED_PHASE_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_TV_CHANNEL_INFO_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_TV_CHANNEL_LINEUP_INFO_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_WI_FI_INTERFACE_SCAN_RESULT_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_WRITE_ATTRIBUTE_RECORD_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_WRITE_ATTRIBUTE_STATUS_RECORD_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_WRITE_STRUCTURED_ATTRIBUTE_RECORD_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_WRITE_STRUCTURED_ATTRIBUTE_STATUS_RECORD_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, + ZCL_SIMPLESTRUCT_ATTRIBUTE_TYPE = ZCL_STRUCT_ATTRIBUTE_TYPE, }; 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 03d91efa30c8ed..f0bc2cd5bc5a5c 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 @@ -6773,6 +6773,16 @@ EmberAfStatus SetEnum16(chip::EndpointId endpoint, uint16_t enum16) { return emberAfWriteServerAttribute(endpoint, TestCluster::Id, Ids::Enum16, (uint8_t *) &enum16, ZCL_ENUM16_ATTRIBUTE_TYPE); } +EmberAfStatus GetSimpleStruct(chip::EndpointId endpoint, /* TYPE WARNING: simplestruct defaults to */ uint8_t * simpleStruct) +{ + return emberAfReadServerAttribute(endpoint, TestCluster::Id, Ids::SimpleStruct, (uint8_t *) simpleStruct, + sizeof(*simpleStruct)); +} +EmberAfStatus SetSimpleStruct(chip::EndpointId endpoint, /* TYPE WARNING: simplestruct defaults to */ uint8_t * simpleStruct) +{ + return emberAfWriteServerAttribute(endpoint, TestCluster::Id, Ids::SimpleStruct, (uint8_t *) &simpleStruct, + ZCL_SIMPLESTRUCT_ATTRIBUTE_TYPE); +} EmberAfStatus GetUnsupported(chip::EndpointId endpoint, bool * unsupported) { return emberAfReadServerAttribute(endpoint, TestCluster::Id, Ids::Unsupported, (uint8_t *) unsupported, sizeof(*unsupported)); 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 eee95e65a9bcac..6031df9c607502 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 @@ -1860,6 +1860,9 @@ EmberAfStatus GetEnum8(chip::EndpointId endpoint, uint8_t * enum8); // enum8 EmberAfStatus SetEnum8(chip::EndpointId endpoint, uint8_t enum8); EmberAfStatus GetEnum16(chip::EndpointId endpoint, uint16_t * enum16); // enum16 EmberAfStatus SetEnum16(chip::EndpointId endpoint, uint16_t enum16); +EmberAfStatus GetSimpleStruct(chip::EndpointId endpoint, + /* TYPE WARNING: simplestruct defaults to */ uint8_t * simpleStruct); // simplestruct +EmberAfStatus SetSimpleStruct(chip::EndpointId endpoint, /* TYPE WARNING: simplestruct defaults to */ uint8_t * simpleStruct); EmberAfStatus GetUnsupported(chip::EndpointId endpoint, bool * unsupported); // boolean EmberAfStatus SetUnsupported(chip::EndpointId endpoint, bool unsupported); } // namespace Attributes diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h index b724b08faa0e22..a7d1663595abbc 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h @@ -1361,6 +1361,7 @@ static constexpr AttributeId ListStructOctetString = 0x0000001C; static constexpr AttributeId LongOctetString = 0x0000001D; static constexpr AttributeId CharString = 0x0000001E; static constexpr AttributeId LongCharString = 0x0000001F; +static constexpr AttributeId SimpleStruct = 0x00000020; static constexpr AttributeId Unsupported = 0x000000FF; } // namespace Ids } // namespace Attributes diff --git a/zzz_generated/bridge-app/zap-generated/attribute-size.cpp b/zzz_generated/bridge-app/zap-generated/attribute-size.cpp index f855b7c49c5ffd..c351f211e90e88 100644 --- a/zzz_generated/bridge-app/zap-generated/attribute-size.cpp +++ b/zzz_generated/bridge-app/zap-generated/attribute-size.cpp @@ -21,10 +21,13 @@ #include #include #include +#include +#include #include #include using namespace chip; +using namespace chip::app; using namespace chip::app::List; // The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid @@ -45,6 +48,335 @@ void copyListMember(uint8_t * dest, uint8_t * src, bool write, uint16_t * offset *offset = static_cast(*offset + length); } +CHIP_ERROR CopyStructAttributeToCHIPTLV(ClusterId clusterId, AttributeId attributeId, uint8_t * src, uint16_t len, + TLV::TLVWriter & writer, uint64_t tag) +{ + switch (clusterId) + { + } + return CHIP_ERROR_INVALID_ARGUMENT; +} + +CHIP_ERROR EmberListToCHIPTLV(ClusterId clusterId, AttributeId attributeId, uint8_t * src, uint16_t len, TLV::TLVWriter & writer, + uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + size_t count = *reinterpret_cast(src); + uint16_t entryLength = 0; + // Suppress error of unused variable. + (void) entryLength; + (void) count; + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Array, tmpType)); + switch (clusterId) + { + case 0x001D: // Descriptor Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // device list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 6; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _DeviceType + _DeviceType entry; + SuccessOrExit(err = _DeviceType::FromEmberBuffer(&entry, src + entryOffset, 6)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x0001: // server list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 4; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + chip::ClusterId entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // CLUSTER_ID + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + case 0x0002: // client list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 4; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + chip::ClusterId entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // CLUSTER_ID + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + case 0x0003: // parts list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 2; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + chip::EndpointId entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // ENDPOINT_NO + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + } + break; + } + case 0x0040: // Fixed Label Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // label list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 36; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _LabelStruct + _LabelStruct entry; + SuccessOrExit(err = _LabelStruct::FromEmberBuffer(&entry, src + entryOffset, 36)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x0030: // General Commissioning Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0001: // BasicCommissioningInfoList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 4; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _BasicCommissioningInfoType + _BasicCommissioningInfoType entry; + SuccessOrExit(err = _BasicCommissioningInfoType::FromEmberBuffer(&entry, src + entryOffset, 4)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x0033: // General Diagnostics Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // NetworkInterfaces + { + for (size_t index = 0; index < count; index++) + { + entryLength = 48; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _NetworkInterfaceType + _NetworkInterfaceType entry; + SuccessOrExit(err = _NetworkInterfaceType::FromEmberBuffer(&entry, src + entryOffset, 48)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x003E: // Operational Credentials Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0001: // fabrics list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 120; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _FabricDescriptor + _FabricDescriptor entry; + SuccessOrExit(err = _FabricDescriptor::FromEmberBuffer(&entry, src + entryOffset, 120)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x0004: // TrustedRootCertificates + { + for (size_t index = 0; index < count; index++) + { + entryOffset = GetByteSpanOffsetFromIndex(src, len, static_cast(index)); + if (entryOffset == 0) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + + chip::ByteSpan trustedRootCertificatesSpan; // OCTET_STRING + uint16_t trustedRootCertificatesRemainingSpace = static_cast(len - entryOffset); + if (CHIP_NO_ERROR != + ReadByteSpan(src + entryOffset, trustedRootCertificatesRemainingSpace, &trustedRootCertificatesSpan)) + { + ChipLogError(Zcl, "Index %zu is invalid. Not enough remaining space", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + writer.Put(TLV::AnonymousTag, trustedRootCertificatesSpan); + } + break; + } + } + break; + } + case 0x0035: // Thread Network Diagnostics Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0007: // NeighborTableList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 31; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _NeighborTable + _NeighborTable entry; + SuccessOrExit(err = _NeighborTable::FromEmberBuffer(&entry, src + entryOffset, 31)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x0008: // RouteTableList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 18; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _RouteTable + _RouteTable entry; + SuccessOrExit(err = _RouteTable::FromEmberBuffer(&entry, src + entryOffset, 18)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x003B: // SecurityPolicy + { + for (size_t index = 0; index < count; index++) + { + entryLength = 3; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _SecurityPolicy + _SecurityPolicy entry; + SuccessOrExit(err = _SecurityPolicy::FromEmberBuffer(&entry, src + entryOffset, 3)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x003D: // OperationalDatasetComponents + { + for (size_t index = 0; index < count; index++) + { + entryLength = 12; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _OperationalDatasetComponents + _OperationalDatasetComponents entry; + SuccessOrExit(err = _OperationalDatasetComponents::FromEmberBuffer(&entry, src + entryOffset, 12)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x003E: // ActiveNetworkFaultsList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 1; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + uint8_t entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // NetworkFault + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + } + break; + } + } +exit: + err = writer.EndContainer(tmpType); + return err; +} + uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, bool write, uint8_t * dest, uint8_t * src, int32_t index) { @@ -80,8 +412,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo { case 0x001D: // Descriptor Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // device list { @@ -94,10 +427,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _DeviceType _DeviceType * entry = reinterpret_cast<_DeviceType *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->type, write ? (uint8_t *) &entry->type : src, write, &entryOffset, - sizeof(entry->type)); // DEVTYPE_ID - copyListMember(write ? dest : (uint8_t *) &entry->revision, write ? (uint8_t *) &entry->revision : src, write, - &entryOffset, sizeof(entry->revision)); // INT16U + if (write) + { + size_t unusedLen; + _DeviceType::ToEmberBuffer(entry, dest + entryOffset, 6, unusedLen); + } + else + { + _DeviceType::FromEmberBuffer(entry, src + entryOffset, 6); + } break; } case 0x0001: // server list @@ -141,8 +479,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0040: // Fixed Label Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // label list { @@ -155,22 +494,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _LabelStruct _LabelStruct * entry = reinterpret_cast<_LabelStruct *>(write ? src : dest); - ByteSpan * labelSpan = &entry->label; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 18, labelSpan) : ReadByteSpan(src + entryOffset, 18, labelSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _LabelStruct::ToEmberBuffer(entry, dest + entryOffset, 36, unusedLen); } - entryOffset = static_cast(entryOffset + 18); - ByteSpan * valueSpan = &entry->value; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 18, valueSpan) : ReadByteSpan(src + entryOffset, 18, valueSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _LabelStruct::FromEmberBuffer(entry, src + entryOffset, 36); } - entryOffset = static_cast(entryOffset + 18); break; } } @@ -178,8 +510,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0030: // General Commissioning Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0001: // BasicCommissioningInfoList { @@ -192,9 +525,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _BasicCommissioningInfoType _BasicCommissioningInfoType * entry = reinterpret_cast<_BasicCommissioningInfoType *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->FailSafeExpiryLengthMs, - write ? (uint8_t *) &entry->FailSafeExpiryLengthMs : src, write, &entryOffset, - sizeof(entry->FailSafeExpiryLengthMs)); // INT32U + if (write) + { + size_t unusedLen; + _BasicCommissioningInfoType::ToEmberBuffer(entry, dest + entryOffset, 4, unusedLen); + } + else + { + _BasicCommissioningInfoType::FromEmberBuffer(entry, src + entryOffset, 4); + } break; } } @@ -202,8 +541,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0033: // General Diagnostics Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // NetworkInterfaces { @@ -216,33 +556,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NetworkInterfaceType _NetworkInterfaceType * entry = reinterpret_cast<_NetworkInterfaceType *>(write ? src : dest); - ByteSpan * NameSpan = &entry->Name; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, NameSpan) : ReadByteSpan(src + entryOffset, 34, NameSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _NetworkInterfaceType::ToEmberBuffer(entry, dest + entryOffset, 48, unusedLen); } - entryOffset = static_cast(entryOffset + 34); - copyListMember(write ? dest : (uint8_t *) &entry->FabricConnected, write ? (uint8_t *) &entry->FabricConnected : src, - write, &entryOffset, sizeof(entry->FabricConnected)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->OffPremiseServicesReachableIPv4, - write ? (uint8_t *) &entry->OffPremiseServicesReachableIPv4 : src, write, &entryOffset, - sizeof(entry->OffPremiseServicesReachableIPv4)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->OffPremiseServicesReachableIPv6, - write ? (uint8_t *) &entry->OffPremiseServicesReachableIPv6 : src, write, &entryOffset, - sizeof(entry->OffPremiseServicesReachableIPv6)); // BOOLEAN - ByteSpan * HardwareAddressSpan = &entry->HardwareAddress; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 10, HardwareAddressSpan) - : ReadByteSpan(src + entryOffset, 10, HardwareAddressSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _NetworkInterfaceType::FromEmberBuffer(entry, src + entryOffset, 48); } - entryOffset = static_cast(entryOffset + 10); - copyListMember(write ? dest : (uint8_t *) &entry->Type, write ? (uint8_t *) &entry->Type : src, write, &entryOffset, - sizeof(entry->Type)); // ENUM8 break; } } @@ -250,8 +572,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x003E: // Operational Credentials Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0001: // fabrics list { @@ -264,31 +587,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _FabricDescriptor _FabricDescriptor * entry = reinterpret_cast<_FabricDescriptor *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->FabricIndex, write ? (uint8_t *) &entry->FabricIndex : src, write, - &entryOffset, sizeof(entry->FabricIndex)); // INT8U - ByteSpan * RootPublicKeySpan = &entry->RootPublicKey; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 67, RootPublicKeySpan) - : ReadByteSpan(src + entryOffset, 67, RootPublicKeySpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _FabricDescriptor::ToEmberBuffer(entry, dest + entryOffset, 120, unusedLen); } - entryOffset = static_cast(entryOffset + 67); - copyListMember(write ? dest : (uint8_t *) &entry->VendorId, write ? (uint8_t *) &entry->VendorId : src, write, - &entryOffset, sizeof(entry->VendorId)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->FabricId, write ? (uint8_t *) &entry->FabricId : src, write, - &entryOffset, sizeof(entry->FabricId)); // FABRIC_ID - copyListMember(write ? dest : (uint8_t *) &entry->NodeId, write ? (uint8_t *) &entry->NodeId : src, write, &entryOffset, - sizeof(entry->NodeId)); // NODE_ID - ByteSpan * LabelSpan = &entry->Label; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, LabelSpan) : ReadByteSpan(src + entryOffset, 34, LabelSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _FabricDescriptor::FromEmberBuffer(entry, src + entryOffset, 120); } - entryOffset = static_cast(entryOffset + 34); break; } case 0x0004: // TrustedRootCertificates @@ -323,8 +630,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0035: // Thread Network Diagnostics Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0007: // NeighborTableList { @@ -337,34 +645,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NeighborTable _NeighborTable * entry = reinterpret_cast<_NeighborTable *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->ExtAddress, write ? (uint8_t *) &entry->ExtAddress : src, write, - &entryOffset, sizeof(entry->ExtAddress)); // INT64U - copyListMember(write ? dest : (uint8_t *) &entry->Age, write ? (uint8_t *) &entry->Age : src, write, &entryOffset, - sizeof(entry->Age)); // INT32U - copyListMember(write ? dest : (uint8_t *) &entry->Rloc16, write ? (uint8_t *) &entry->Rloc16 : src, write, &entryOffset, - sizeof(entry->Rloc16)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->LinkFrameCounter, write ? (uint8_t *) &entry->LinkFrameCounter : src, - write, &entryOffset, sizeof(entry->LinkFrameCounter)); // INT32U - copyListMember(write ? dest : (uint8_t *) &entry->MleFrameCounter, write ? (uint8_t *) &entry->MleFrameCounter : src, - write, &entryOffset, sizeof(entry->MleFrameCounter)); // INT32U - copyListMember(write ? dest : (uint8_t *) &entry->LQI, write ? (uint8_t *) &entry->LQI : src, write, &entryOffset, - sizeof(entry->LQI)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->AverageRssi, write ? (uint8_t *) &entry->AverageRssi : src, write, - &entryOffset, sizeof(entry->AverageRssi)); // INT8S - copyListMember(write ? dest : (uint8_t *) &entry->LastRssi, write ? (uint8_t *) &entry->LastRssi : src, write, - &entryOffset, sizeof(entry->LastRssi)); // INT8S - copyListMember(write ? dest : (uint8_t *) &entry->FrameErrorRate, write ? (uint8_t *) &entry->FrameErrorRate : src, - write, &entryOffset, sizeof(entry->FrameErrorRate)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->MessageErrorRate, write ? (uint8_t *) &entry->MessageErrorRate : src, - write, &entryOffset, sizeof(entry->MessageErrorRate)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->RxOnWhenIdle, write ? (uint8_t *) &entry->RxOnWhenIdle : src, write, - &entryOffset, sizeof(entry->RxOnWhenIdle)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->FullThreadDevice, write ? (uint8_t *) &entry->FullThreadDevice : src, - write, &entryOffset, sizeof(entry->FullThreadDevice)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->FullNetworkData, write ? (uint8_t *) &entry->FullNetworkData : src, - write, &entryOffset, sizeof(entry->FullNetworkData)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->IsChild, write ? (uint8_t *) &entry->IsChild : src, write, - &entryOffset, sizeof(entry->IsChild)); // BOOLEAN + if (write) + { + size_t unusedLen; + _NeighborTable::ToEmberBuffer(entry, dest + entryOffset, 31, unusedLen); + } + else + { + _NeighborTable::FromEmberBuffer(entry, src + entryOffset, 31); + } break; } case 0x0008: // RouteTableList @@ -378,26 +667,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _RouteTable _RouteTable * entry = reinterpret_cast<_RouteTable *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->ExtAddress, write ? (uint8_t *) &entry->ExtAddress : src, write, - &entryOffset, sizeof(entry->ExtAddress)); // INT64U - copyListMember(write ? dest : (uint8_t *) &entry->Rloc16, write ? (uint8_t *) &entry->Rloc16 : src, write, &entryOffset, - sizeof(entry->Rloc16)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->RouterId, write ? (uint8_t *) &entry->RouterId : src, write, - &entryOffset, sizeof(entry->RouterId)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->NextHop, write ? (uint8_t *) &entry->NextHop : src, write, - &entryOffset, sizeof(entry->NextHop)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->PathCost, write ? (uint8_t *) &entry->PathCost : src, write, - &entryOffset, sizeof(entry->PathCost)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->LQIIn, write ? (uint8_t *) &entry->LQIIn : src, write, &entryOffset, - sizeof(entry->LQIIn)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->LQIOut, write ? (uint8_t *) &entry->LQIOut : src, write, &entryOffset, - sizeof(entry->LQIOut)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->Age, write ? (uint8_t *) &entry->Age : src, write, &entryOffset, - sizeof(entry->Age)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->Allocated, write ? (uint8_t *) &entry->Allocated : src, write, - &entryOffset, sizeof(entry->Allocated)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->LinkEstablished, write ? (uint8_t *) &entry->LinkEstablished : src, - write, &entryOffset, sizeof(entry->LinkEstablished)); // BOOLEAN + if (write) + { + size_t unusedLen; + _RouteTable::ToEmberBuffer(entry, dest + entryOffset, 18, unusedLen); + } + else + { + _RouteTable::FromEmberBuffer(entry, src + entryOffset, 18); + } break; } case 0x003B: // SecurityPolicy @@ -411,10 +689,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _SecurityPolicy _SecurityPolicy * entry = reinterpret_cast<_SecurityPolicy *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->RotationTime, write ? (uint8_t *) &entry->RotationTime : src, write, - &entryOffset, sizeof(entry->RotationTime)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->Flags, write ? (uint8_t *) &entry->Flags : src, write, &entryOffset, - sizeof(entry->Flags)); // INT8U + if (write) + { + size_t unusedLen; + _SecurityPolicy::ToEmberBuffer(entry, dest + entryOffset, 3, unusedLen); + } + else + { + _SecurityPolicy::FromEmberBuffer(entry, src + entryOffset, 3); + } break; } case 0x003D: // OperationalDatasetComponents @@ -428,37 +711,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _OperationalDatasetComponents _OperationalDatasetComponents * entry = reinterpret_cast<_OperationalDatasetComponents *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->ActiveTimestampPresent, - write ? (uint8_t *) &entry->ActiveTimestampPresent : src, write, &entryOffset, - sizeof(entry->ActiveTimestampPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->PendingTimestampPresent, - write ? (uint8_t *) &entry->PendingTimestampPresent : src, write, &entryOffset, - sizeof(entry->PendingTimestampPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->MasterKeyPresent, write ? (uint8_t *) &entry->MasterKeyPresent : src, - write, &entryOffset, sizeof(entry->MasterKeyPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->NetworkNamePresent, - write ? (uint8_t *) &entry->NetworkNamePresent : src, write, &entryOffset, - sizeof(entry->NetworkNamePresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->ExtendedPanIdPresent, - write ? (uint8_t *) &entry->ExtendedPanIdPresent : src, write, &entryOffset, - sizeof(entry->ExtendedPanIdPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->MeshLocalPrefixPresent, - write ? (uint8_t *) &entry->MeshLocalPrefixPresent : src, write, &entryOffset, - sizeof(entry->MeshLocalPrefixPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->DelayPresent, write ? (uint8_t *) &entry->DelayPresent : src, write, - &entryOffset, sizeof(entry->DelayPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->PanIdPresent, write ? (uint8_t *) &entry->PanIdPresent : src, write, - &entryOffset, sizeof(entry->PanIdPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->ChannelPresent, write ? (uint8_t *) &entry->ChannelPresent : src, - write, &entryOffset, sizeof(entry->ChannelPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->PskcPresent, write ? (uint8_t *) &entry->PskcPresent : src, write, - &entryOffset, sizeof(entry->PskcPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->SecurityPolicyPresent, - write ? (uint8_t *) &entry->SecurityPolicyPresent : src, write, &entryOffset, - sizeof(entry->SecurityPolicyPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->ChannelMaskPresent, - write ? (uint8_t *) &entry->ChannelMaskPresent : src, write, &entryOffset, - sizeof(entry->ChannelMaskPresent)); // BOOLEAN + if (write) + { + size_t unusedLen; + _OperationalDatasetComponents::ToEmberBuffer(entry, dest + entryOffset, 12, unusedLen); + } + else + { + _OperationalDatasetComponents::FromEmberBuffer(entry, src + entryOffset, 12); + } break; } case 0x003E: // ActiveNetworkFaultsList diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index e226cea0ad9128..24d91b36d9d95c 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -724,7 +724,6 @@ static void OnApplicationLauncherApplicationLauncherListListAttributeResponse(vo ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } - static void OnAudioOutputAudioOutputListListAttributeResponse(void * context, uint16_t count, _AudioOutputInfo * entries) { ChipLogProgress(chipTool, "OnAudioOutputAudioOutputListListAttributeResponse: %" PRIu16 " entries", count); @@ -740,7 +739,6 @@ static void OnAudioOutputAudioOutputListListAttributeResponse(void * context, ui ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } - static void OnContentLauncherAcceptsHeaderListListAttributeResponse(void * context, uint16_t count, chip::ByteSpan * entries) { ChipLogProgress(chipTool, "OnContentLauncherAcceptsHeaderListListAttributeResponse: %" PRIu16 " entries", count); @@ -753,7 +751,6 @@ static void OnContentLauncherAcceptsHeaderListListAttributeResponse(void * conte ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } - static void OnContentLauncherSupportedStreamingTypesListAttributeResponse(void * context, uint16_t count, uint8_t * entries) { ChipLogProgress(chipTool, "OnContentLauncherSupportedStreamingTypesListAttributeResponse: %" PRIu16 " entries", count); @@ -766,7 +763,6 @@ static void OnContentLauncherSupportedStreamingTypesListAttributeResponse(void * ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } - static void OnDescriptorDeviceListListAttributeResponse(void * context, uint16_t count, _DeviceType * entries) { ChipLogProgress(chipTool, "OnDescriptorDeviceListListAttributeResponse: %" PRIu16 " entries", count); @@ -781,7 +777,6 @@ static void OnDescriptorDeviceListListAttributeResponse(void * context, uint16_t ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } - static void OnDescriptorServerListListAttributeResponse(void * context, uint16_t count, chip::ClusterId * entries) { ChipLogProgress(chipTool, "OnDescriptorServerListListAttributeResponse: %" PRIu16 " entries", count); @@ -794,7 +789,6 @@ static void OnDescriptorServerListListAttributeResponse(void * context, uint16_t ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } - static void OnDescriptorClientListListAttributeResponse(void * context, uint16_t count, chip::ClusterId * entries) { ChipLogProgress(chipTool, "OnDescriptorClientListListAttributeResponse: %" PRIu16 " entries", count); @@ -807,7 +801,6 @@ static void OnDescriptorClientListListAttributeResponse(void * context, uint16_t ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } - static void OnDescriptorPartsListListAttributeResponse(void * context, uint16_t count, chip::EndpointId * entries) { ChipLogProgress(chipTool, "OnDescriptorPartsListListAttributeResponse: %" PRIu16 " entries", count); @@ -820,7 +813,6 @@ static void OnDescriptorPartsListListAttributeResponse(void * context, uint16_t ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } - static void OnFixedLabelLabelListListAttributeResponse(void * context, uint16_t count, _LabelStruct * entries) { ChipLogProgress(chipTool, "OnFixedLabelLabelListListAttributeResponse: %" PRIu16 " entries", count); @@ -835,7 +827,6 @@ static void OnFixedLabelLabelListListAttributeResponse(void * context, uint16_t ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } - static void OnGeneralCommissioningBasicCommissioningInfoListListAttributeResponse(void * context, uint16_t count, _BasicCommissioningInfoType * entries) { @@ -850,7 +841,6 @@ static void OnGeneralCommissioningBasicCommissioningInfoListListAttributeRespons ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } - static void OnGeneralDiagnosticsNetworkInterfacesListAttributeResponse(void * context, uint16_t count, _NetworkInterfaceType * entries) { @@ -870,7 +860,6 @@ static void OnGeneralDiagnosticsNetworkInterfacesListAttributeResponse(void * co ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } - static void OnGroupKeyManagementGroupsListAttributeResponse(void * context, uint16_t count, _GroupState * entries) { ChipLogProgress(chipTool, "OnGroupKeyManagementGroupsListAttributeResponse: %" PRIu16 " entries", count); @@ -886,7 +875,6 @@ static void OnGroupKeyManagementGroupsListAttributeResponse(void * context, uint ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } - static void OnGroupKeyManagementGroupKeysListAttributeResponse(void * context, uint16_t count, _GroupKey * entries) { ChipLogProgress(chipTool, "OnGroupKeyManagementGroupKeysListAttributeResponse: %" PRIu16 " entries", count); @@ -904,7 +892,6 @@ static void OnGroupKeyManagementGroupKeysListAttributeResponse(void * context, u ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } - static void OnMediaInputMediaInputListListAttributeResponse(void * context, uint16_t count, _MediaInputInfo * entries) { ChipLogProgress(chipTool, "OnMediaInputMediaInputListListAttributeResponse: %" PRIu16 " entries", count); @@ -921,7 +908,6 @@ static void OnMediaInputMediaInputListListAttributeResponse(void * context, uint ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } - static void OnOperationalCredentialsFabricsListListAttributeResponse(void * context, uint16_t count, _FabricDescriptor * entries) { ChipLogProgress(chipTool, "OnOperationalCredentialsFabricsListListAttributeResponse: %" PRIu16 " entries", count); @@ -940,7 +926,6 @@ static void OnOperationalCredentialsFabricsListListAttributeResponse(void * cont ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } - static void OnTvChannelTvChannelListListAttributeResponse(void * context, uint16_t count, _TvChannelInfo * entries) { ChipLogProgress(chipTool, "OnTvChannelTvChannelListListAttributeResponse: %" PRIu16 " entries", count); @@ -958,7 +943,6 @@ static void OnTvChannelTvChannelListListAttributeResponse(void * context, uint16 ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } - static void OnTargetNavigatorTargetNavigatorListListAttributeResponse(void * context, uint16_t count, _NavigateTargetTargetInfo * entries) { @@ -974,7 +958,6 @@ static void OnTargetNavigatorTargetNavigatorListListAttributeResponse(void * con ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } - static void OnTestClusterListInt8uListAttributeResponse(void * context, uint16_t count, uint8_t * entries) { ChipLogProgress(chipTool, "OnTestClusterListInt8uListAttributeResponse: %" PRIu16 " entries", count); @@ -987,7 +970,6 @@ static void OnTestClusterListInt8uListAttributeResponse(void * context, uint16_t ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } - static void OnTestClusterListOctetStringListAttributeResponse(void * context, uint16_t count, chip::ByteSpan * entries) { ChipLogProgress(chipTool, "OnTestClusterListOctetStringListAttributeResponse: %" PRIu16 " entries", count); @@ -1000,7 +982,6 @@ static void OnTestClusterListOctetStringListAttributeResponse(void * context, ui ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } - static void OnTestClusterListStructOctetStringListAttributeResponse(void * context, uint16_t count, _TestListStructOctet * entries) { ChipLogProgress(chipTool, "OnTestClusterListStructOctetStringListAttributeResponse: %" PRIu16 " entries", count); @@ -1015,7 +996,13 @@ static void OnTestClusterListStructOctetStringListAttributeResponse(void * conte ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } - +static void OnTestClusterSimpleStructStructAttributeResponse(void * context, _simplestruct value) +{ + ChipLogProgress(chipTool, "OnTestClusterSimpleStructStructAttributeResponse: TODO: Print struct content."); + IgnoreUnusedVariable(value); + ModelCommand * command = reinterpret_cast(context); + command->SetCommandExitStatus(CHIP_NO_ERROR); +} static void OnThreadNetworkDiagnosticsNeighborTableListListAttributeResponse(void * context, uint16_t count, _NeighborTable * entries) { @@ -1043,7 +1030,6 @@ static void OnThreadNetworkDiagnosticsNeighborTableListListAttributeResponse(voi ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } - static void OnThreadNetworkDiagnosticsRouteTableListListAttributeResponse(void * context, uint16_t count, _RouteTable * entries) { ChipLogProgress(chipTool, "OnThreadNetworkDiagnosticsRouteTableListListAttributeResponse: %" PRIu16 " entries", count); @@ -1066,7 +1052,6 @@ static void OnThreadNetworkDiagnosticsRouteTableListListAttributeResponse(void * ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } - static void OnThreadNetworkDiagnosticsSecurityPolicyListAttributeResponse(void * context, uint16_t count, _SecurityPolicy * entries) { ChipLogProgress(chipTool, "OnThreadNetworkDiagnosticsSecurityPolicyListAttributeResponse: %" PRIu16 " entries", count); @@ -1081,7 +1066,6 @@ static void OnThreadNetworkDiagnosticsSecurityPolicyListAttributeResponse(void * ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } - static void OnThreadNetworkDiagnosticsOperationalDatasetComponentsListAttributeResponse(void * context, uint16_t count, _OperationalDatasetComponents * entries) { @@ -1108,7 +1092,6 @@ static void OnThreadNetworkDiagnosticsOperationalDatasetComponentsListAttributeR ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } - static void OnThreadNetworkDiagnosticsActiveNetworkFaultsListListAttributeResponse(void * context, uint16_t count, uint8_t * entries) { @@ -17587,6 +17570,7 @@ class ReadTemperatureMeasurementClusterRevision : public ModelCommand | * LongOctetString | 0x001D | | * CharString | 0x001E | | * LongCharString | 0x001F | +| * SimpleStruct | 0x0020 | | * Unsupported | 0x00FF | | * ClusterRevision | 0xFFFD | \*----------------------------------------------------------------------------*/ @@ -19154,6 +19138,41 @@ class WriteTestClusterLongCharString : public ModelCommand char * mValue; }; +/* + * Attribute SimpleStruct + */ +class ReadTestClusterSimpleStruct : public ModelCommand +{ +public: + ReadTestClusterSimpleStruct() : ModelCommand("read") + { + AddArgument("attr-name", "simple-struct"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterSimpleStruct() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x00) on endpoint %" PRIu8, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributeSimpleStruct(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnTestClusterSimpleStructStructAttributeResponse, + this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + /* * Attribute Unsupported */ @@ -25534,6 +25553,7 @@ void registerClusterTestCluster(Commands & commands) make_unique(), // make_unique(), // make_unique(), // + make_unique(), // make_unique(), // make_unique(), // make_unique(), // diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp index a96d32439c5168..c0a58485a7857e 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp @@ -30,6 +30,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -37,10 +40,6 @@ using namespace ::chip; using namespace ::chip::app::List; -namespace { -[[maybe_unused]] constexpr uint16_t kByteSpanSizeLengthInBytes = 2; -} // namespace - #define CHECK_STATUS_WITH_RETVAL(error, retval) \ if (CHIP_NO_ERROR != error) \ { \ @@ -355,927 +354,1118 @@ void ApplicationLauncherClusterApplicationLauncherListListAttributeFilter(TLV::T Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { - // TODO: Add actual support for array and lists. - const uint8_t * message = nullptr; - uint16_t messageLen = 0; - EmberAfStatus res = PrepareListFromTLV(tlvData, message, messageLen); - if (res != EMBER_ZCL_STATUS_SUCCESS) + CHIP_ERROR err = CHIP_NO_ERROR; + size_t count = 0; + TLV::TLVType tmpType; + TLV::TLVReader reader; + + if (tlvData != nullptr && tlvData->GetType() == chip::TLV::TLVType::kTLVType_Array) + { + reader.Init(*tlvData); + reader.EnterContainer(tmpType); + } + if (tlvData == nullptr || tlvData->GetType() != chip::TLV::TLVType::kTLVType_Array || + chip::TLV::Utilities::Count(reader, count, false /* recursive */) != CHIP_NO_ERROR || !chip::CanCastTo(count)) { Callback::Callback * cb = Callback::Callback::FromCancelable(onFailureCallback); - cb->mCall(cb->mContext, res); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); return; } - - CHECK_MESSAGE_LENGTH_VOID(2); - uint16_t count = Encoding::LittleEndian::Read16(message); uint16_t data[count]; - for (size_t i = 0; i < count; i++) + for (size_t i = 0; i < count && CHIP_NO_ERROR == (err = reader.Next()); i++) { - CHECK_MESSAGE_LENGTH_VOID(2); - data[i] = emberAfGetInt16u(message, 0, 2); - message += 2; + SuccessOrExit(reader.Get(data[i])); + } + SuccessOrExit(err); + // If we have exactly count elements, we should not see any errors above, but should meet an error exactly after we iterated all + // elements. + VerifyOrExit(reader.Next() == CHIP_END_OF_TLV, err = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT); +exit: + if (CHIP_NO_ERROR == err) + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, static_cast(count), data); + } + else + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); } - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, count, data); } - void AudioOutputClusterAudioOutputListListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { - // TODO: Add actual support for array and lists. - const uint8_t * message = nullptr; - uint16_t messageLen = 0; - EmberAfStatus res = PrepareListFromTLV(tlvData, message, messageLen); - if (res != EMBER_ZCL_STATUS_SUCCESS) + CHIP_ERROR err = CHIP_NO_ERROR; + size_t count = 0; + TLV::TLVType tmpType; + TLV::TLVReader reader; + + if (tlvData != nullptr && tlvData->GetType() == chip::TLV::TLVType::kTLVType_Array) + { + reader.Init(*tlvData); + reader.EnterContainer(tmpType); + } + if (tlvData == nullptr || tlvData->GetType() != chip::TLV::TLVType::kTLVType_Array || + chip::TLV::Utilities::Count(reader, count, false /* recursive */) != CHIP_NO_ERROR || !chip::CanCastTo(count)) { Callback::Callback * cb = Callback::Callback::FromCancelable(onFailureCallback); - cb->mCall(cb->mContext, res); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); return; } - - CHECK_MESSAGE_LENGTH_VOID(2); - uint16_t count = Encoding::LittleEndian::Read16(message); _AudioOutputInfo data[count]; - for (size_t i = 0; i < count; i++) + for (size_t i = 0; i < count && CHIP_NO_ERROR == (err = reader.Next()); i++) + { + SuccessOrExit(reader.Get(data[i])); + } + SuccessOrExit(err); + // If we have exactly count elements, we should not see any errors above, but should meet an error exactly after we iterated all + // elements. + VerifyOrExit(reader.Next() == CHIP_END_OF_TLV, err = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT); +exit: + if (CHIP_NO_ERROR == err) { - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].index = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].outputType = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_STATUS_VOID(ReadByteSpan(message, 34, &data[i].name)); - messageLen = static_cast(messageLen - 34); - message += 34; + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, static_cast(count), data); + } + else + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); } - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, count, data); } - void ContentLauncherClusterAcceptsHeaderListListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { - // TODO: Add actual support for array and lists. - const uint8_t * message = nullptr; - uint16_t messageLen = 0; - EmberAfStatus res = PrepareListFromTLV(tlvData, message, messageLen); - if (res != EMBER_ZCL_STATUS_SUCCESS) + CHIP_ERROR err = CHIP_NO_ERROR; + size_t count = 0; + TLV::TLVType tmpType; + TLV::TLVReader reader; + + if (tlvData != nullptr && tlvData->GetType() == chip::TLV::TLVType::kTLVType_Array) + { + reader.Init(*tlvData); + reader.EnterContainer(tmpType); + } + if (tlvData == nullptr || tlvData->GetType() != chip::TLV::TLVType::kTLVType_Array || + chip::TLV::Utilities::Count(reader, count, false /* recursive */) != CHIP_NO_ERROR || !chip::CanCastTo(count)) { Callback::Callback * cb = Callback::Callback::FromCancelable(onFailureCallback); - cb->mCall(cb->mContext, res); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); return; } - - CHECK_MESSAGE_LENGTH_VOID(2); - uint16_t count = Encoding::LittleEndian::Read16(message); chip::ByteSpan data[count]; - for (size_t i = 0; i < count; i++) + for (size_t i = 0; i < count && CHIP_NO_ERROR == (err = reader.Next()); i++) + { + const uint8_t * dataPtr = nullptr; + SuccessOrExit(reader.GetDataPtr(dataPtr)); + data[i] = chip::ByteSpan(dataPtr, reader.GetLength()); + } + SuccessOrExit(err); + // If we have exactly count elements, we should not see any errors above, but should meet an error exactly after we iterated all + // elements. + VerifyOrExit(reader.Next() == CHIP_END_OF_TLV, err = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT); +exit: + if (CHIP_NO_ERROR == err) + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, static_cast(count), data); + } + else { - CHECK_STATUS_VOID(ReadByteSpan(message, messageLen, &data[i])); - uint16_t entryLength = static_cast(data[i].size() + kByteSpanSizeLengthInBytes); - messageLen = static_cast(messageLen - entryLength); - message += entryLength; + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); } - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, count, data); } - void ContentLauncherClusterSupportedStreamingTypesListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { - // TODO: Add actual support for array and lists. - const uint8_t * message = nullptr; - uint16_t messageLen = 0; - EmberAfStatus res = PrepareListFromTLV(tlvData, message, messageLen); - if (res != EMBER_ZCL_STATUS_SUCCESS) + CHIP_ERROR err = CHIP_NO_ERROR; + size_t count = 0; + TLV::TLVType tmpType; + TLV::TLVReader reader; + + if (tlvData != nullptr && tlvData->GetType() == chip::TLV::TLVType::kTLVType_Array) + { + reader.Init(*tlvData); + reader.EnterContainer(tmpType); + } + if (tlvData == nullptr || tlvData->GetType() != chip::TLV::TLVType::kTLVType_Array || + chip::TLV::Utilities::Count(reader, count, false /* recursive */) != CHIP_NO_ERROR || !chip::CanCastTo(count)) { Callback::Callback * cb = Callback::Callback::FromCancelable(onFailureCallback); - cb->mCall(cb->mContext, res); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); return; } - - CHECK_MESSAGE_LENGTH_VOID(2); - uint16_t count = Encoding::LittleEndian::Read16(message); uint8_t data[count]; - for (size_t i = 0; i < count; i++) + for (size_t i = 0; i < count && CHIP_NO_ERROR == (err = reader.Next()); i++) + { + SuccessOrExit(reader.Get(data[i])); + } + SuccessOrExit(err); + // If we have exactly count elements, we should not see any errors above, but should meet an error exactly after we iterated all + // elements. + VerifyOrExit(reader.Next() == CHIP_END_OF_TLV, err = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT); +exit: + if (CHIP_NO_ERROR == err) { - CHECK_MESSAGE_LENGTH_VOID(1); - data[i] = emberAfGetInt8u(message, 0, 1); - message += 1; + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, static_cast(count), data); + } + else + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); } - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, count, data); } - void DescriptorClusterDeviceListListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { - // TODO: Add actual support for array and lists. - const uint8_t * message = nullptr; - uint16_t messageLen = 0; - EmberAfStatus res = PrepareListFromTLV(tlvData, message, messageLen); - if (res != EMBER_ZCL_STATUS_SUCCESS) + CHIP_ERROR err = CHIP_NO_ERROR; + size_t count = 0; + TLV::TLVType tmpType; + TLV::TLVReader reader; + + if (tlvData != nullptr && tlvData->GetType() == chip::TLV::TLVType::kTLVType_Array) + { + reader.Init(*tlvData); + reader.EnterContainer(tmpType); + } + if (tlvData == nullptr || tlvData->GetType() != chip::TLV::TLVType::kTLVType_Array || + chip::TLV::Utilities::Count(reader, count, false /* recursive */) != CHIP_NO_ERROR || !chip::CanCastTo(count)) { Callback::Callback * cb = Callback::Callback::FromCancelable(onFailureCallback); - cb->mCall(cb->mContext, res); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); return; } - - CHECK_MESSAGE_LENGTH_VOID(2); - uint16_t count = Encoding::LittleEndian::Read16(message); _DeviceType data[count]; - for (size_t i = 0; i < count; i++) + for (size_t i = 0; i < count && CHIP_NO_ERROR == (err = reader.Next()); i++) + { + SuccessOrExit(reader.Get(data[i])); + } + SuccessOrExit(err); + // If we have exactly count elements, we should not see any errors above, but should meet an error exactly after we iterated all + // elements. + VerifyOrExit(reader.Next() == CHIP_END_OF_TLV, err = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT); +exit: + if (CHIP_NO_ERROR == err) { - CHECK_MESSAGE_LENGTH_VOID(4); - data[i].type = emberAfGetInt32u(message, 0, 4); - message += 4; - CHECK_MESSAGE_LENGTH_VOID(2); - data[i].revision = emberAfGetInt16u(message, 0, 2); - message += 2; + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, static_cast(count), data); + } + else + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); } - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, count, data); } - void DescriptorClusterServerListListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { - // TODO: Add actual support for array and lists. - const uint8_t * message = nullptr; - uint16_t messageLen = 0; - EmberAfStatus res = PrepareListFromTLV(tlvData, message, messageLen); - if (res != EMBER_ZCL_STATUS_SUCCESS) + CHIP_ERROR err = CHIP_NO_ERROR; + size_t count = 0; + TLV::TLVType tmpType; + TLV::TLVReader reader; + + if (tlvData != nullptr && tlvData->GetType() == chip::TLV::TLVType::kTLVType_Array) + { + reader.Init(*tlvData); + reader.EnterContainer(tmpType); + } + if (tlvData == nullptr || tlvData->GetType() != chip::TLV::TLVType::kTLVType_Array || + chip::TLV::Utilities::Count(reader, count, false /* recursive */) != CHIP_NO_ERROR || !chip::CanCastTo(count)) { Callback::Callback * cb = Callback::Callback::FromCancelable(onFailureCallback); - cb->mCall(cb->mContext, res); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); return; } - - CHECK_MESSAGE_LENGTH_VOID(2); - uint16_t count = Encoding::LittleEndian::Read16(message); chip::ClusterId data[count]; - for (size_t i = 0; i < count; i++) + for (size_t i = 0; i < count && CHIP_NO_ERROR == (err = reader.Next()); i++) + { + SuccessOrExit(reader.Get(data[i])); + } + SuccessOrExit(err); + // If we have exactly count elements, we should not see any errors above, but should meet an error exactly after we iterated all + // elements. + VerifyOrExit(reader.Next() == CHIP_END_OF_TLV, err = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT); +exit: + if (CHIP_NO_ERROR == err) + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, static_cast(count), data); + } + else { - CHECK_MESSAGE_LENGTH_VOID(4); - data[i] = emberAfGetInt32u(message, 0, 4); - message += 4; + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); } - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, count, data); } - void DescriptorClusterClientListListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { - // TODO: Add actual support for array and lists. - const uint8_t * message = nullptr; - uint16_t messageLen = 0; - EmberAfStatus res = PrepareListFromTLV(tlvData, message, messageLen); - if (res != EMBER_ZCL_STATUS_SUCCESS) + CHIP_ERROR err = CHIP_NO_ERROR; + size_t count = 0; + TLV::TLVType tmpType; + TLV::TLVReader reader; + + if (tlvData != nullptr && tlvData->GetType() == chip::TLV::TLVType::kTLVType_Array) + { + reader.Init(*tlvData); + reader.EnterContainer(tmpType); + } + if (tlvData == nullptr || tlvData->GetType() != chip::TLV::TLVType::kTLVType_Array || + chip::TLV::Utilities::Count(reader, count, false /* recursive */) != CHIP_NO_ERROR || !chip::CanCastTo(count)) { Callback::Callback * cb = Callback::Callback::FromCancelable(onFailureCallback); - cb->mCall(cb->mContext, res); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); return; } - - CHECK_MESSAGE_LENGTH_VOID(2); - uint16_t count = Encoding::LittleEndian::Read16(message); chip::ClusterId data[count]; - for (size_t i = 0; i < count; i++) + for (size_t i = 0; i < count && CHIP_NO_ERROR == (err = reader.Next()); i++) + { + SuccessOrExit(reader.Get(data[i])); + } + SuccessOrExit(err); + // If we have exactly count elements, we should not see any errors above, but should meet an error exactly after we iterated all + // elements. + VerifyOrExit(reader.Next() == CHIP_END_OF_TLV, err = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT); +exit: + if (CHIP_NO_ERROR == err) { - CHECK_MESSAGE_LENGTH_VOID(4); - data[i] = emberAfGetInt32u(message, 0, 4); - message += 4; + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, static_cast(count), data); + } + else + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); } - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, count, data); } - void DescriptorClusterPartsListListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { - // TODO: Add actual support for array and lists. - const uint8_t * message = nullptr; - uint16_t messageLen = 0; - EmberAfStatus res = PrepareListFromTLV(tlvData, message, messageLen); - if (res != EMBER_ZCL_STATUS_SUCCESS) + CHIP_ERROR err = CHIP_NO_ERROR; + size_t count = 0; + TLV::TLVType tmpType; + TLV::TLVReader reader; + + if (tlvData != nullptr && tlvData->GetType() == chip::TLV::TLVType::kTLVType_Array) + { + reader.Init(*tlvData); + reader.EnterContainer(tmpType); + } + if (tlvData == nullptr || tlvData->GetType() != chip::TLV::TLVType::kTLVType_Array || + chip::TLV::Utilities::Count(reader, count, false /* recursive */) != CHIP_NO_ERROR || !chip::CanCastTo(count)) { Callback::Callback * cb = Callback::Callback::FromCancelable(onFailureCallback); - cb->mCall(cb->mContext, res); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); return; } - - CHECK_MESSAGE_LENGTH_VOID(2); - uint16_t count = Encoding::LittleEndian::Read16(message); chip::EndpointId data[count]; - for (size_t i = 0; i < count; i++) + for (size_t i = 0; i < count && CHIP_NO_ERROR == (err = reader.Next()); i++) { - CHECK_MESSAGE_LENGTH_VOID(2); - data[i] = emberAfGetInt16u(message, 0, 2); - message += 2; + SuccessOrExit(reader.Get(data[i])); + } + SuccessOrExit(err); + // If we have exactly count elements, we should not see any errors above, but should meet an error exactly after we iterated all + // elements. + VerifyOrExit(reader.Next() == CHIP_END_OF_TLV, err = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT); +exit: + if (CHIP_NO_ERROR == err) + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, static_cast(count), data); + } + else + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); } - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, count, data); } - void FixedLabelClusterLabelListListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { - // TODO: Add actual support for array and lists. - const uint8_t * message = nullptr; - uint16_t messageLen = 0; - EmberAfStatus res = PrepareListFromTLV(tlvData, message, messageLen); - if (res != EMBER_ZCL_STATUS_SUCCESS) + CHIP_ERROR err = CHIP_NO_ERROR; + size_t count = 0; + TLV::TLVType tmpType; + TLV::TLVReader reader; + + if (tlvData != nullptr && tlvData->GetType() == chip::TLV::TLVType::kTLVType_Array) + { + reader.Init(*tlvData); + reader.EnterContainer(tmpType); + } + if (tlvData == nullptr || tlvData->GetType() != chip::TLV::TLVType::kTLVType_Array || + chip::TLV::Utilities::Count(reader, count, false /* recursive */) != CHIP_NO_ERROR || !chip::CanCastTo(count)) { Callback::Callback * cb = Callback::Callback::FromCancelable(onFailureCallback); - cb->mCall(cb->mContext, res); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); return; } - - CHECK_MESSAGE_LENGTH_VOID(2); - uint16_t count = Encoding::LittleEndian::Read16(message); _LabelStruct data[count]; - for (size_t i = 0; i < count; i++) + for (size_t i = 0; i < count && CHIP_NO_ERROR == (err = reader.Next()); i++) + { + SuccessOrExit(reader.Get(data[i])); + } + SuccessOrExit(err); + // If we have exactly count elements, we should not see any errors above, but should meet an error exactly after we iterated all + // elements. + VerifyOrExit(reader.Next() == CHIP_END_OF_TLV, err = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT); +exit: + if (CHIP_NO_ERROR == err) { - CHECK_STATUS_VOID(ReadByteSpan(message, 18, &data[i].label)); - messageLen = static_cast(messageLen - 18); - message += 18; - CHECK_STATUS_VOID(ReadByteSpan(message, 18, &data[i].value)); - messageLen = static_cast(messageLen - 18); - message += 18; + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, static_cast(count), data); + } + else + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); } - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, count, data); } - void GeneralCommissioningClusterBasicCommissioningInfoListListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { - // TODO: Add actual support for array and lists. - const uint8_t * message = nullptr; - uint16_t messageLen = 0; - EmberAfStatus res = PrepareListFromTLV(tlvData, message, messageLen); - if (res != EMBER_ZCL_STATUS_SUCCESS) + CHIP_ERROR err = CHIP_NO_ERROR; + size_t count = 0; + TLV::TLVType tmpType; + TLV::TLVReader reader; + + if (tlvData != nullptr && tlvData->GetType() == chip::TLV::TLVType::kTLVType_Array) + { + reader.Init(*tlvData); + reader.EnterContainer(tmpType); + } + if (tlvData == nullptr || tlvData->GetType() != chip::TLV::TLVType::kTLVType_Array || + chip::TLV::Utilities::Count(reader, count, false /* recursive */) != CHIP_NO_ERROR || !chip::CanCastTo(count)) { Callback::Callback * cb = Callback::Callback::FromCancelable(onFailureCallback); - cb->mCall(cb->mContext, res); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); return; } - - CHECK_MESSAGE_LENGTH_VOID(2); - uint16_t count = Encoding::LittleEndian::Read16(message); _BasicCommissioningInfoType data[count]; - for (size_t i = 0; i < count; i++) + for (size_t i = 0; i < count && CHIP_NO_ERROR == (err = reader.Next()); i++) + { + SuccessOrExit(reader.Get(data[i])); + } + SuccessOrExit(err); + // If we have exactly count elements, we should not see any errors above, but should meet an error exactly after we iterated all + // elements. + VerifyOrExit(reader.Next() == CHIP_END_OF_TLV, err = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT); +exit: + if (CHIP_NO_ERROR == err) { - CHECK_MESSAGE_LENGTH_VOID(4); - data[i].FailSafeExpiryLengthMs = emberAfGetInt32u(message, 0, 4); - message += 4; + Callback::Callback * cb = + Callback::Callback::FromCancelable( + onSuccessCallback); + cb->mCall(cb->mContext, static_cast(count), data); + } + else + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); } - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, count, data); } - void GeneralDiagnosticsClusterNetworkInterfacesListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { - // TODO: Add actual support for array and lists. - const uint8_t * message = nullptr; - uint16_t messageLen = 0; - EmberAfStatus res = PrepareListFromTLV(tlvData, message, messageLen); - if (res != EMBER_ZCL_STATUS_SUCCESS) + CHIP_ERROR err = CHIP_NO_ERROR; + size_t count = 0; + TLV::TLVType tmpType; + TLV::TLVReader reader; + + if (tlvData != nullptr && tlvData->GetType() == chip::TLV::TLVType::kTLVType_Array) + { + reader.Init(*tlvData); + reader.EnterContainer(tmpType); + } + if (tlvData == nullptr || tlvData->GetType() != chip::TLV::TLVType::kTLVType_Array || + chip::TLV::Utilities::Count(reader, count, false /* recursive */) != CHIP_NO_ERROR || !chip::CanCastTo(count)) { Callback::Callback * cb = Callback::Callback::FromCancelable(onFailureCallback); - cb->mCall(cb->mContext, res); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); return; } - - CHECK_MESSAGE_LENGTH_VOID(2); - uint16_t count = Encoding::LittleEndian::Read16(message); _NetworkInterfaceType data[count]; - for (size_t i = 0; i < count; i++) - { - CHECK_STATUS_VOID(ReadByteSpan(message, 34, &data[i].Name)); - messageLen = static_cast(messageLen - 34); - message += 34; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].FabricConnected = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].OffPremiseServicesReachableIPv4 = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].OffPremiseServicesReachableIPv6 = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_STATUS_VOID(ReadByteSpan(message, 10, &data[i].HardwareAddress)); - messageLen = static_cast(messageLen - 10); - message += 10; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].Type = emberAfGetInt8u(message, 0, 1); - message += 1; - } - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, count, data); + for (size_t i = 0; i < count && CHIP_NO_ERROR == (err = reader.Next()); i++) + { + SuccessOrExit(reader.Get(data[i])); + } + SuccessOrExit(err); + // If we have exactly count elements, we should not see any errors above, but should meet an error exactly after we iterated all + // elements. + VerifyOrExit(reader.Next() == CHIP_END_OF_TLV, err = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT); +exit: + if (CHIP_NO_ERROR == err) + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, static_cast(count), data); + } + else + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); + } } - void GroupKeyManagementClusterGroupsListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { - // TODO: Add actual support for array and lists. - const uint8_t * message = nullptr; - uint16_t messageLen = 0; - EmberAfStatus res = PrepareListFromTLV(tlvData, message, messageLen); - if (res != EMBER_ZCL_STATUS_SUCCESS) + CHIP_ERROR err = CHIP_NO_ERROR; + size_t count = 0; + TLV::TLVType tmpType; + TLV::TLVReader reader; + + if (tlvData != nullptr && tlvData->GetType() == chip::TLV::TLVType::kTLVType_Array) + { + reader.Init(*tlvData); + reader.EnterContainer(tmpType); + } + if (tlvData == nullptr || tlvData->GetType() != chip::TLV::TLVType::kTLVType_Array || + chip::TLV::Utilities::Count(reader, count, false /* recursive */) != CHIP_NO_ERROR || !chip::CanCastTo(count)) { Callback::Callback * cb = Callback::Callback::FromCancelable(onFailureCallback); - cb->mCall(cb->mContext, res); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); return; } - - CHECK_MESSAGE_LENGTH_VOID(2); - uint16_t count = Encoding::LittleEndian::Read16(message); _GroupState data[count]; - for (size_t i = 0; i < count; i++) + for (size_t i = 0; i < count && CHIP_NO_ERROR == (err = reader.Next()); i++) { - CHECK_MESSAGE_LENGTH_VOID(2); - data[i].VendorId = emberAfGetInt16u(message, 0, 2); - message += 2; - CHECK_MESSAGE_LENGTH_VOID(2); - data[i].VendorGroupId = emberAfGetInt16u(message, 0, 2); - message += 2; - CHECK_MESSAGE_LENGTH_VOID(2); - data[i].GroupKeySetIndex = emberAfGetInt16u(message, 0, 2); - message += 2; + SuccessOrExit(reader.Get(data[i])); + } + SuccessOrExit(err); + // If we have exactly count elements, we should not see any errors above, but should meet an error exactly after we iterated all + // elements. + VerifyOrExit(reader.Next() == CHIP_END_OF_TLV, err = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT); +exit: + if (CHIP_NO_ERROR == err) + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, static_cast(count), data); + } + else + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); } - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, count, data); } - void GroupKeyManagementClusterGroupKeysListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { - // TODO: Add actual support for array and lists. - const uint8_t * message = nullptr; - uint16_t messageLen = 0; - EmberAfStatus res = PrepareListFromTLV(tlvData, message, messageLen); - if (res != EMBER_ZCL_STATUS_SUCCESS) + CHIP_ERROR err = CHIP_NO_ERROR; + size_t count = 0; + TLV::TLVType tmpType; + TLV::TLVReader reader; + + if (tlvData != nullptr && tlvData->GetType() == chip::TLV::TLVType::kTLVType_Array) + { + reader.Init(*tlvData); + reader.EnterContainer(tmpType); + } + if (tlvData == nullptr || tlvData->GetType() != chip::TLV::TLVType::kTLVType_Array || + chip::TLV::Utilities::Count(reader, count, false /* recursive */) != CHIP_NO_ERROR || !chip::CanCastTo(count)) { Callback::Callback * cb = Callback::Callback::FromCancelable(onFailureCallback); - cb->mCall(cb->mContext, res); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); return; } - - CHECK_MESSAGE_LENGTH_VOID(2); - uint16_t count = Encoding::LittleEndian::Read16(message); _GroupKey data[count]; - for (size_t i = 0; i < count; i++) - { - CHECK_MESSAGE_LENGTH_VOID(2); - data[i].VendorId = emberAfGetInt16u(message, 0, 2); - message += 2; - CHECK_MESSAGE_LENGTH_VOID(2); - data[i].GroupKeyIndex = emberAfGetInt16u(message, 0, 2); - message += 2; - CHECK_STATUS_VOID(ReadByteSpan(message, 18, &data[i].GroupKeyRoot)); - messageLen = static_cast(messageLen - 18); - message += 18; - CHECK_MESSAGE_LENGTH_VOID(8); - data[i].GroupKeyEpochStartTime = emberAfGetInt64u(message, 0, 8); - message += 8; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].GroupKeySecurityPolicy = emberAfGetInt8u(message, 0, 1); - message += 1; - } - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, count, data); + for (size_t i = 0; i < count && CHIP_NO_ERROR == (err = reader.Next()); i++) + { + SuccessOrExit(reader.Get(data[i])); + } + SuccessOrExit(err); + // If we have exactly count elements, we should not see any errors above, but should meet an error exactly after we iterated all + // elements. + VerifyOrExit(reader.Next() == CHIP_END_OF_TLV, err = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT); +exit: + if (CHIP_NO_ERROR == err) + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, static_cast(count), data); + } + else + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); + } } - void MediaInputClusterMediaInputListListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { - // TODO: Add actual support for array and lists. - const uint8_t * message = nullptr; - uint16_t messageLen = 0; - EmberAfStatus res = PrepareListFromTLV(tlvData, message, messageLen); - if (res != EMBER_ZCL_STATUS_SUCCESS) + CHIP_ERROR err = CHIP_NO_ERROR; + size_t count = 0; + TLV::TLVType tmpType; + TLV::TLVReader reader; + + if (tlvData != nullptr && tlvData->GetType() == chip::TLV::TLVType::kTLVType_Array) + { + reader.Init(*tlvData); + reader.EnterContainer(tmpType); + } + if (tlvData == nullptr || tlvData->GetType() != chip::TLV::TLVType::kTLVType_Array || + chip::TLV::Utilities::Count(reader, count, false /* recursive */) != CHIP_NO_ERROR || !chip::CanCastTo(count)) { Callback::Callback * cb = Callback::Callback::FromCancelable(onFailureCallback); - cb->mCall(cb->mContext, res); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); return; } - - CHECK_MESSAGE_LENGTH_VOID(2); - uint16_t count = Encoding::LittleEndian::Read16(message); _MediaInputInfo data[count]; - for (size_t i = 0; i < count; i++) - { - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].index = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].inputType = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_STATUS_VOID(ReadByteSpan(message, 34, &data[i].name)); - messageLen = static_cast(messageLen - 34); - message += 34; - CHECK_STATUS_VOID(ReadByteSpan(message, 34, &data[i].description)); - messageLen = static_cast(messageLen - 34); - message += 34; - } - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, count, data); + for (size_t i = 0; i < count && CHIP_NO_ERROR == (err = reader.Next()); i++) + { + SuccessOrExit(reader.Get(data[i])); + } + SuccessOrExit(err); + // If we have exactly count elements, we should not see any errors above, but should meet an error exactly after we iterated all + // elements. + VerifyOrExit(reader.Next() == CHIP_END_OF_TLV, err = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT); +exit: + if (CHIP_NO_ERROR == err) + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, static_cast(count), data); + } + else + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); + } } - void OperationalCredentialsClusterFabricsListListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { - // TODO: Add actual support for array and lists. - const uint8_t * message = nullptr; - uint16_t messageLen = 0; - EmberAfStatus res = PrepareListFromTLV(tlvData, message, messageLen); - if (res != EMBER_ZCL_STATUS_SUCCESS) + CHIP_ERROR err = CHIP_NO_ERROR; + size_t count = 0; + TLV::TLVType tmpType; + TLV::TLVReader reader; + + if (tlvData != nullptr && tlvData->GetType() == chip::TLV::TLVType::kTLVType_Array) + { + reader.Init(*tlvData); + reader.EnterContainer(tmpType); + } + if (tlvData == nullptr || tlvData->GetType() != chip::TLV::TLVType::kTLVType_Array || + chip::TLV::Utilities::Count(reader, count, false /* recursive */) != CHIP_NO_ERROR || !chip::CanCastTo(count)) { Callback::Callback * cb = Callback::Callback::FromCancelable(onFailureCallback); - cb->mCall(cb->mContext, res); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); return; } - - CHECK_MESSAGE_LENGTH_VOID(2); - uint16_t count = Encoding::LittleEndian::Read16(message); _FabricDescriptor data[count]; - for (size_t i = 0; i < count; i++) - { - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].FabricIndex = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_STATUS_VOID(ReadByteSpan(message, 67, &data[i].RootPublicKey)); - messageLen = static_cast(messageLen - 67); - message += 67; - CHECK_MESSAGE_LENGTH_VOID(2); - data[i].VendorId = emberAfGetInt16u(message, 0, 2); - message += 2; - CHECK_MESSAGE_LENGTH_VOID(8); - data[i].FabricId = emberAfGetInt64u(message, 0, 8); - message += 8; - CHECK_MESSAGE_LENGTH_VOID(8); - data[i].NodeId = emberAfGetInt64u(message, 0, 8); - message += 8; - CHECK_STATUS_VOID(ReadByteSpan(message, 34, &data[i].Label)); - messageLen = static_cast(messageLen - 34); - message += 34; - } - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, count, data); + for (size_t i = 0; i < count && CHIP_NO_ERROR == (err = reader.Next()); i++) + { + SuccessOrExit(reader.Get(data[i])); + } + SuccessOrExit(err); + // If we have exactly count elements, we should not see any errors above, but should meet an error exactly after we iterated all + // elements. + VerifyOrExit(reader.Next() == CHIP_END_OF_TLV, err = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT); +exit: + if (CHIP_NO_ERROR == err) + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, static_cast(count), data); + } + else + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); + } } - void TvChannelClusterTvChannelListListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { - // TODO: Add actual support for array and lists. - const uint8_t * message = nullptr; - uint16_t messageLen = 0; - EmberAfStatus res = PrepareListFromTLV(tlvData, message, messageLen); - if (res != EMBER_ZCL_STATUS_SUCCESS) + CHIP_ERROR err = CHIP_NO_ERROR; + size_t count = 0; + TLV::TLVType tmpType; + TLV::TLVReader reader; + + if (tlvData != nullptr && tlvData->GetType() == chip::TLV::TLVType::kTLVType_Array) + { + reader.Init(*tlvData); + reader.EnterContainer(tmpType); + } + if (tlvData == nullptr || tlvData->GetType() != chip::TLV::TLVType::kTLVType_Array || + chip::TLV::Utilities::Count(reader, count, false /* recursive */) != CHIP_NO_ERROR || !chip::CanCastTo(count)) { Callback::Callback * cb = Callback::Callback::FromCancelable(onFailureCallback); - cb->mCall(cb->mContext, res); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); return; } - - CHECK_MESSAGE_LENGTH_VOID(2); - uint16_t count = Encoding::LittleEndian::Read16(message); _TvChannelInfo data[count]; - for (size_t i = 0; i < count; i++) - { - CHECK_MESSAGE_LENGTH_VOID(2); - data[i].majorNumber = emberAfGetInt16u(message, 0, 2); - message += 2; - CHECK_MESSAGE_LENGTH_VOID(2); - data[i].minorNumber = emberAfGetInt16u(message, 0, 2); - message += 2; - CHECK_STATUS_VOID(ReadByteSpan(message, 34, &data[i].name)); - messageLen = static_cast(messageLen - 34); - message += 34; - CHECK_STATUS_VOID(ReadByteSpan(message, 34, &data[i].callSign)); - messageLen = static_cast(messageLen - 34); - message += 34; - CHECK_STATUS_VOID(ReadByteSpan(message, 34, &data[i].affiliateCallSign)); - messageLen = static_cast(messageLen - 34); - message += 34; - } - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, count, data); + for (size_t i = 0; i < count && CHIP_NO_ERROR == (err = reader.Next()); i++) + { + SuccessOrExit(reader.Get(data[i])); + } + SuccessOrExit(err); + // If we have exactly count elements, we should not see any errors above, but should meet an error exactly after we iterated all + // elements. + VerifyOrExit(reader.Next() == CHIP_END_OF_TLV, err = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT); +exit: + if (CHIP_NO_ERROR == err) + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, static_cast(count), data); + } + else + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); + } } - void TargetNavigatorClusterTargetNavigatorListListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { - // TODO: Add actual support for array and lists. - const uint8_t * message = nullptr; - uint16_t messageLen = 0; - EmberAfStatus res = PrepareListFromTLV(tlvData, message, messageLen); - if (res != EMBER_ZCL_STATUS_SUCCESS) + CHIP_ERROR err = CHIP_NO_ERROR; + size_t count = 0; + TLV::TLVType tmpType; + TLV::TLVReader reader; + + if (tlvData != nullptr && tlvData->GetType() == chip::TLV::TLVType::kTLVType_Array) + { + reader.Init(*tlvData); + reader.EnterContainer(tmpType); + } + if (tlvData == nullptr || tlvData->GetType() != chip::TLV::TLVType::kTLVType_Array || + chip::TLV::Utilities::Count(reader, count, false /* recursive */) != CHIP_NO_ERROR || !chip::CanCastTo(count)) { Callback::Callback * cb = Callback::Callback::FromCancelable(onFailureCallback); - cb->mCall(cb->mContext, res); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); return; } - - CHECK_MESSAGE_LENGTH_VOID(2); - uint16_t count = Encoding::LittleEndian::Read16(message); _NavigateTargetTargetInfo data[count]; - for (size_t i = 0; i < count; i++) + for (size_t i = 0; i < count && CHIP_NO_ERROR == (err = reader.Next()); i++) + { + SuccessOrExit(reader.Get(data[i])); + } + SuccessOrExit(err); + // If we have exactly count elements, we should not see any errors above, but should meet an error exactly after we iterated all + // elements. + VerifyOrExit(reader.Next() == CHIP_END_OF_TLV, err = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT); +exit: + if (CHIP_NO_ERROR == err) + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, static_cast(count), data); + } + else { - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].identifier = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_STATUS_VOID(ReadByteSpan(message, 34, &data[i].name)); - messageLen = static_cast(messageLen - 34); - message += 34; + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); } - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, count, data); } - void TestClusterClusterListInt8uListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { - // TODO: Add actual support for array and lists. - const uint8_t * message = nullptr; - uint16_t messageLen = 0; - EmberAfStatus res = PrepareListFromTLV(tlvData, message, messageLen); - if (res != EMBER_ZCL_STATUS_SUCCESS) + CHIP_ERROR err = CHIP_NO_ERROR; + size_t count = 0; + TLV::TLVType tmpType; + TLV::TLVReader reader; + + if (tlvData != nullptr && tlvData->GetType() == chip::TLV::TLVType::kTLVType_Array) + { + reader.Init(*tlvData); + reader.EnterContainer(tmpType); + } + if (tlvData == nullptr || tlvData->GetType() != chip::TLV::TLVType::kTLVType_Array || + chip::TLV::Utilities::Count(reader, count, false /* recursive */) != CHIP_NO_ERROR || !chip::CanCastTo(count)) { Callback::Callback * cb = Callback::Callback::FromCancelable(onFailureCallback); - cb->mCall(cb->mContext, res); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); return; } - - CHECK_MESSAGE_LENGTH_VOID(2); - uint16_t count = Encoding::LittleEndian::Read16(message); uint8_t data[count]; - for (size_t i = 0; i < count; i++) + for (size_t i = 0; i < count && CHIP_NO_ERROR == (err = reader.Next()); i++) + { + SuccessOrExit(reader.Get(data[i])); + } + SuccessOrExit(err); + // If we have exactly count elements, we should not see any errors above, but should meet an error exactly after we iterated all + // elements. + VerifyOrExit(reader.Next() == CHIP_END_OF_TLV, err = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT); +exit: + if (CHIP_NO_ERROR == err) { - CHECK_MESSAGE_LENGTH_VOID(1); - data[i] = emberAfGetInt8u(message, 0, 1); - message += 1; + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, static_cast(count), data); + } + else + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); } - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, count, data); } - void TestClusterClusterListOctetStringListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { - // TODO: Add actual support for array and lists. - const uint8_t * message = nullptr; - uint16_t messageLen = 0; - EmberAfStatus res = PrepareListFromTLV(tlvData, message, messageLen); - if (res != EMBER_ZCL_STATUS_SUCCESS) + CHIP_ERROR err = CHIP_NO_ERROR; + size_t count = 0; + TLV::TLVType tmpType; + TLV::TLVReader reader; + + if (tlvData != nullptr && tlvData->GetType() == chip::TLV::TLVType::kTLVType_Array) + { + reader.Init(*tlvData); + reader.EnterContainer(tmpType); + } + if (tlvData == nullptr || tlvData->GetType() != chip::TLV::TLVType::kTLVType_Array || + chip::TLV::Utilities::Count(reader, count, false /* recursive */) != CHIP_NO_ERROR || !chip::CanCastTo(count)) { Callback::Callback * cb = Callback::Callback::FromCancelable(onFailureCallback); - cb->mCall(cb->mContext, res); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); return; } - - CHECK_MESSAGE_LENGTH_VOID(2); - uint16_t count = Encoding::LittleEndian::Read16(message); chip::ByteSpan data[count]; - for (size_t i = 0; i < count; i++) + for (size_t i = 0; i < count && CHIP_NO_ERROR == (err = reader.Next()); i++) + { + const uint8_t * dataPtr = nullptr; + SuccessOrExit(reader.GetDataPtr(dataPtr)); + data[i] = chip::ByteSpan(dataPtr, reader.GetLength()); + } + SuccessOrExit(err); + // If we have exactly count elements, we should not see any errors above, but should meet an error exactly after we iterated all + // elements. + VerifyOrExit(reader.Next() == CHIP_END_OF_TLV, err = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT); +exit: + if (CHIP_NO_ERROR == err) { - CHECK_STATUS_VOID(ReadByteSpan(message, messageLen, &data[i])); - uint16_t entryLength = static_cast(data[i].size() + kByteSpanSizeLengthInBytes); - messageLen = static_cast(messageLen - entryLength); - message += entryLength; + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, static_cast(count), data); + } + else + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); } - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, count, data); } - void TestClusterClusterListStructOctetStringListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { - // TODO: Add actual support for array and lists. - const uint8_t * message = nullptr; - uint16_t messageLen = 0; - EmberAfStatus res = PrepareListFromTLV(tlvData, message, messageLen); - if (res != EMBER_ZCL_STATUS_SUCCESS) + CHIP_ERROR err = CHIP_NO_ERROR; + size_t count = 0; + TLV::TLVType tmpType; + TLV::TLVReader reader; + + if (tlvData != nullptr && tlvData->GetType() == chip::TLV::TLVType::kTLVType_Array) + { + reader.Init(*tlvData); + reader.EnterContainer(tmpType); + } + if (tlvData == nullptr || tlvData->GetType() != chip::TLV::TLVType::kTLVType_Array || + chip::TLV::Utilities::Count(reader, count, false /* recursive */) != CHIP_NO_ERROR || !chip::CanCastTo(count)) { Callback::Callback * cb = Callback::Callback::FromCancelable(onFailureCallback); - cb->mCall(cb->mContext, res); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); return; } - - CHECK_MESSAGE_LENGTH_VOID(2); - uint16_t count = Encoding::LittleEndian::Read16(message); _TestListStructOctet data[count]; - for (size_t i = 0; i < count; i++) + for (size_t i = 0; i < count && CHIP_NO_ERROR == (err = reader.Next()); i++) + { + SuccessOrExit(reader.Get(data[i])); + } + SuccessOrExit(err); + // If we have exactly count elements, we should not see any errors above, but should meet an error exactly after we iterated all + // elements. + VerifyOrExit(reader.Next() == CHIP_END_OF_TLV, err = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT); +exit: + if (CHIP_NO_ERROR == err) + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, static_cast(count), data); + } + else { - CHECK_MESSAGE_LENGTH_VOID(8); - data[i].fabricIndex = emberAfGetInt64u(message, 0, 8); - message += 8; - CHECK_STATUS_VOID(ReadByteSpan(message, 34, &data[i].operationalCert)); - messageLen = static_cast(messageLen - 34); - message += 34; + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); } - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, count, data); } - void ThreadNetworkDiagnosticsClusterNeighborTableListListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { - // TODO: Add actual support for array and lists. - const uint8_t * message = nullptr; - uint16_t messageLen = 0; - EmberAfStatus res = PrepareListFromTLV(tlvData, message, messageLen); - if (res != EMBER_ZCL_STATUS_SUCCESS) + CHIP_ERROR err = CHIP_NO_ERROR; + size_t count = 0; + TLV::TLVType tmpType; + TLV::TLVReader reader; + + if (tlvData != nullptr && tlvData->GetType() == chip::TLV::TLVType::kTLVType_Array) + { + reader.Init(*tlvData); + reader.EnterContainer(tmpType); + } + if (tlvData == nullptr || tlvData->GetType() != chip::TLV::TLVType::kTLVType_Array || + chip::TLV::Utilities::Count(reader, count, false /* recursive */) != CHIP_NO_ERROR || !chip::CanCastTo(count)) { Callback::Callback * cb = Callback::Callback::FromCancelable(onFailureCallback); - cb->mCall(cb->mContext, res); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); return; } - - CHECK_MESSAGE_LENGTH_VOID(2); - uint16_t count = Encoding::LittleEndian::Read16(message); _NeighborTable data[count]; - for (size_t i = 0; i < count; i++) - { - CHECK_MESSAGE_LENGTH_VOID(8); - data[i].ExtAddress = emberAfGetInt64u(message, 0, 8); - message += 8; - CHECK_MESSAGE_LENGTH_VOID(4); - data[i].Age = emberAfGetInt32u(message, 0, 4); - message += 4; - CHECK_MESSAGE_LENGTH_VOID(2); - data[i].Rloc16 = emberAfGetInt16u(message, 0, 2); - message += 2; - CHECK_MESSAGE_LENGTH_VOID(4); - data[i].LinkFrameCounter = emberAfGetInt32u(message, 0, 4); - message += 4; - CHECK_MESSAGE_LENGTH_VOID(4); - data[i].MleFrameCounter = emberAfGetInt32u(message, 0, 4); - message += 4; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].LQI = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].AverageRssi = emberAfGetInt8s(message, 0, 1); - message += 1; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].LastRssi = emberAfGetInt8s(message, 0, 1); - message += 1; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].FrameErrorRate = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].MessageErrorRate = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].RxOnWhenIdle = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].FullThreadDevice = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].FullNetworkData = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].IsChild = emberAfGetInt8u(message, 0, 1); - message += 1; - } - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, count, data); + for (size_t i = 0; i < count && CHIP_NO_ERROR == (err = reader.Next()); i++) + { + SuccessOrExit(reader.Get(data[i])); + } + SuccessOrExit(err); + // If we have exactly count elements, we should not see any errors above, but should meet an error exactly after we iterated all + // elements. + VerifyOrExit(reader.Next() == CHIP_END_OF_TLV, err = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT); +exit: + if (CHIP_NO_ERROR == err) + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, static_cast(count), data); + } + else + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); + } } - void ThreadNetworkDiagnosticsClusterRouteTableListListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { - // TODO: Add actual support for array and lists. - const uint8_t * message = nullptr; - uint16_t messageLen = 0; - EmberAfStatus res = PrepareListFromTLV(tlvData, message, messageLen); - if (res != EMBER_ZCL_STATUS_SUCCESS) + CHIP_ERROR err = CHIP_NO_ERROR; + size_t count = 0; + TLV::TLVType tmpType; + TLV::TLVReader reader; + + if (tlvData != nullptr && tlvData->GetType() == chip::TLV::TLVType::kTLVType_Array) + { + reader.Init(*tlvData); + reader.EnterContainer(tmpType); + } + if (tlvData == nullptr || tlvData->GetType() != chip::TLV::TLVType::kTLVType_Array || + chip::TLV::Utilities::Count(reader, count, false /* recursive */) != CHIP_NO_ERROR || !chip::CanCastTo(count)) { Callback::Callback * cb = Callback::Callback::FromCancelable(onFailureCallback); - cb->mCall(cb->mContext, res); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); return; } - - CHECK_MESSAGE_LENGTH_VOID(2); - uint16_t count = Encoding::LittleEndian::Read16(message); _RouteTable data[count]; - for (size_t i = 0; i < count; i++) - { - CHECK_MESSAGE_LENGTH_VOID(8); - data[i].ExtAddress = emberAfGetInt64u(message, 0, 8); - message += 8; - CHECK_MESSAGE_LENGTH_VOID(2); - data[i].Rloc16 = emberAfGetInt16u(message, 0, 2); - message += 2; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].RouterId = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].NextHop = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].PathCost = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].LQIIn = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].LQIOut = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].Age = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].Allocated = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].LinkEstablished = emberAfGetInt8u(message, 0, 1); - message += 1; - } - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, count, data); + for (size_t i = 0; i < count && CHIP_NO_ERROR == (err = reader.Next()); i++) + { + SuccessOrExit(reader.Get(data[i])); + } + SuccessOrExit(err); + // If we have exactly count elements, we should not see any errors above, but should meet an error exactly after we iterated all + // elements. + VerifyOrExit(reader.Next() == CHIP_END_OF_TLV, err = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT); +exit: + if (CHIP_NO_ERROR == err) + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, static_cast(count), data); + } + else + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); + } } - void ThreadNetworkDiagnosticsClusterSecurityPolicyListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { - // TODO: Add actual support for array and lists. - const uint8_t * message = nullptr; - uint16_t messageLen = 0; - EmberAfStatus res = PrepareListFromTLV(tlvData, message, messageLen); - if (res != EMBER_ZCL_STATUS_SUCCESS) + CHIP_ERROR err = CHIP_NO_ERROR; + size_t count = 0; + TLV::TLVType tmpType; + TLV::TLVReader reader; + + if (tlvData != nullptr && tlvData->GetType() == chip::TLV::TLVType::kTLVType_Array) + { + reader.Init(*tlvData); + reader.EnterContainer(tmpType); + } + if (tlvData == nullptr || tlvData->GetType() != chip::TLV::TLVType::kTLVType_Array || + chip::TLV::Utilities::Count(reader, count, false /* recursive */) != CHIP_NO_ERROR || !chip::CanCastTo(count)) { Callback::Callback * cb = Callback::Callback::FromCancelable(onFailureCallback); - cb->mCall(cb->mContext, res); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); return; } - - CHECK_MESSAGE_LENGTH_VOID(2); - uint16_t count = Encoding::LittleEndian::Read16(message); _SecurityPolicy data[count]; - for (size_t i = 0; i < count; i++) + for (size_t i = 0; i < count && CHIP_NO_ERROR == (err = reader.Next()); i++) + { + SuccessOrExit(reader.Get(data[i])); + } + SuccessOrExit(err); + // If we have exactly count elements, we should not see any errors above, but should meet an error exactly after we iterated all + // elements. + VerifyOrExit(reader.Next() == CHIP_END_OF_TLV, err = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT); +exit: + if (CHIP_NO_ERROR == err) + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, static_cast(count), data); + } + else { - CHECK_MESSAGE_LENGTH_VOID(2); - data[i].RotationTime = emberAfGetInt16u(message, 0, 2); - message += 2; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].Flags = emberAfGetInt8u(message, 0, 1); - message += 1; + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); } - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, count, data); } - void ThreadNetworkDiagnosticsClusterOperationalDatasetComponentsListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { - // TODO: Add actual support for array and lists. - const uint8_t * message = nullptr; - uint16_t messageLen = 0; - EmberAfStatus res = PrepareListFromTLV(tlvData, message, messageLen); - if (res != EMBER_ZCL_STATUS_SUCCESS) + CHIP_ERROR err = CHIP_NO_ERROR; + size_t count = 0; + TLV::TLVType tmpType; + TLV::TLVReader reader; + + if (tlvData != nullptr && tlvData->GetType() == chip::TLV::TLVType::kTLVType_Array) + { + reader.Init(*tlvData); + reader.EnterContainer(tmpType); + } + if (tlvData == nullptr || tlvData->GetType() != chip::TLV::TLVType::kTLVType_Array || + chip::TLV::Utilities::Count(reader, count, false /* recursive */) != CHIP_NO_ERROR || !chip::CanCastTo(count)) { Callback::Callback * cb = Callback::Callback::FromCancelable(onFailureCallback); - cb->mCall(cb->mContext, res); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); return; } - - CHECK_MESSAGE_LENGTH_VOID(2); - uint16_t count = Encoding::LittleEndian::Read16(message); _OperationalDatasetComponents data[count]; - for (size_t i = 0; i < count; i++) - { - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].ActiveTimestampPresent = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].PendingTimestampPresent = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].MasterKeyPresent = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].NetworkNamePresent = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].ExtendedPanIdPresent = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].MeshLocalPrefixPresent = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].DelayPresent = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].PanIdPresent = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].ChannelPresent = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].PskcPresent = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].SecurityPolicyPresent = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].ChannelMaskPresent = emberAfGetInt8u(message, 0, 1); - message += 1; - } - Callback::Callback * cb = - Callback::Callback::FromCancelable( - onSuccessCallback); - cb->mCall(cb->mContext, count, data); + for (size_t i = 0; i < count && CHIP_NO_ERROR == (err = reader.Next()); i++) + { + SuccessOrExit(reader.Get(data[i])); + } + SuccessOrExit(err); + // If we have exactly count elements, we should not see any errors above, but should meet an error exactly after we iterated all + // elements. + VerifyOrExit(reader.Next() == CHIP_END_OF_TLV, err = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT); +exit: + if (CHIP_NO_ERROR == err) + { + Callback::Callback * cb = + Callback::Callback::FromCancelable( + onSuccessCallback); + cb->mCall(cb->mContext, static_cast(count), data); + } + else + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); + } } - void ThreadNetworkDiagnosticsClusterActiveNetworkFaultsListListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { - // TODO: Add actual support for array and lists. - const uint8_t * message = nullptr; - uint16_t messageLen = 0; - EmberAfStatus res = PrepareListFromTLV(tlvData, message, messageLen); - if (res != EMBER_ZCL_STATUS_SUCCESS) + CHIP_ERROR err = CHIP_NO_ERROR; + size_t count = 0; + TLV::TLVType tmpType; + TLV::TLVReader reader; + + if (tlvData != nullptr && tlvData->GetType() == chip::TLV::TLVType::kTLVType_Array) + { + reader.Init(*tlvData); + reader.EnterContainer(tmpType); + } + if (tlvData == nullptr || tlvData->GetType() != chip::TLV::TLVType::kTLVType_Array || + chip::TLV::Utilities::Count(reader, count, false /* recursive */) != CHIP_NO_ERROR || !chip::CanCastTo(count)) { Callback::Callback * cb = Callback::Callback::FromCancelable(onFailureCallback); - cb->mCall(cb->mContext, res); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); return; } - - CHECK_MESSAGE_LENGTH_VOID(2); - uint16_t count = Encoding::LittleEndian::Read16(message); uint8_t data[count]; - for (size_t i = 0; i < count; i++) + for (size_t i = 0; i < count && CHIP_NO_ERROR == (err = reader.Next()); i++) + { + SuccessOrExit(reader.Get(data[i])); + } + SuccessOrExit(err); + // If we have exactly count elements, we should not see any errors above, but should meet an error exactly after we iterated all + // elements. + VerifyOrExit(reader.Next() == CHIP_END_OF_TLV, err = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT); +exit: + if (CHIP_NO_ERROR == err) { - CHECK_MESSAGE_LENGTH_VOID(1); - data[i] = emberAfGetInt8u(message, 0, 1); - message += 1; + Callback::Callback * cb = + Callback::Callback::FromCancelable( + onSuccessCallback); + cb->mCall(cb->mContext, static_cast(count), data); + } + else + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); } - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, count, data); } bool emberAfAccountLoginClusterGetSetupPINResponseCallback(EndpointId endpoint, app::CommandSender * commandObj, uint8_t * setupPIN) diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h index 99dfda2a1f2846..8f9fbe1e2d36f6 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h @@ -211,6 +211,7 @@ void TestClusterClusterListStructOctetStringListAttributeFilter(chip::TLV::TLVRe chip::Callback::Cancelable * onFailureCallback); typedef void (*TestClusterListStructOctetStringListAttributeCallback)(void * context, uint16_t count, _TestListStructOctet * entries); +typedef void (*TestClusterSimpleStructAttributeCallback)(void * context, _simplestruct entries); void ThreadNetworkDiagnosticsClusterNeighborTableListListAttributeFilter(chip::TLV::TLVReader * data, chip::Callback::Cancelable * onSuccessCallback, chip::Callback::Cancelable * onFailureCallback); diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.cpp b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.cpp index c305dd1925b096..47c32514e0b0f9 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.cpp +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.cpp @@ -10661,6 +10661,18 @@ CHIP_ERROR TestClusterCluster::WriteAttributeLongCharString(Callback::Cancelable return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } +CHIP_ERROR TestClusterCluster::ReadAttributeSimpleStruct(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + app::AttributePathParams attributePath; + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000020; + attributePath.mFlags.Set(app::AttributePathParams::Flags::kFieldIdValid); + return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, + BasicAttributeFilter); +} + CHIP_ERROR TestClusterCluster::ReadAttributeUnsupported(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h index 24a5aab675b80b..128c466946ff1a 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h @@ -1213,6 +1213,7 @@ class DLL_EXPORT TestClusterCluster : public ClusterBase CHIP_ERROR ReadAttributeLongOctetString(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); CHIP_ERROR ReadAttributeCharString(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); CHIP_ERROR ReadAttributeLongCharString(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeSimpleStruct(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); CHIP_ERROR ReadAttributeUnsupported(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); CHIP_ERROR ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); CHIP_ERROR WriteAttributeBoolean(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, diff --git a/zzz_generated/controller-clusters/zap-generated/attribute-size.cpp b/zzz_generated/controller-clusters/zap-generated/attribute-size.cpp index d06e4b2c339a7e..186992ed3c236f 100644 --- a/zzz_generated/controller-clusters/zap-generated/attribute-size.cpp +++ b/zzz_generated/controller-clusters/zap-generated/attribute-size.cpp @@ -21,10 +21,13 @@ #include #include #include +#include +#include #include #include using namespace chip; +using namespace chip::app; using namespace chip::app::List; // The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid @@ -45,6 +48,34 @@ void copyListMember(uint8_t * dest, uint8_t * src, bool write, uint16_t * offset *offset = static_cast(*offset + length); } +CHIP_ERROR CopyStructAttributeToCHIPTLV(ClusterId clusterId, AttributeId attributeId, uint8_t * src, uint16_t len, + TLV::TLVWriter & writer, uint64_t tag) +{ + switch (clusterId) + { + } + return CHIP_ERROR_INVALID_ARGUMENT; +} + +CHIP_ERROR EmberListToCHIPTLV(ClusterId clusterId, AttributeId attributeId, uint8_t * src, uint16_t len, TLV::TLVWriter & writer, + uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + size_t count = *reinterpret_cast(src); + uint16_t entryLength = 0; + // Suppress error of unused variable. + (void) entryLength; + (void) count; + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Array, tmpType)); + switch (clusterId) + { + } +exit: + err = writer.EndContainer(tmpType); + return err; +} + uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, bool write, uint8_t * dest, uint8_t * src, int32_t index) { diff --git a/zzz_generated/lighting-app/zap-generated/CHIPClientCallbacks.cpp b/zzz_generated/lighting-app/zap-generated/CHIPClientCallbacks.cpp index e5c220dd2c98b9..ec2fc0f771611b 100644 --- a/zzz_generated/lighting-app/zap-generated/CHIPClientCallbacks.cpp +++ b/zzz_generated/lighting-app/zap-generated/CHIPClientCallbacks.cpp @@ -30,6 +30,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -37,10 +40,6 @@ using namespace ::chip; using namespace ::chip::app::List; -namespace { -[[maybe_unused]] constexpr uint16_t kByteSpanSizeLengthInBytes = 2; -} // namespace - #define CHECK_STATUS_WITH_RETVAL(error, retval) \ if (CHIP_NO_ERROR != error) \ { \ diff --git a/zzz_generated/lighting-app/zap-generated/attribute-size.cpp b/zzz_generated/lighting-app/zap-generated/attribute-size.cpp index 4e6eb9372d81a1..5b98225a951233 100644 --- a/zzz_generated/lighting-app/zap-generated/attribute-size.cpp +++ b/zzz_generated/lighting-app/zap-generated/attribute-size.cpp @@ -21,10 +21,13 @@ #include #include #include +#include +#include #include #include using namespace chip; +using namespace chip::app; using namespace chip::app::List; // The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid @@ -45,6 +48,232 @@ void copyListMember(uint8_t * dest, uint8_t * src, bool write, uint16_t * offset *offset = static_cast(*offset + length); } +CHIP_ERROR CopyStructAttributeToCHIPTLV(ClusterId clusterId, AttributeId attributeId, uint8_t * src, uint16_t len, + TLV::TLVWriter & writer, uint64_t tag) +{ + switch (clusterId) + { + } + return CHIP_ERROR_INVALID_ARGUMENT; +} + +CHIP_ERROR EmberListToCHIPTLV(ClusterId clusterId, AttributeId attributeId, uint8_t * src, uint16_t len, TLV::TLVWriter & writer, + uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + size_t count = *reinterpret_cast(src); + uint16_t entryLength = 0; + // Suppress error of unused variable. + (void) entryLength; + (void) count; + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Array, tmpType)); + switch (clusterId) + { + case 0x0030: // General Commissioning Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0001: // BasicCommissioningInfoList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 4; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _BasicCommissioningInfoType + _BasicCommissioningInfoType entry; + SuccessOrExit(err = _BasicCommissioningInfoType::FromEmberBuffer(&entry, src + entryOffset, 4)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x0033: // General Diagnostics Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // NetworkInterfaces + { + for (size_t index = 0; index < count; index++) + { + entryLength = 48; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _NetworkInterfaceType + _NetworkInterfaceType entry; + SuccessOrExit(err = _NetworkInterfaceType::FromEmberBuffer(&entry, src + entryOffset, 48)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x003E: // Operational Credentials Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0001: // fabrics list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 120; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _FabricDescriptor + _FabricDescriptor entry; + SuccessOrExit(err = _FabricDescriptor::FromEmberBuffer(&entry, src + entryOffset, 120)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x0004: // TrustedRootCertificates + { + for (size_t index = 0; index < count; index++) + { + entryOffset = GetByteSpanOffsetFromIndex(src, len, static_cast(index)); + if (entryOffset == 0) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + + chip::ByteSpan trustedRootCertificatesSpan; // OCTET_STRING + uint16_t trustedRootCertificatesRemainingSpace = static_cast(len - entryOffset); + if (CHIP_NO_ERROR != + ReadByteSpan(src + entryOffset, trustedRootCertificatesRemainingSpace, &trustedRootCertificatesSpan)) + { + ChipLogError(Zcl, "Index %zu is invalid. Not enough remaining space", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + writer.Put(TLV::AnonymousTag, trustedRootCertificatesSpan); + } + break; + } + } + break; + } + case 0x0035: // Thread Network Diagnostics Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0007: // NeighborTableList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 31; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _NeighborTable + _NeighborTable entry; + SuccessOrExit(err = _NeighborTable::FromEmberBuffer(&entry, src + entryOffset, 31)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x0008: // RouteTableList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 18; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _RouteTable + _RouteTable entry; + SuccessOrExit(err = _RouteTable::FromEmberBuffer(&entry, src + entryOffset, 18)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x003B: // SecurityPolicy + { + for (size_t index = 0; index < count; index++) + { + entryLength = 3; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _SecurityPolicy + _SecurityPolicy entry; + SuccessOrExit(err = _SecurityPolicy::FromEmberBuffer(&entry, src + entryOffset, 3)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x003D: // OperationalDatasetComponents + { + for (size_t index = 0; index < count; index++) + { + entryLength = 12; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _OperationalDatasetComponents + _OperationalDatasetComponents entry; + SuccessOrExit(err = _OperationalDatasetComponents::FromEmberBuffer(&entry, src + entryOffset, 12)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x003E: // ActiveNetworkFaultsList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 1; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + uint8_t entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // NetworkFault + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + } + break; + } + } +exit: + err = writer.EndContainer(tmpType); + return err; +} + uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, bool write, uint8_t * dest, uint8_t * src, int32_t index) { @@ -80,8 +309,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo { case 0x0030: // General Commissioning Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0001: // BasicCommissioningInfoList { @@ -94,9 +324,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _BasicCommissioningInfoType _BasicCommissioningInfoType * entry = reinterpret_cast<_BasicCommissioningInfoType *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->FailSafeExpiryLengthMs, - write ? (uint8_t *) &entry->FailSafeExpiryLengthMs : src, write, &entryOffset, - sizeof(entry->FailSafeExpiryLengthMs)); // INT32U + if (write) + { + size_t unusedLen; + _BasicCommissioningInfoType::ToEmberBuffer(entry, dest + entryOffset, 4, unusedLen); + } + else + { + _BasicCommissioningInfoType::FromEmberBuffer(entry, src + entryOffset, 4); + } break; } } @@ -104,8 +340,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0033: // General Diagnostics Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // NetworkInterfaces { @@ -118,33 +355,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NetworkInterfaceType _NetworkInterfaceType * entry = reinterpret_cast<_NetworkInterfaceType *>(write ? src : dest); - ByteSpan * NameSpan = &entry->Name; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, NameSpan) : ReadByteSpan(src + entryOffset, 34, NameSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _NetworkInterfaceType::ToEmberBuffer(entry, dest + entryOffset, 48, unusedLen); } - entryOffset = static_cast(entryOffset + 34); - copyListMember(write ? dest : (uint8_t *) &entry->FabricConnected, write ? (uint8_t *) &entry->FabricConnected : src, - write, &entryOffset, sizeof(entry->FabricConnected)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->OffPremiseServicesReachableIPv4, - write ? (uint8_t *) &entry->OffPremiseServicesReachableIPv4 : src, write, &entryOffset, - sizeof(entry->OffPremiseServicesReachableIPv4)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->OffPremiseServicesReachableIPv6, - write ? (uint8_t *) &entry->OffPremiseServicesReachableIPv6 : src, write, &entryOffset, - sizeof(entry->OffPremiseServicesReachableIPv6)); // BOOLEAN - ByteSpan * HardwareAddressSpan = &entry->HardwareAddress; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 10, HardwareAddressSpan) - : ReadByteSpan(src + entryOffset, 10, HardwareAddressSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _NetworkInterfaceType::FromEmberBuffer(entry, src + entryOffset, 48); } - entryOffset = static_cast(entryOffset + 10); - copyListMember(write ? dest : (uint8_t *) &entry->Type, write ? (uint8_t *) &entry->Type : src, write, &entryOffset, - sizeof(entry->Type)); // ENUM8 break; } } @@ -152,8 +371,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x003E: // Operational Credentials Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0001: // fabrics list { @@ -166,31 +386,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _FabricDescriptor _FabricDescriptor * entry = reinterpret_cast<_FabricDescriptor *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->FabricIndex, write ? (uint8_t *) &entry->FabricIndex : src, write, - &entryOffset, sizeof(entry->FabricIndex)); // INT8U - ByteSpan * RootPublicKeySpan = &entry->RootPublicKey; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 67, RootPublicKeySpan) - : ReadByteSpan(src + entryOffset, 67, RootPublicKeySpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _FabricDescriptor::ToEmberBuffer(entry, dest + entryOffset, 120, unusedLen); } - entryOffset = static_cast(entryOffset + 67); - copyListMember(write ? dest : (uint8_t *) &entry->VendorId, write ? (uint8_t *) &entry->VendorId : src, write, - &entryOffset, sizeof(entry->VendorId)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->FabricId, write ? (uint8_t *) &entry->FabricId : src, write, - &entryOffset, sizeof(entry->FabricId)); // FABRIC_ID - copyListMember(write ? dest : (uint8_t *) &entry->NodeId, write ? (uint8_t *) &entry->NodeId : src, write, &entryOffset, - sizeof(entry->NodeId)); // NODE_ID - ByteSpan * LabelSpan = &entry->Label; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, LabelSpan) : ReadByteSpan(src + entryOffset, 34, LabelSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _FabricDescriptor::FromEmberBuffer(entry, src + entryOffset, 120); } - entryOffset = static_cast(entryOffset + 34); break; } case 0x0004: // TrustedRootCertificates @@ -225,8 +429,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0035: // Thread Network Diagnostics Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0007: // NeighborTableList { @@ -239,34 +444,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NeighborTable _NeighborTable * entry = reinterpret_cast<_NeighborTable *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->ExtAddress, write ? (uint8_t *) &entry->ExtAddress : src, write, - &entryOffset, sizeof(entry->ExtAddress)); // INT64U - copyListMember(write ? dest : (uint8_t *) &entry->Age, write ? (uint8_t *) &entry->Age : src, write, &entryOffset, - sizeof(entry->Age)); // INT32U - copyListMember(write ? dest : (uint8_t *) &entry->Rloc16, write ? (uint8_t *) &entry->Rloc16 : src, write, &entryOffset, - sizeof(entry->Rloc16)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->LinkFrameCounter, write ? (uint8_t *) &entry->LinkFrameCounter : src, - write, &entryOffset, sizeof(entry->LinkFrameCounter)); // INT32U - copyListMember(write ? dest : (uint8_t *) &entry->MleFrameCounter, write ? (uint8_t *) &entry->MleFrameCounter : src, - write, &entryOffset, sizeof(entry->MleFrameCounter)); // INT32U - copyListMember(write ? dest : (uint8_t *) &entry->LQI, write ? (uint8_t *) &entry->LQI : src, write, &entryOffset, - sizeof(entry->LQI)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->AverageRssi, write ? (uint8_t *) &entry->AverageRssi : src, write, - &entryOffset, sizeof(entry->AverageRssi)); // INT8S - copyListMember(write ? dest : (uint8_t *) &entry->LastRssi, write ? (uint8_t *) &entry->LastRssi : src, write, - &entryOffset, sizeof(entry->LastRssi)); // INT8S - copyListMember(write ? dest : (uint8_t *) &entry->FrameErrorRate, write ? (uint8_t *) &entry->FrameErrorRate : src, - write, &entryOffset, sizeof(entry->FrameErrorRate)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->MessageErrorRate, write ? (uint8_t *) &entry->MessageErrorRate : src, - write, &entryOffset, sizeof(entry->MessageErrorRate)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->RxOnWhenIdle, write ? (uint8_t *) &entry->RxOnWhenIdle : src, write, - &entryOffset, sizeof(entry->RxOnWhenIdle)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->FullThreadDevice, write ? (uint8_t *) &entry->FullThreadDevice : src, - write, &entryOffset, sizeof(entry->FullThreadDevice)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->FullNetworkData, write ? (uint8_t *) &entry->FullNetworkData : src, - write, &entryOffset, sizeof(entry->FullNetworkData)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->IsChild, write ? (uint8_t *) &entry->IsChild : src, write, - &entryOffset, sizeof(entry->IsChild)); // BOOLEAN + if (write) + { + size_t unusedLen; + _NeighborTable::ToEmberBuffer(entry, dest + entryOffset, 31, unusedLen); + } + else + { + _NeighborTable::FromEmberBuffer(entry, src + entryOffset, 31); + } break; } case 0x0008: // RouteTableList @@ -280,26 +466,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _RouteTable _RouteTable * entry = reinterpret_cast<_RouteTable *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->ExtAddress, write ? (uint8_t *) &entry->ExtAddress : src, write, - &entryOffset, sizeof(entry->ExtAddress)); // INT64U - copyListMember(write ? dest : (uint8_t *) &entry->Rloc16, write ? (uint8_t *) &entry->Rloc16 : src, write, &entryOffset, - sizeof(entry->Rloc16)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->RouterId, write ? (uint8_t *) &entry->RouterId : src, write, - &entryOffset, sizeof(entry->RouterId)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->NextHop, write ? (uint8_t *) &entry->NextHop : src, write, - &entryOffset, sizeof(entry->NextHop)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->PathCost, write ? (uint8_t *) &entry->PathCost : src, write, - &entryOffset, sizeof(entry->PathCost)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->LQIIn, write ? (uint8_t *) &entry->LQIIn : src, write, &entryOffset, - sizeof(entry->LQIIn)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->LQIOut, write ? (uint8_t *) &entry->LQIOut : src, write, &entryOffset, - sizeof(entry->LQIOut)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->Age, write ? (uint8_t *) &entry->Age : src, write, &entryOffset, - sizeof(entry->Age)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->Allocated, write ? (uint8_t *) &entry->Allocated : src, write, - &entryOffset, sizeof(entry->Allocated)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->LinkEstablished, write ? (uint8_t *) &entry->LinkEstablished : src, - write, &entryOffset, sizeof(entry->LinkEstablished)); // BOOLEAN + if (write) + { + size_t unusedLen; + _RouteTable::ToEmberBuffer(entry, dest + entryOffset, 18, unusedLen); + } + else + { + _RouteTable::FromEmberBuffer(entry, src + entryOffset, 18); + } break; } case 0x003B: // SecurityPolicy @@ -313,10 +488,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _SecurityPolicy _SecurityPolicy * entry = reinterpret_cast<_SecurityPolicy *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->RotationTime, write ? (uint8_t *) &entry->RotationTime : src, write, - &entryOffset, sizeof(entry->RotationTime)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->Flags, write ? (uint8_t *) &entry->Flags : src, write, &entryOffset, - sizeof(entry->Flags)); // INT8U + if (write) + { + size_t unusedLen; + _SecurityPolicy::ToEmberBuffer(entry, dest + entryOffset, 3, unusedLen); + } + else + { + _SecurityPolicy::FromEmberBuffer(entry, src + entryOffset, 3); + } break; } case 0x003D: // OperationalDatasetComponents @@ -330,37 +510,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _OperationalDatasetComponents _OperationalDatasetComponents * entry = reinterpret_cast<_OperationalDatasetComponents *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->ActiveTimestampPresent, - write ? (uint8_t *) &entry->ActiveTimestampPresent : src, write, &entryOffset, - sizeof(entry->ActiveTimestampPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->PendingTimestampPresent, - write ? (uint8_t *) &entry->PendingTimestampPresent : src, write, &entryOffset, - sizeof(entry->PendingTimestampPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->MasterKeyPresent, write ? (uint8_t *) &entry->MasterKeyPresent : src, - write, &entryOffset, sizeof(entry->MasterKeyPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->NetworkNamePresent, - write ? (uint8_t *) &entry->NetworkNamePresent : src, write, &entryOffset, - sizeof(entry->NetworkNamePresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->ExtendedPanIdPresent, - write ? (uint8_t *) &entry->ExtendedPanIdPresent : src, write, &entryOffset, - sizeof(entry->ExtendedPanIdPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->MeshLocalPrefixPresent, - write ? (uint8_t *) &entry->MeshLocalPrefixPresent : src, write, &entryOffset, - sizeof(entry->MeshLocalPrefixPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->DelayPresent, write ? (uint8_t *) &entry->DelayPresent : src, write, - &entryOffset, sizeof(entry->DelayPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->PanIdPresent, write ? (uint8_t *) &entry->PanIdPresent : src, write, - &entryOffset, sizeof(entry->PanIdPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->ChannelPresent, write ? (uint8_t *) &entry->ChannelPresent : src, - write, &entryOffset, sizeof(entry->ChannelPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->PskcPresent, write ? (uint8_t *) &entry->PskcPresent : src, write, - &entryOffset, sizeof(entry->PskcPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->SecurityPolicyPresent, - write ? (uint8_t *) &entry->SecurityPolicyPresent : src, write, &entryOffset, - sizeof(entry->SecurityPolicyPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->ChannelMaskPresent, - write ? (uint8_t *) &entry->ChannelMaskPresent : src, write, &entryOffset, - sizeof(entry->ChannelMaskPresent)); // BOOLEAN + if (write) + { + size_t unusedLen; + _OperationalDatasetComponents::ToEmberBuffer(entry, dest + entryOffset, 12, unusedLen); + } + else + { + _OperationalDatasetComponents::FromEmberBuffer(entry, src + entryOffset, 12); + } break; } case 0x003E: // ActiveNetworkFaultsList diff --git a/zzz_generated/lock-app/zap-generated/attribute-size.cpp b/zzz_generated/lock-app/zap-generated/attribute-size.cpp index 4e6eb9372d81a1..5b98225a951233 100644 --- a/zzz_generated/lock-app/zap-generated/attribute-size.cpp +++ b/zzz_generated/lock-app/zap-generated/attribute-size.cpp @@ -21,10 +21,13 @@ #include #include #include +#include +#include #include #include using namespace chip; +using namespace chip::app; using namespace chip::app::List; // The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid @@ -45,6 +48,232 @@ void copyListMember(uint8_t * dest, uint8_t * src, bool write, uint16_t * offset *offset = static_cast(*offset + length); } +CHIP_ERROR CopyStructAttributeToCHIPTLV(ClusterId clusterId, AttributeId attributeId, uint8_t * src, uint16_t len, + TLV::TLVWriter & writer, uint64_t tag) +{ + switch (clusterId) + { + } + return CHIP_ERROR_INVALID_ARGUMENT; +} + +CHIP_ERROR EmberListToCHIPTLV(ClusterId clusterId, AttributeId attributeId, uint8_t * src, uint16_t len, TLV::TLVWriter & writer, + uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + size_t count = *reinterpret_cast(src); + uint16_t entryLength = 0; + // Suppress error of unused variable. + (void) entryLength; + (void) count; + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Array, tmpType)); + switch (clusterId) + { + case 0x0030: // General Commissioning Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0001: // BasicCommissioningInfoList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 4; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _BasicCommissioningInfoType + _BasicCommissioningInfoType entry; + SuccessOrExit(err = _BasicCommissioningInfoType::FromEmberBuffer(&entry, src + entryOffset, 4)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x0033: // General Diagnostics Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // NetworkInterfaces + { + for (size_t index = 0; index < count; index++) + { + entryLength = 48; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _NetworkInterfaceType + _NetworkInterfaceType entry; + SuccessOrExit(err = _NetworkInterfaceType::FromEmberBuffer(&entry, src + entryOffset, 48)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x003E: // Operational Credentials Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0001: // fabrics list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 120; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _FabricDescriptor + _FabricDescriptor entry; + SuccessOrExit(err = _FabricDescriptor::FromEmberBuffer(&entry, src + entryOffset, 120)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x0004: // TrustedRootCertificates + { + for (size_t index = 0; index < count; index++) + { + entryOffset = GetByteSpanOffsetFromIndex(src, len, static_cast(index)); + if (entryOffset == 0) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + + chip::ByteSpan trustedRootCertificatesSpan; // OCTET_STRING + uint16_t trustedRootCertificatesRemainingSpace = static_cast(len - entryOffset); + if (CHIP_NO_ERROR != + ReadByteSpan(src + entryOffset, trustedRootCertificatesRemainingSpace, &trustedRootCertificatesSpan)) + { + ChipLogError(Zcl, "Index %zu is invalid. Not enough remaining space", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + writer.Put(TLV::AnonymousTag, trustedRootCertificatesSpan); + } + break; + } + } + break; + } + case 0x0035: // Thread Network Diagnostics Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0007: // NeighborTableList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 31; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _NeighborTable + _NeighborTable entry; + SuccessOrExit(err = _NeighborTable::FromEmberBuffer(&entry, src + entryOffset, 31)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x0008: // RouteTableList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 18; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _RouteTable + _RouteTable entry; + SuccessOrExit(err = _RouteTable::FromEmberBuffer(&entry, src + entryOffset, 18)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x003B: // SecurityPolicy + { + for (size_t index = 0; index < count; index++) + { + entryLength = 3; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _SecurityPolicy + _SecurityPolicy entry; + SuccessOrExit(err = _SecurityPolicy::FromEmberBuffer(&entry, src + entryOffset, 3)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x003D: // OperationalDatasetComponents + { + for (size_t index = 0; index < count; index++) + { + entryLength = 12; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _OperationalDatasetComponents + _OperationalDatasetComponents entry; + SuccessOrExit(err = _OperationalDatasetComponents::FromEmberBuffer(&entry, src + entryOffset, 12)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x003E: // ActiveNetworkFaultsList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 1; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + uint8_t entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // NetworkFault + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + } + break; + } + } +exit: + err = writer.EndContainer(tmpType); + return err; +} + uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, bool write, uint8_t * dest, uint8_t * src, int32_t index) { @@ -80,8 +309,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo { case 0x0030: // General Commissioning Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0001: // BasicCommissioningInfoList { @@ -94,9 +324,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _BasicCommissioningInfoType _BasicCommissioningInfoType * entry = reinterpret_cast<_BasicCommissioningInfoType *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->FailSafeExpiryLengthMs, - write ? (uint8_t *) &entry->FailSafeExpiryLengthMs : src, write, &entryOffset, - sizeof(entry->FailSafeExpiryLengthMs)); // INT32U + if (write) + { + size_t unusedLen; + _BasicCommissioningInfoType::ToEmberBuffer(entry, dest + entryOffset, 4, unusedLen); + } + else + { + _BasicCommissioningInfoType::FromEmberBuffer(entry, src + entryOffset, 4); + } break; } } @@ -104,8 +340,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0033: // General Diagnostics Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // NetworkInterfaces { @@ -118,33 +355,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NetworkInterfaceType _NetworkInterfaceType * entry = reinterpret_cast<_NetworkInterfaceType *>(write ? src : dest); - ByteSpan * NameSpan = &entry->Name; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, NameSpan) : ReadByteSpan(src + entryOffset, 34, NameSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _NetworkInterfaceType::ToEmberBuffer(entry, dest + entryOffset, 48, unusedLen); } - entryOffset = static_cast(entryOffset + 34); - copyListMember(write ? dest : (uint8_t *) &entry->FabricConnected, write ? (uint8_t *) &entry->FabricConnected : src, - write, &entryOffset, sizeof(entry->FabricConnected)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->OffPremiseServicesReachableIPv4, - write ? (uint8_t *) &entry->OffPremiseServicesReachableIPv4 : src, write, &entryOffset, - sizeof(entry->OffPremiseServicesReachableIPv4)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->OffPremiseServicesReachableIPv6, - write ? (uint8_t *) &entry->OffPremiseServicesReachableIPv6 : src, write, &entryOffset, - sizeof(entry->OffPremiseServicesReachableIPv6)); // BOOLEAN - ByteSpan * HardwareAddressSpan = &entry->HardwareAddress; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 10, HardwareAddressSpan) - : ReadByteSpan(src + entryOffset, 10, HardwareAddressSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _NetworkInterfaceType::FromEmberBuffer(entry, src + entryOffset, 48); } - entryOffset = static_cast(entryOffset + 10); - copyListMember(write ? dest : (uint8_t *) &entry->Type, write ? (uint8_t *) &entry->Type : src, write, &entryOffset, - sizeof(entry->Type)); // ENUM8 break; } } @@ -152,8 +371,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x003E: // Operational Credentials Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0001: // fabrics list { @@ -166,31 +386,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _FabricDescriptor _FabricDescriptor * entry = reinterpret_cast<_FabricDescriptor *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->FabricIndex, write ? (uint8_t *) &entry->FabricIndex : src, write, - &entryOffset, sizeof(entry->FabricIndex)); // INT8U - ByteSpan * RootPublicKeySpan = &entry->RootPublicKey; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 67, RootPublicKeySpan) - : ReadByteSpan(src + entryOffset, 67, RootPublicKeySpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _FabricDescriptor::ToEmberBuffer(entry, dest + entryOffset, 120, unusedLen); } - entryOffset = static_cast(entryOffset + 67); - copyListMember(write ? dest : (uint8_t *) &entry->VendorId, write ? (uint8_t *) &entry->VendorId : src, write, - &entryOffset, sizeof(entry->VendorId)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->FabricId, write ? (uint8_t *) &entry->FabricId : src, write, - &entryOffset, sizeof(entry->FabricId)); // FABRIC_ID - copyListMember(write ? dest : (uint8_t *) &entry->NodeId, write ? (uint8_t *) &entry->NodeId : src, write, &entryOffset, - sizeof(entry->NodeId)); // NODE_ID - ByteSpan * LabelSpan = &entry->Label; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, LabelSpan) : ReadByteSpan(src + entryOffset, 34, LabelSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _FabricDescriptor::FromEmberBuffer(entry, src + entryOffset, 120); } - entryOffset = static_cast(entryOffset + 34); break; } case 0x0004: // TrustedRootCertificates @@ -225,8 +429,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0035: // Thread Network Diagnostics Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0007: // NeighborTableList { @@ -239,34 +444,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NeighborTable _NeighborTable * entry = reinterpret_cast<_NeighborTable *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->ExtAddress, write ? (uint8_t *) &entry->ExtAddress : src, write, - &entryOffset, sizeof(entry->ExtAddress)); // INT64U - copyListMember(write ? dest : (uint8_t *) &entry->Age, write ? (uint8_t *) &entry->Age : src, write, &entryOffset, - sizeof(entry->Age)); // INT32U - copyListMember(write ? dest : (uint8_t *) &entry->Rloc16, write ? (uint8_t *) &entry->Rloc16 : src, write, &entryOffset, - sizeof(entry->Rloc16)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->LinkFrameCounter, write ? (uint8_t *) &entry->LinkFrameCounter : src, - write, &entryOffset, sizeof(entry->LinkFrameCounter)); // INT32U - copyListMember(write ? dest : (uint8_t *) &entry->MleFrameCounter, write ? (uint8_t *) &entry->MleFrameCounter : src, - write, &entryOffset, sizeof(entry->MleFrameCounter)); // INT32U - copyListMember(write ? dest : (uint8_t *) &entry->LQI, write ? (uint8_t *) &entry->LQI : src, write, &entryOffset, - sizeof(entry->LQI)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->AverageRssi, write ? (uint8_t *) &entry->AverageRssi : src, write, - &entryOffset, sizeof(entry->AverageRssi)); // INT8S - copyListMember(write ? dest : (uint8_t *) &entry->LastRssi, write ? (uint8_t *) &entry->LastRssi : src, write, - &entryOffset, sizeof(entry->LastRssi)); // INT8S - copyListMember(write ? dest : (uint8_t *) &entry->FrameErrorRate, write ? (uint8_t *) &entry->FrameErrorRate : src, - write, &entryOffset, sizeof(entry->FrameErrorRate)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->MessageErrorRate, write ? (uint8_t *) &entry->MessageErrorRate : src, - write, &entryOffset, sizeof(entry->MessageErrorRate)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->RxOnWhenIdle, write ? (uint8_t *) &entry->RxOnWhenIdle : src, write, - &entryOffset, sizeof(entry->RxOnWhenIdle)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->FullThreadDevice, write ? (uint8_t *) &entry->FullThreadDevice : src, - write, &entryOffset, sizeof(entry->FullThreadDevice)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->FullNetworkData, write ? (uint8_t *) &entry->FullNetworkData : src, - write, &entryOffset, sizeof(entry->FullNetworkData)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->IsChild, write ? (uint8_t *) &entry->IsChild : src, write, - &entryOffset, sizeof(entry->IsChild)); // BOOLEAN + if (write) + { + size_t unusedLen; + _NeighborTable::ToEmberBuffer(entry, dest + entryOffset, 31, unusedLen); + } + else + { + _NeighborTable::FromEmberBuffer(entry, src + entryOffset, 31); + } break; } case 0x0008: // RouteTableList @@ -280,26 +466,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _RouteTable _RouteTable * entry = reinterpret_cast<_RouteTable *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->ExtAddress, write ? (uint8_t *) &entry->ExtAddress : src, write, - &entryOffset, sizeof(entry->ExtAddress)); // INT64U - copyListMember(write ? dest : (uint8_t *) &entry->Rloc16, write ? (uint8_t *) &entry->Rloc16 : src, write, &entryOffset, - sizeof(entry->Rloc16)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->RouterId, write ? (uint8_t *) &entry->RouterId : src, write, - &entryOffset, sizeof(entry->RouterId)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->NextHop, write ? (uint8_t *) &entry->NextHop : src, write, - &entryOffset, sizeof(entry->NextHop)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->PathCost, write ? (uint8_t *) &entry->PathCost : src, write, - &entryOffset, sizeof(entry->PathCost)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->LQIIn, write ? (uint8_t *) &entry->LQIIn : src, write, &entryOffset, - sizeof(entry->LQIIn)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->LQIOut, write ? (uint8_t *) &entry->LQIOut : src, write, &entryOffset, - sizeof(entry->LQIOut)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->Age, write ? (uint8_t *) &entry->Age : src, write, &entryOffset, - sizeof(entry->Age)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->Allocated, write ? (uint8_t *) &entry->Allocated : src, write, - &entryOffset, sizeof(entry->Allocated)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->LinkEstablished, write ? (uint8_t *) &entry->LinkEstablished : src, - write, &entryOffset, sizeof(entry->LinkEstablished)); // BOOLEAN + if (write) + { + size_t unusedLen; + _RouteTable::ToEmberBuffer(entry, dest + entryOffset, 18, unusedLen); + } + else + { + _RouteTable::FromEmberBuffer(entry, src + entryOffset, 18); + } break; } case 0x003B: // SecurityPolicy @@ -313,10 +488,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _SecurityPolicy _SecurityPolicy * entry = reinterpret_cast<_SecurityPolicy *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->RotationTime, write ? (uint8_t *) &entry->RotationTime : src, write, - &entryOffset, sizeof(entry->RotationTime)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->Flags, write ? (uint8_t *) &entry->Flags : src, write, &entryOffset, - sizeof(entry->Flags)); // INT8U + if (write) + { + size_t unusedLen; + _SecurityPolicy::ToEmberBuffer(entry, dest + entryOffset, 3, unusedLen); + } + else + { + _SecurityPolicy::FromEmberBuffer(entry, src + entryOffset, 3); + } break; } case 0x003D: // OperationalDatasetComponents @@ -330,37 +510,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _OperationalDatasetComponents _OperationalDatasetComponents * entry = reinterpret_cast<_OperationalDatasetComponents *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->ActiveTimestampPresent, - write ? (uint8_t *) &entry->ActiveTimestampPresent : src, write, &entryOffset, - sizeof(entry->ActiveTimestampPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->PendingTimestampPresent, - write ? (uint8_t *) &entry->PendingTimestampPresent : src, write, &entryOffset, - sizeof(entry->PendingTimestampPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->MasterKeyPresent, write ? (uint8_t *) &entry->MasterKeyPresent : src, - write, &entryOffset, sizeof(entry->MasterKeyPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->NetworkNamePresent, - write ? (uint8_t *) &entry->NetworkNamePresent : src, write, &entryOffset, - sizeof(entry->NetworkNamePresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->ExtendedPanIdPresent, - write ? (uint8_t *) &entry->ExtendedPanIdPresent : src, write, &entryOffset, - sizeof(entry->ExtendedPanIdPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->MeshLocalPrefixPresent, - write ? (uint8_t *) &entry->MeshLocalPrefixPresent : src, write, &entryOffset, - sizeof(entry->MeshLocalPrefixPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->DelayPresent, write ? (uint8_t *) &entry->DelayPresent : src, write, - &entryOffset, sizeof(entry->DelayPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->PanIdPresent, write ? (uint8_t *) &entry->PanIdPresent : src, write, - &entryOffset, sizeof(entry->PanIdPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->ChannelPresent, write ? (uint8_t *) &entry->ChannelPresent : src, - write, &entryOffset, sizeof(entry->ChannelPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->PskcPresent, write ? (uint8_t *) &entry->PskcPresent : src, write, - &entryOffset, sizeof(entry->PskcPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->SecurityPolicyPresent, - write ? (uint8_t *) &entry->SecurityPolicyPresent : src, write, &entryOffset, - sizeof(entry->SecurityPolicyPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->ChannelMaskPresent, - write ? (uint8_t *) &entry->ChannelMaskPresent : src, write, &entryOffset, - sizeof(entry->ChannelMaskPresent)); // BOOLEAN + if (write) + { + size_t unusedLen; + _OperationalDatasetComponents::ToEmberBuffer(entry, dest + entryOffset, 12, unusedLen); + } + else + { + _OperationalDatasetComponents::FromEmberBuffer(entry, src + entryOffset, 12); + } break; } case 0x003E: // ActiveNetworkFaultsList diff --git a/zzz_generated/ota-provider-app/zap-generated/attribute-size.cpp b/zzz_generated/ota-provider-app/zap-generated/attribute-size.cpp index bbbe72475169da..7b6fa15f91b7b1 100644 --- a/zzz_generated/ota-provider-app/zap-generated/attribute-size.cpp +++ b/zzz_generated/ota-provider-app/zap-generated/attribute-size.cpp @@ -21,10 +21,13 @@ #include #include #include +#include +#include #include #include using namespace chip; +using namespace chip::app; using namespace chip::app::List; // The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid @@ -45,6 +48,83 @@ void copyListMember(uint8_t * dest, uint8_t * src, bool write, uint16_t * offset *offset = static_cast(*offset + length); } +CHIP_ERROR CopyStructAttributeToCHIPTLV(ClusterId clusterId, AttributeId attributeId, uint8_t * src, uint16_t len, + TLV::TLVWriter & writer, uint64_t tag) +{ + switch (clusterId) + { + } + return CHIP_ERROR_INVALID_ARGUMENT; +} + +CHIP_ERROR EmberListToCHIPTLV(ClusterId clusterId, AttributeId attributeId, uint8_t * src, uint16_t len, TLV::TLVWriter & writer, + uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + size_t count = *reinterpret_cast(src); + uint16_t entryLength = 0; + // Suppress error of unused variable. + (void) entryLength; + (void) count; + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Array, tmpType)); + switch (clusterId) + { + case 0x003E: // Operational Credentials Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0001: // fabrics list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 120; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _FabricDescriptor + _FabricDescriptor entry; + SuccessOrExit(err = _FabricDescriptor::FromEmberBuffer(&entry, src + entryOffset, 120)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x0004: // TrustedRootCertificates + { + for (size_t index = 0; index < count; index++) + { + entryOffset = GetByteSpanOffsetFromIndex(src, len, static_cast(index)); + if (entryOffset == 0) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + + chip::ByteSpan trustedRootCertificatesSpan; // OCTET_STRING + uint16_t trustedRootCertificatesRemainingSpace = static_cast(len - entryOffset); + if (CHIP_NO_ERROR != + ReadByteSpan(src + entryOffset, trustedRootCertificatesRemainingSpace, &trustedRootCertificatesSpan)) + { + ChipLogError(Zcl, "Index %zu is invalid. Not enough remaining space", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + writer.Put(TLV::AnonymousTag, trustedRootCertificatesSpan); + } + break; + } + } + break; + } + } +exit: + err = writer.EndContainer(tmpType); + return err; +} + uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, bool write, uint8_t * dest, uint8_t * src, int32_t index) { @@ -80,8 +160,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo { case 0x003E: // Operational Credentials Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0001: // fabrics list { @@ -94,31 +175,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _FabricDescriptor _FabricDescriptor * entry = reinterpret_cast<_FabricDescriptor *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->FabricIndex, write ? (uint8_t *) &entry->FabricIndex : src, write, - &entryOffset, sizeof(entry->FabricIndex)); // INT8U - ByteSpan * RootPublicKeySpan = &entry->RootPublicKey; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 67, RootPublicKeySpan) - : ReadByteSpan(src + entryOffset, 67, RootPublicKeySpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _FabricDescriptor::ToEmberBuffer(entry, dest + entryOffset, 120, unusedLen); } - entryOffset = static_cast(entryOffset + 67); - copyListMember(write ? dest : (uint8_t *) &entry->VendorId, write ? (uint8_t *) &entry->VendorId : src, write, - &entryOffset, sizeof(entry->VendorId)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->FabricId, write ? (uint8_t *) &entry->FabricId : src, write, - &entryOffset, sizeof(entry->FabricId)); // FABRIC_ID - copyListMember(write ? dest : (uint8_t *) &entry->NodeId, write ? (uint8_t *) &entry->NodeId : src, write, &entryOffset, - sizeof(entry->NodeId)); // NODE_ID - ByteSpan * LabelSpan = &entry->Label; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, LabelSpan) : ReadByteSpan(src + entryOffset, 34, LabelSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _FabricDescriptor::FromEmberBuffer(entry, src + entryOffset, 120); } - entryOffset = static_cast(entryOffset + 34); break; } case 0x0004: // TrustedRootCertificates diff --git a/zzz_generated/pump-app/zap-generated/CHIPClientCallbacks.cpp b/zzz_generated/pump-app/zap-generated/CHIPClientCallbacks.cpp index e5c220dd2c98b9..ec2fc0f771611b 100644 --- a/zzz_generated/pump-app/zap-generated/CHIPClientCallbacks.cpp +++ b/zzz_generated/pump-app/zap-generated/CHIPClientCallbacks.cpp @@ -30,6 +30,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -37,10 +40,6 @@ using namespace ::chip; using namespace ::chip::app::List; -namespace { -[[maybe_unused]] constexpr uint16_t kByteSpanSizeLengthInBytes = 2; -} // namespace - #define CHECK_STATUS_WITH_RETVAL(error, retval) \ if (CHIP_NO_ERROR != error) \ { \ diff --git a/zzz_generated/pump-app/zap-generated/attribute-size.cpp b/zzz_generated/pump-app/zap-generated/attribute-size.cpp index 4e6eb9372d81a1..5b98225a951233 100644 --- a/zzz_generated/pump-app/zap-generated/attribute-size.cpp +++ b/zzz_generated/pump-app/zap-generated/attribute-size.cpp @@ -21,10 +21,13 @@ #include #include #include +#include +#include #include #include using namespace chip; +using namespace chip::app; using namespace chip::app::List; // The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid @@ -45,6 +48,232 @@ void copyListMember(uint8_t * dest, uint8_t * src, bool write, uint16_t * offset *offset = static_cast(*offset + length); } +CHIP_ERROR CopyStructAttributeToCHIPTLV(ClusterId clusterId, AttributeId attributeId, uint8_t * src, uint16_t len, + TLV::TLVWriter & writer, uint64_t tag) +{ + switch (clusterId) + { + } + return CHIP_ERROR_INVALID_ARGUMENT; +} + +CHIP_ERROR EmberListToCHIPTLV(ClusterId clusterId, AttributeId attributeId, uint8_t * src, uint16_t len, TLV::TLVWriter & writer, + uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + size_t count = *reinterpret_cast(src); + uint16_t entryLength = 0; + // Suppress error of unused variable. + (void) entryLength; + (void) count; + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Array, tmpType)); + switch (clusterId) + { + case 0x0030: // General Commissioning Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0001: // BasicCommissioningInfoList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 4; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _BasicCommissioningInfoType + _BasicCommissioningInfoType entry; + SuccessOrExit(err = _BasicCommissioningInfoType::FromEmberBuffer(&entry, src + entryOffset, 4)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x0033: // General Diagnostics Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // NetworkInterfaces + { + for (size_t index = 0; index < count; index++) + { + entryLength = 48; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _NetworkInterfaceType + _NetworkInterfaceType entry; + SuccessOrExit(err = _NetworkInterfaceType::FromEmberBuffer(&entry, src + entryOffset, 48)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x003E: // Operational Credentials Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0001: // fabrics list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 120; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _FabricDescriptor + _FabricDescriptor entry; + SuccessOrExit(err = _FabricDescriptor::FromEmberBuffer(&entry, src + entryOffset, 120)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x0004: // TrustedRootCertificates + { + for (size_t index = 0; index < count; index++) + { + entryOffset = GetByteSpanOffsetFromIndex(src, len, static_cast(index)); + if (entryOffset == 0) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + + chip::ByteSpan trustedRootCertificatesSpan; // OCTET_STRING + uint16_t trustedRootCertificatesRemainingSpace = static_cast(len - entryOffset); + if (CHIP_NO_ERROR != + ReadByteSpan(src + entryOffset, trustedRootCertificatesRemainingSpace, &trustedRootCertificatesSpan)) + { + ChipLogError(Zcl, "Index %zu is invalid. Not enough remaining space", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + writer.Put(TLV::AnonymousTag, trustedRootCertificatesSpan); + } + break; + } + } + break; + } + case 0x0035: // Thread Network Diagnostics Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0007: // NeighborTableList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 31; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _NeighborTable + _NeighborTable entry; + SuccessOrExit(err = _NeighborTable::FromEmberBuffer(&entry, src + entryOffset, 31)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x0008: // RouteTableList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 18; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _RouteTable + _RouteTable entry; + SuccessOrExit(err = _RouteTable::FromEmberBuffer(&entry, src + entryOffset, 18)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x003B: // SecurityPolicy + { + for (size_t index = 0; index < count; index++) + { + entryLength = 3; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _SecurityPolicy + _SecurityPolicy entry; + SuccessOrExit(err = _SecurityPolicy::FromEmberBuffer(&entry, src + entryOffset, 3)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x003D: // OperationalDatasetComponents + { + for (size_t index = 0; index < count; index++) + { + entryLength = 12; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _OperationalDatasetComponents + _OperationalDatasetComponents entry; + SuccessOrExit(err = _OperationalDatasetComponents::FromEmberBuffer(&entry, src + entryOffset, 12)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x003E: // ActiveNetworkFaultsList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 1; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + uint8_t entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // NetworkFault + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + } + break; + } + } +exit: + err = writer.EndContainer(tmpType); + return err; +} + uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, bool write, uint8_t * dest, uint8_t * src, int32_t index) { @@ -80,8 +309,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo { case 0x0030: // General Commissioning Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0001: // BasicCommissioningInfoList { @@ -94,9 +324,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _BasicCommissioningInfoType _BasicCommissioningInfoType * entry = reinterpret_cast<_BasicCommissioningInfoType *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->FailSafeExpiryLengthMs, - write ? (uint8_t *) &entry->FailSafeExpiryLengthMs : src, write, &entryOffset, - sizeof(entry->FailSafeExpiryLengthMs)); // INT32U + if (write) + { + size_t unusedLen; + _BasicCommissioningInfoType::ToEmberBuffer(entry, dest + entryOffset, 4, unusedLen); + } + else + { + _BasicCommissioningInfoType::FromEmberBuffer(entry, src + entryOffset, 4); + } break; } } @@ -104,8 +340,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0033: // General Diagnostics Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // NetworkInterfaces { @@ -118,33 +355,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NetworkInterfaceType _NetworkInterfaceType * entry = reinterpret_cast<_NetworkInterfaceType *>(write ? src : dest); - ByteSpan * NameSpan = &entry->Name; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, NameSpan) : ReadByteSpan(src + entryOffset, 34, NameSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _NetworkInterfaceType::ToEmberBuffer(entry, dest + entryOffset, 48, unusedLen); } - entryOffset = static_cast(entryOffset + 34); - copyListMember(write ? dest : (uint8_t *) &entry->FabricConnected, write ? (uint8_t *) &entry->FabricConnected : src, - write, &entryOffset, sizeof(entry->FabricConnected)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->OffPremiseServicesReachableIPv4, - write ? (uint8_t *) &entry->OffPremiseServicesReachableIPv4 : src, write, &entryOffset, - sizeof(entry->OffPremiseServicesReachableIPv4)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->OffPremiseServicesReachableIPv6, - write ? (uint8_t *) &entry->OffPremiseServicesReachableIPv6 : src, write, &entryOffset, - sizeof(entry->OffPremiseServicesReachableIPv6)); // BOOLEAN - ByteSpan * HardwareAddressSpan = &entry->HardwareAddress; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 10, HardwareAddressSpan) - : ReadByteSpan(src + entryOffset, 10, HardwareAddressSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _NetworkInterfaceType::FromEmberBuffer(entry, src + entryOffset, 48); } - entryOffset = static_cast(entryOffset + 10); - copyListMember(write ? dest : (uint8_t *) &entry->Type, write ? (uint8_t *) &entry->Type : src, write, &entryOffset, - sizeof(entry->Type)); // ENUM8 break; } } @@ -152,8 +371,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x003E: // Operational Credentials Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0001: // fabrics list { @@ -166,31 +386,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _FabricDescriptor _FabricDescriptor * entry = reinterpret_cast<_FabricDescriptor *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->FabricIndex, write ? (uint8_t *) &entry->FabricIndex : src, write, - &entryOffset, sizeof(entry->FabricIndex)); // INT8U - ByteSpan * RootPublicKeySpan = &entry->RootPublicKey; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 67, RootPublicKeySpan) - : ReadByteSpan(src + entryOffset, 67, RootPublicKeySpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _FabricDescriptor::ToEmberBuffer(entry, dest + entryOffset, 120, unusedLen); } - entryOffset = static_cast(entryOffset + 67); - copyListMember(write ? dest : (uint8_t *) &entry->VendorId, write ? (uint8_t *) &entry->VendorId : src, write, - &entryOffset, sizeof(entry->VendorId)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->FabricId, write ? (uint8_t *) &entry->FabricId : src, write, - &entryOffset, sizeof(entry->FabricId)); // FABRIC_ID - copyListMember(write ? dest : (uint8_t *) &entry->NodeId, write ? (uint8_t *) &entry->NodeId : src, write, &entryOffset, - sizeof(entry->NodeId)); // NODE_ID - ByteSpan * LabelSpan = &entry->Label; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, LabelSpan) : ReadByteSpan(src + entryOffset, 34, LabelSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _FabricDescriptor::FromEmberBuffer(entry, src + entryOffset, 120); } - entryOffset = static_cast(entryOffset + 34); break; } case 0x0004: // TrustedRootCertificates @@ -225,8 +429,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0035: // Thread Network Diagnostics Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0007: // NeighborTableList { @@ -239,34 +444,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NeighborTable _NeighborTable * entry = reinterpret_cast<_NeighborTable *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->ExtAddress, write ? (uint8_t *) &entry->ExtAddress : src, write, - &entryOffset, sizeof(entry->ExtAddress)); // INT64U - copyListMember(write ? dest : (uint8_t *) &entry->Age, write ? (uint8_t *) &entry->Age : src, write, &entryOffset, - sizeof(entry->Age)); // INT32U - copyListMember(write ? dest : (uint8_t *) &entry->Rloc16, write ? (uint8_t *) &entry->Rloc16 : src, write, &entryOffset, - sizeof(entry->Rloc16)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->LinkFrameCounter, write ? (uint8_t *) &entry->LinkFrameCounter : src, - write, &entryOffset, sizeof(entry->LinkFrameCounter)); // INT32U - copyListMember(write ? dest : (uint8_t *) &entry->MleFrameCounter, write ? (uint8_t *) &entry->MleFrameCounter : src, - write, &entryOffset, sizeof(entry->MleFrameCounter)); // INT32U - copyListMember(write ? dest : (uint8_t *) &entry->LQI, write ? (uint8_t *) &entry->LQI : src, write, &entryOffset, - sizeof(entry->LQI)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->AverageRssi, write ? (uint8_t *) &entry->AverageRssi : src, write, - &entryOffset, sizeof(entry->AverageRssi)); // INT8S - copyListMember(write ? dest : (uint8_t *) &entry->LastRssi, write ? (uint8_t *) &entry->LastRssi : src, write, - &entryOffset, sizeof(entry->LastRssi)); // INT8S - copyListMember(write ? dest : (uint8_t *) &entry->FrameErrorRate, write ? (uint8_t *) &entry->FrameErrorRate : src, - write, &entryOffset, sizeof(entry->FrameErrorRate)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->MessageErrorRate, write ? (uint8_t *) &entry->MessageErrorRate : src, - write, &entryOffset, sizeof(entry->MessageErrorRate)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->RxOnWhenIdle, write ? (uint8_t *) &entry->RxOnWhenIdle : src, write, - &entryOffset, sizeof(entry->RxOnWhenIdle)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->FullThreadDevice, write ? (uint8_t *) &entry->FullThreadDevice : src, - write, &entryOffset, sizeof(entry->FullThreadDevice)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->FullNetworkData, write ? (uint8_t *) &entry->FullNetworkData : src, - write, &entryOffset, sizeof(entry->FullNetworkData)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->IsChild, write ? (uint8_t *) &entry->IsChild : src, write, - &entryOffset, sizeof(entry->IsChild)); // BOOLEAN + if (write) + { + size_t unusedLen; + _NeighborTable::ToEmberBuffer(entry, dest + entryOffset, 31, unusedLen); + } + else + { + _NeighborTable::FromEmberBuffer(entry, src + entryOffset, 31); + } break; } case 0x0008: // RouteTableList @@ -280,26 +466,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _RouteTable _RouteTable * entry = reinterpret_cast<_RouteTable *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->ExtAddress, write ? (uint8_t *) &entry->ExtAddress : src, write, - &entryOffset, sizeof(entry->ExtAddress)); // INT64U - copyListMember(write ? dest : (uint8_t *) &entry->Rloc16, write ? (uint8_t *) &entry->Rloc16 : src, write, &entryOffset, - sizeof(entry->Rloc16)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->RouterId, write ? (uint8_t *) &entry->RouterId : src, write, - &entryOffset, sizeof(entry->RouterId)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->NextHop, write ? (uint8_t *) &entry->NextHop : src, write, - &entryOffset, sizeof(entry->NextHop)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->PathCost, write ? (uint8_t *) &entry->PathCost : src, write, - &entryOffset, sizeof(entry->PathCost)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->LQIIn, write ? (uint8_t *) &entry->LQIIn : src, write, &entryOffset, - sizeof(entry->LQIIn)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->LQIOut, write ? (uint8_t *) &entry->LQIOut : src, write, &entryOffset, - sizeof(entry->LQIOut)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->Age, write ? (uint8_t *) &entry->Age : src, write, &entryOffset, - sizeof(entry->Age)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->Allocated, write ? (uint8_t *) &entry->Allocated : src, write, - &entryOffset, sizeof(entry->Allocated)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->LinkEstablished, write ? (uint8_t *) &entry->LinkEstablished : src, - write, &entryOffset, sizeof(entry->LinkEstablished)); // BOOLEAN + if (write) + { + size_t unusedLen; + _RouteTable::ToEmberBuffer(entry, dest + entryOffset, 18, unusedLen); + } + else + { + _RouteTable::FromEmberBuffer(entry, src + entryOffset, 18); + } break; } case 0x003B: // SecurityPolicy @@ -313,10 +488,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _SecurityPolicy _SecurityPolicy * entry = reinterpret_cast<_SecurityPolicy *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->RotationTime, write ? (uint8_t *) &entry->RotationTime : src, write, - &entryOffset, sizeof(entry->RotationTime)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->Flags, write ? (uint8_t *) &entry->Flags : src, write, &entryOffset, - sizeof(entry->Flags)); // INT8U + if (write) + { + size_t unusedLen; + _SecurityPolicy::ToEmberBuffer(entry, dest + entryOffset, 3, unusedLen); + } + else + { + _SecurityPolicy::FromEmberBuffer(entry, src + entryOffset, 3); + } break; } case 0x003D: // OperationalDatasetComponents @@ -330,37 +510,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _OperationalDatasetComponents _OperationalDatasetComponents * entry = reinterpret_cast<_OperationalDatasetComponents *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->ActiveTimestampPresent, - write ? (uint8_t *) &entry->ActiveTimestampPresent : src, write, &entryOffset, - sizeof(entry->ActiveTimestampPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->PendingTimestampPresent, - write ? (uint8_t *) &entry->PendingTimestampPresent : src, write, &entryOffset, - sizeof(entry->PendingTimestampPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->MasterKeyPresent, write ? (uint8_t *) &entry->MasterKeyPresent : src, - write, &entryOffset, sizeof(entry->MasterKeyPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->NetworkNamePresent, - write ? (uint8_t *) &entry->NetworkNamePresent : src, write, &entryOffset, - sizeof(entry->NetworkNamePresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->ExtendedPanIdPresent, - write ? (uint8_t *) &entry->ExtendedPanIdPresent : src, write, &entryOffset, - sizeof(entry->ExtendedPanIdPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->MeshLocalPrefixPresent, - write ? (uint8_t *) &entry->MeshLocalPrefixPresent : src, write, &entryOffset, - sizeof(entry->MeshLocalPrefixPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->DelayPresent, write ? (uint8_t *) &entry->DelayPresent : src, write, - &entryOffset, sizeof(entry->DelayPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->PanIdPresent, write ? (uint8_t *) &entry->PanIdPresent : src, write, - &entryOffset, sizeof(entry->PanIdPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->ChannelPresent, write ? (uint8_t *) &entry->ChannelPresent : src, - write, &entryOffset, sizeof(entry->ChannelPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->PskcPresent, write ? (uint8_t *) &entry->PskcPresent : src, write, - &entryOffset, sizeof(entry->PskcPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->SecurityPolicyPresent, - write ? (uint8_t *) &entry->SecurityPolicyPresent : src, write, &entryOffset, - sizeof(entry->SecurityPolicyPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->ChannelMaskPresent, - write ? (uint8_t *) &entry->ChannelMaskPresent : src, write, &entryOffset, - sizeof(entry->ChannelMaskPresent)); // BOOLEAN + if (write) + { + size_t unusedLen; + _OperationalDatasetComponents::ToEmberBuffer(entry, dest + entryOffset, 12, unusedLen); + } + else + { + _OperationalDatasetComponents::FromEmberBuffer(entry, src + entryOffset, 12); + } break; } case 0x003E: // ActiveNetworkFaultsList diff --git a/zzz_generated/pump-controller-app/zap-generated/CHIPClientCallbacks.cpp b/zzz_generated/pump-controller-app/zap-generated/CHIPClientCallbacks.cpp index e5c220dd2c98b9..ec2fc0f771611b 100644 --- a/zzz_generated/pump-controller-app/zap-generated/CHIPClientCallbacks.cpp +++ b/zzz_generated/pump-controller-app/zap-generated/CHIPClientCallbacks.cpp @@ -30,6 +30,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -37,10 +40,6 @@ using namespace ::chip; using namespace ::chip::app::List; -namespace { -[[maybe_unused]] constexpr uint16_t kByteSpanSizeLengthInBytes = 2; -} // namespace - #define CHECK_STATUS_WITH_RETVAL(error, retval) \ if (CHIP_NO_ERROR != error) \ { \ diff --git a/zzz_generated/pump-controller-app/zap-generated/attribute-size.cpp b/zzz_generated/pump-controller-app/zap-generated/attribute-size.cpp index 4e6eb9372d81a1..5b98225a951233 100644 --- a/zzz_generated/pump-controller-app/zap-generated/attribute-size.cpp +++ b/zzz_generated/pump-controller-app/zap-generated/attribute-size.cpp @@ -21,10 +21,13 @@ #include #include #include +#include +#include #include #include using namespace chip; +using namespace chip::app; using namespace chip::app::List; // The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid @@ -45,6 +48,232 @@ void copyListMember(uint8_t * dest, uint8_t * src, bool write, uint16_t * offset *offset = static_cast(*offset + length); } +CHIP_ERROR CopyStructAttributeToCHIPTLV(ClusterId clusterId, AttributeId attributeId, uint8_t * src, uint16_t len, + TLV::TLVWriter & writer, uint64_t tag) +{ + switch (clusterId) + { + } + return CHIP_ERROR_INVALID_ARGUMENT; +} + +CHIP_ERROR EmberListToCHIPTLV(ClusterId clusterId, AttributeId attributeId, uint8_t * src, uint16_t len, TLV::TLVWriter & writer, + uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + size_t count = *reinterpret_cast(src); + uint16_t entryLength = 0; + // Suppress error of unused variable. + (void) entryLength; + (void) count; + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Array, tmpType)); + switch (clusterId) + { + case 0x0030: // General Commissioning Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0001: // BasicCommissioningInfoList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 4; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _BasicCommissioningInfoType + _BasicCommissioningInfoType entry; + SuccessOrExit(err = _BasicCommissioningInfoType::FromEmberBuffer(&entry, src + entryOffset, 4)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x0033: // General Diagnostics Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // NetworkInterfaces + { + for (size_t index = 0; index < count; index++) + { + entryLength = 48; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _NetworkInterfaceType + _NetworkInterfaceType entry; + SuccessOrExit(err = _NetworkInterfaceType::FromEmberBuffer(&entry, src + entryOffset, 48)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x003E: // Operational Credentials Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0001: // fabrics list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 120; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _FabricDescriptor + _FabricDescriptor entry; + SuccessOrExit(err = _FabricDescriptor::FromEmberBuffer(&entry, src + entryOffset, 120)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x0004: // TrustedRootCertificates + { + for (size_t index = 0; index < count; index++) + { + entryOffset = GetByteSpanOffsetFromIndex(src, len, static_cast(index)); + if (entryOffset == 0) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + + chip::ByteSpan trustedRootCertificatesSpan; // OCTET_STRING + uint16_t trustedRootCertificatesRemainingSpace = static_cast(len - entryOffset); + if (CHIP_NO_ERROR != + ReadByteSpan(src + entryOffset, trustedRootCertificatesRemainingSpace, &trustedRootCertificatesSpan)) + { + ChipLogError(Zcl, "Index %zu is invalid. Not enough remaining space", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + writer.Put(TLV::AnonymousTag, trustedRootCertificatesSpan); + } + break; + } + } + break; + } + case 0x0035: // Thread Network Diagnostics Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0007: // NeighborTableList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 31; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _NeighborTable + _NeighborTable entry; + SuccessOrExit(err = _NeighborTable::FromEmberBuffer(&entry, src + entryOffset, 31)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x0008: // RouteTableList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 18; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _RouteTable + _RouteTable entry; + SuccessOrExit(err = _RouteTable::FromEmberBuffer(&entry, src + entryOffset, 18)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x003B: // SecurityPolicy + { + for (size_t index = 0; index < count; index++) + { + entryLength = 3; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _SecurityPolicy + _SecurityPolicy entry; + SuccessOrExit(err = _SecurityPolicy::FromEmberBuffer(&entry, src + entryOffset, 3)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x003D: // OperationalDatasetComponents + { + for (size_t index = 0; index < count; index++) + { + entryLength = 12; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _OperationalDatasetComponents + _OperationalDatasetComponents entry; + SuccessOrExit(err = _OperationalDatasetComponents::FromEmberBuffer(&entry, src + entryOffset, 12)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x003E: // ActiveNetworkFaultsList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 1; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + uint8_t entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // NetworkFault + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + } + break; + } + } +exit: + err = writer.EndContainer(tmpType); + return err; +} + uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, bool write, uint8_t * dest, uint8_t * src, int32_t index) { @@ -80,8 +309,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo { case 0x0030: // General Commissioning Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0001: // BasicCommissioningInfoList { @@ -94,9 +324,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _BasicCommissioningInfoType _BasicCommissioningInfoType * entry = reinterpret_cast<_BasicCommissioningInfoType *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->FailSafeExpiryLengthMs, - write ? (uint8_t *) &entry->FailSafeExpiryLengthMs : src, write, &entryOffset, - sizeof(entry->FailSafeExpiryLengthMs)); // INT32U + if (write) + { + size_t unusedLen; + _BasicCommissioningInfoType::ToEmberBuffer(entry, dest + entryOffset, 4, unusedLen); + } + else + { + _BasicCommissioningInfoType::FromEmberBuffer(entry, src + entryOffset, 4); + } break; } } @@ -104,8 +340,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0033: // General Diagnostics Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // NetworkInterfaces { @@ -118,33 +355,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NetworkInterfaceType _NetworkInterfaceType * entry = reinterpret_cast<_NetworkInterfaceType *>(write ? src : dest); - ByteSpan * NameSpan = &entry->Name; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, NameSpan) : ReadByteSpan(src + entryOffset, 34, NameSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _NetworkInterfaceType::ToEmberBuffer(entry, dest + entryOffset, 48, unusedLen); } - entryOffset = static_cast(entryOffset + 34); - copyListMember(write ? dest : (uint8_t *) &entry->FabricConnected, write ? (uint8_t *) &entry->FabricConnected : src, - write, &entryOffset, sizeof(entry->FabricConnected)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->OffPremiseServicesReachableIPv4, - write ? (uint8_t *) &entry->OffPremiseServicesReachableIPv4 : src, write, &entryOffset, - sizeof(entry->OffPremiseServicesReachableIPv4)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->OffPremiseServicesReachableIPv6, - write ? (uint8_t *) &entry->OffPremiseServicesReachableIPv6 : src, write, &entryOffset, - sizeof(entry->OffPremiseServicesReachableIPv6)); // BOOLEAN - ByteSpan * HardwareAddressSpan = &entry->HardwareAddress; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 10, HardwareAddressSpan) - : ReadByteSpan(src + entryOffset, 10, HardwareAddressSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _NetworkInterfaceType::FromEmberBuffer(entry, src + entryOffset, 48); } - entryOffset = static_cast(entryOffset + 10); - copyListMember(write ? dest : (uint8_t *) &entry->Type, write ? (uint8_t *) &entry->Type : src, write, &entryOffset, - sizeof(entry->Type)); // ENUM8 break; } } @@ -152,8 +371,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x003E: // Operational Credentials Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0001: // fabrics list { @@ -166,31 +386,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _FabricDescriptor _FabricDescriptor * entry = reinterpret_cast<_FabricDescriptor *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->FabricIndex, write ? (uint8_t *) &entry->FabricIndex : src, write, - &entryOffset, sizeof(entry->FabricIndex)); // INT8U - ByteSpan * RootPublicKeySpan = &entry->RootPublicKey; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 67, RootPublicKeySpan) - : ReadByteSpan(src + entryOffset, 67, RootPublicKeySpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _FabricDescriptor::ToEmberBuffer(entry, dest + entryOffset, 120, unusedLen); } - entryOffset = static_cast(entryOffset + 67); - copyListMember(write ? dest : (uint8_t *) &entry->VendorId, write ? (uint8_t *) &entry->VendorId : src, write, - &entryOffset, sizeof(entry->VendorId)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->FabricId, write ? (uint8_t *) &entry->FabricId : src, write, - &entryOffset, sizeof(entry->FabricId)); // FABRIC_ID - copyListMember(write ? dest : (uint8_t *) &entry->NodeId, write ? (uint8_t *) &entry->NodeId : src, write, &entryOffset, - sizeof(entry->NodeId)); // NODE_ID - ByteSpan * LabelSpan = &entry->Label; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, LabelSpan) : ReadByteSpan(src + entryOffset, 34, LabelSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _FabricDescriptor::FromEmberBuffer(entry, src + entryOffset, 120); } - entryOffset = static_cast(entryOffset + 34); break; } case 0x0004: // TrustedRootCertificates @@ -225,8 +429,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0035: // Thread Network Diagnostics Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0007: // NeighborTableList { @@ -239,34 +444,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NeighborTable _NeighborTable * entry = reinterpret_cast<_NeighborTable *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->ExtAddress, write ? (uint8_t *) &entry->ExtAddress : src, write, - &entryOffset, sizeof(entry->ExtAddress)); // INT64U - copyListMember(write ? dest : (uint8_t *) &entry->Age, write ? (uint8_t *) &entry->Age : src, write, &entryOffset, - sizeof(entry->Age)); // INT32U - copyListMember(write ? dest : (uint8_t *) &entry->Rloc16, write ? (uint8_t *) &entry->Rloc16 : src, write, &entryOffset, - sizeof(entry->Rloc16)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->LinkFrameCounter, write ? (uint8_t *) &entry->LinkFrameCounter : src, - write, &entryOffset, sizeof(entry->LinkFrameCounter)); // INT32U - copyListMember(write ? dest : (uint8_t *) &entry->MleFrameCounter, write ? (uint8_t *) &entry->MleFrameCounter : src, - write, &entryOffset, sizeof(entry->MleFrameCounter)); // INT32U - copyListMember(write ? dest : (uint8_t *) &entry->LQI, write ? (uint8_t *) &entry->LQI : src, write, &entryOffset, - sizeof(entry->LQI)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->AverageRssi, write ? (uint8_t *) &entry->AverageRssi : src, write, - &entryOffset, sizeof(entry->AverageRssi)); // INT8S - copyListMember(write ? dest : (uint8_t *) &entry->LastRssi, write ? (uint8_t *) &entry->LastRssi : src, write, - &entryOffset, sizeof(entry->LastRssi)); // INT8S - copyListMember(write ? dest : (uint8_t *) &entry->FrameErrorRate, write ? (uint8_t *) &entry->FrameErrorRate : src, - write, &entryOffset, sizeof(entry->FrameErrorRate)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->MessageErrorRate, write ? (uint8_t *) &entry->MessageErrorRate : src, - write, &entryOffset, sizeof(entry->MessageErrorRate)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->RxOnWhenIdle, write ? (uint8_t *) &entry->RxOnWhenIdle : src, write, - &entryOffset, sizeof(entry->RxOnWhenIdle)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->FullThreadDevice, write ? (uint8_t *) &entry->FullThreadDevice : src, - write, &entryOffset, sizeof(entry->FullThreadDevice)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->FullNetworkData, write ? (uint8_t *) &entry->FullNetworkData : src, - write, &entryOffset, sizeof(entry->FullNetworkData)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->IsChild, write ? (uint8_t *) &entry->IsChild : src, write, - &entryOffset, sizeof(entry->IsChild)); // BOOLEAN + if (write) + { + size_t unusedLen; + _NeighborTable::ToEmberBuffer(entry, dest + entryOffset, 31, unusedLen); + } + else + { + _NeighborTable::FromEmberBuffer(entry, src + entryOffset, 31); + } break; } case 0x0008: // RouteTableList @@ -280,26 +466,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _RouteTable _RouteTable * entry = reinterpret_cast<_RouteTable *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->ExtAddress, write ? (uint8_t *) &entry->ExtAddress : src, write, - &entryOffset, sizeof(entry->ExtAddress)); // INT64U - copyListMember(write ? dest : (uint8_t *) &entry->Rloc16, write ? (uint8_t *) &entry->Rloc16 : src, write, &entryOffset, - sizeof(entry->Rloc16)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->RouterId, write ? (uint8_t *) &entry->RouterId : src, write, - &entryOffset, sizeof(entry->RouterId)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->NextHop, write ? (uint8_t *) &entry->NextHop : src, write, - &entryOffset, sizeof(entry->NextHop)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->PathCost, write ? (uint8_t *) &entry->PathCost : src, write, - &entryOffset, sizeof(entry->PathCost)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->LQIIn, write ? (uint8_t *) &entry->LQIIn : src, write, &entryOffset, - sizeof(entry->LQIIn)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->LQIOut, write ? (uint8_t *) &entry->LQIOut : src, write, &entryOffset, - sizeof(entry->LQIOut)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->Age, write ? (uint8_t *) &entry->Age : src, write, &entryOffset, - sizeof(entry->Age)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->Allocated, write ? (uint8_t *) &entry->Allocated : src, write, - &entryOffset, sizeof(entry->Allocated)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->LinkEstablished, write ? (uint8_t *) &entry->LinkEstablished : src, - write, &entryOffset, sizeof(entry->LinkEstablished)); // BOOLEAN + if (write) + { + size_t unusedLen; + _RouteTable::ToEmberBuffer(entry, dest + entryOffset, 18, unusedLen); + } + else + { + _RouteTable::FromEmberBuffer(entry, src + entryOffset, 18); + } break; } case 0x003B: // SecurityPolicy @@ -313,10 +488,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _SecurityPolicy _SecurityPolicy * entry = reinterpret_cast<_SecurityPolicy *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->RotationTime, write ? (uint8_t *) &entry->RotationTime : src, write, - &entryOffset, sizeof(entry->RotationTime)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->Flags, write ? (uint8_t *) &entry->Flags : src, write, &entryOffset, - sizeof(entry->Flags)); // INT8U + if (write) + { + size_t unusedLen; + _SecurityPolicy::ToEmberBuffer(entry, dest + entryOffset, 3, unusedLen); + } + else + { + _SecurityPolicy::FromEmberBuffer(entry, src + entryOffset, 3); + } break; } case 0x003D: // OperationalDatasetComponents @@ -330,37 +510,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _OperationalDatasetComponents _OperationalDatasetComponents * entry = reinterpret_cast<_OperationalDatasetComponents *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->ActiveTimestampPresent, - write ? (uint8_t *) &entry->ActiveTimestampPresent : src, write, &entryOffset, - sizeof(entry->ActiveTimestampPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->PendingTimestampPresent, - write ? (uint8_t *) &entry->PendingTimestampPresent : src, write, &entryOffset, - sizeof(entry->PendingTimestampPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->MasterKeyPresent, write ? (uint8_t *) &entry->MasterKeyPresent : src, - write, &entryOffset, sizeof(entry->MasterKeyPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->NetworkNamePresent, - write ? (uint8_t *) &entry->NetworkNamePresent : src, write, &entryOffset, - sizeof(entry->NetworkNamePresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->ExtendedPanIdPresent, - write ? (uint8_t *) &entry->ExtendedPanIdPresent : src, write, &entryOffset, - sizeof(entry->ExtendedPanIdPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->MeshLocalPrefixPresent, - write ? (uint8_t *) &entry->MeshLocalPrefixPresent : src, write, &entryOffset, - sizeof(entry->MeshLocalPrefixPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->DelayPresent, write ? (uint8_t *) &entry->DelayPresent : src, write, - &entryOffset, sizeof(entry->DelayPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->PanIdPresent, write ? (uint8_t *) &entry->PanIdPresent : src, write, - &entryOffset, sizeof(entry->PanIdPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->ChannelPresent, write ? (uint8_t *) &entry->ChannelPresent : src, - write, &entryOffset, sizeof(entry->ChannelPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->PskcPresent, write ? (uint8_t *) &entry->PskcPresent : src, write, - &entryOffset, sizeof(entry->PskcPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->SecurityPolicyPresent, - write ? (uint8_t *) &entry->SecurityPolicyPresent : src, write, &entryOffset, - sizeof(entry->SecurityPolicyPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->ChannelMaskPresent, - write ? (uint8_t *) &entry->ChannelMaskPresent : src, write, &entryOffset, - sizeof(entry->ChannelMaskPresent)); // BOOLEAN + if (write) + { + size_t unusedLen; + _OperationalDatasetComponents::ToEmberBuffer(entry, dest + entryOffset, 12, unusedLen); + } + else + { + _OperationalDatasetComponents::FromEmberBuffer(entry, src + entryOffset, 12); + } break; } case 0x003E: // ActiveNetworkFaultsList diff --git a/zzz_generated/temperature-measurement-app/zap-generated/attribute-size.cpp b/zzz_generated/temperature-measurement-app/zap-generated/attribute-size.cpp index 015693849ff5af..ec812101708300 100644 --- a/zzz_generated/temperature-measurement-app/zap-generated/attribute-size.cpp +++ b/zzz_generated/temperature-measurement-app/zap-generated/attribute-size.cpp @@ -21,10 +21,13 @@ #include #include #include +#include +#include #include #include using namespace chip; +using namespace chip::app; using namespace chip::app::List; // The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid @@ -45,6 +48,135 @@ void copyListMember(uint8_t * dest, uint8_t * src, bool write, uint16_t * offset *offset = static_cast(*offset + length); } +CHIP_ERROR CopyStructAttributeToCHIPTLV(ClusterId clusterId, AttributeId attributeId, uint8_t * src, uint16_t len, + TLV::TLVWriter & writer, uint64_t tag) +{ + switch (clusterId) + { + } + return CHIP_ERROR_INVALID_ARGUMENT; +} + +CHIP_ERROR EmberListToCHIPTLV(ClusterId clusterId, AttributeId attributeId, uint8_t * src, uint16_t len, TLV::TLVWriter & writer, + uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + size_t count = *reinterpret_cast(src); + uint16_t entryLength = 0; + // Suppress error of unused variable. + (void) entryLength; + (void) count; + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Array, tmpType)); + switch (clusterId) + { + case 0x0030: // General Commissioning Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0001: // BasicCommissioningInfoList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 4; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _BasicCommissioningInfoType + _BasicCommissioningInfoType entry; + SuccessOrExit(err = _BasicCommissioningInfoType::FromEmberBuffer(&entry, src + entryOffset, 4)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x0033: // General Diagnostics Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // NetworkInterfaces + { + for (size_t index = 0; index < count; index++) + { + entryLength = 48; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _NetworkInterfaceType + _NetworkInterfaceType entry; + SuccessOrExit(err = _NetworkInterfaceType::FromEmberBuffer(&entry, src + entryOffset, 48)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x003E: // Operational Credentials Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0001: // fabrics list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 120; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _FabricDescriptor + _FabricDescriptor entry; + SuccessOrExit(err = _FabricDescriptor::FromEmberBuffer(&entry, src + entryOffset, 120)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x0004: // TrustedRootCertificates + { + for (size_t index = 0; index < count; index++) + { + entryOffset = GetByteSpanOffsetFromIndex(src, len, static_cast(index)); + if (entryOffset == 0) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + + chip::ByteSpan trustedRootCertificatesSpan; // OCTET_STRING + uint16_t trustedRootCertificatesRemainingSpace = static_cast(len - entryOffset); + if (CHIP_NO_ERROR != + ReadByteSpan(src + entryOffset, trustedRootCertificatesRemainingSpace, &trustedRootCertificatesSpan)) + { + ChipLogError(Zcl, "Index %zu is invalid. Not enough remaining space", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + writer.Put(TLV::AnonymousTag, trustedRootCertificatesSpan); + } + break; + } + } + break; + } + } +exit: + err = writer.EndContainer(tmpType); + return err; +} + uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, bool write, uint8_t * dest, uint8_t * src, int32_t index) { @@ -80,8 +212,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo { case 0x0030: // General Commissioning Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0001: // BasicCommissioningInfoList { @@ -94,9 +227,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _BasicCommissioningInfoType _BasicCommissioningInfoType * entry = reinterpret_cast<_BasicCommissioningInfoType *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->FailSafeExpiryLengthMs, - write ? (uint8_t *) &entry->FailSafeExpiryLengthMs : src, write, &entryOffset, - sizeof(entry->FailSafeExpiryLengthMs)); // INT32U + if (write) + { + size_t unusedLen; + _BasicCommissioningInfoType::ToEmberBuffer(entry, dest + entryOffset, 4, unusedLen); + } + else + { + _BasicCommissioningInfoType::FromEmberBuffer(entry, src + entryOffset, 4); + } break; } } @@ -104,8 +243,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0033: // General Diagnostics Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // NetworkInterfaces { @@ -118,33 +258,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NetworkInterfaceType _NetworkInterfaceType * entry = reinterpret_cast<_NetworkInterfaceType *>(write ? src : dest); - ByteSpan * NameSpan = &entry->Name; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, NameSpan) : ReadByteSpan(src + entryOffset, 34, NameSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _NetworkInterfaceType::ToEmberBuffer(entry, dest + entryOffset, 48, unusedLen); } - entryOffset = static_cast(entryOffset + 34); - copyListMember(write ? dest : (uint8_t *) &entry->FabricConnected, write ? (uint8_t *) &entry->FabricConnected : src, - write, &entryOffset, sizeof(entry->FabricConnected)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->OffPremiseServicesReachableIPv4, - write ? (uint8_t *) &entry->OffPremiseServicesReachableIPv4 : src, write, &entryOffset, - sizeof(entry->OffPremiseServicesReachableIPv4)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->OffPremiseServicesReachableIPv6, - write ? (uint8_t *) &entry->OffPremiseServicesReachableIPv6 : src, write, &entryOffset, - sizeof(entry->OffPremiseServicesReachableIPv6)); // BOOLEAN - ByteSpan * HardwareAddressSpan = &entry->HardwareAddress; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 10, HardwareAddressSpan) - : ReadByteSpan(src + entryOffset, 10, HardwareAddressSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _NetworkInterfaceType::FromEmberBuffer(entry, src + entryOffset, 48); } - entryOffset = static_cast(entryOffset + 10); - copyListMember(write ? dest : (uint8_t *) &entry->Type, write ? (uint8_t *) &entry->Type : src, write, &entryOffset, - sizeof(entry->Type)); // ENUM8 break; } } @@ -152,8 +274,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x003E: // Operational Credentials Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0001: // fabrics list { @@ -166,31 +289,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _FabricDescriptor _FabricDescriptor * entry = reinterpret_cast<_FabricDescriptor *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->FabricIndex, write ? (uint8_t *) &entry->FabricIndex : src, write, - &entryOffset, sizeof(entry->FabricIndex)); // INT8U - ByteSpan * RootPublicKeySpan = &entry->RootPublicKey; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 67, RootPublicKeySpan) - : ReadByteSpan(src + entryOffset, 67, RootPublicKeySpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _FabricDescriptor::ToEmberBuffer(entry, dest + entryOffset, 120, unusedLen); } - entryOffset = static_cast(entryOffset + 67); - copyListMember(write ? dest : (uint8_t *) &entry->VendorId, write ? (uint8_t *) &entry->VendorId : src, write, - &entryOffset, sizeof(entry->VendorId)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->FabricId, write ? (uint8_t *) &entry->FabricId : src, write, - &entryOffset, sizeof(entry->FabricId)); // FABRIC_ID - copyListMember(write ? dest : (uint8_t *) &entry->NodeId, write ? (uint8_t *) &entry->NodeId : src, write, &entryOffset, - sizeof(entry->NodeId)); // NODE_ID - ByteSpan * LabelSpan = &entry->Label; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, LabelSpan) : ReadByteSpan(src + entryOffset, 34, LabelSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _FabricDescriptor::FromEmberBuffer(entry, src + entryOffset, 120); } - entryOffset = static_cast(entryOffset + 34); break; } case 0x0004: // TrustedRootCertificates diff --git a/zzz_generated/thermostat/zap-generated/attribute-size.cpp b/zzz_generated/thermostat/zap-generated/attribute-size.cpp index 68632836dadd58..26666972b3d0e4 100644 --- a/zzz_generated/thermostat/zap-generated/attribute-size.cpp +++ b/zzz_generated/thermostat/zap-generated/attribute-size.cpp @@ -21,10 +21,13 @@ #include #include #include +#include +#include #include #include using namespace chip; +using namespace chip::app; using namespace chip::app::List; // The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid @@ -45,6 +48,621 @@ void copyListMember(uint8_t * dest, uint8_t * src, bool write, uint16_t * offset *offset = static_cast(*offset + length); } +CHIP_ERROR CopyStructAttributeToCHIPTLV(ClusterId clusterId, AttributeId attributeId, uint8_t * src, uint16_t len, + TLV::TLVWriter & writer, uint64_t tag) +{ + switch (clusterId) + { + } + return CHIP_ERROR_INVALID_ARGUMENT; +} + +CHIP_ERROR EmberListToCHIPTLV(ClusterId clusterId, AttributeId attributeId, uint8_t * src, uint16_t len, TLV::TLVWriter & writer, + uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + size_t count = *reinterpret_cast(src); + uint16_t entryLength = 0; + // Suppress error of unused variable. + (void) entryLength; + (void) count; + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Array, tmpType)); + switch (clusterId) + { + case 0x050C: // Application Launcher Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // application launcher list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 2; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + uint16_t entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // INT16U + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + } + break; + } + case 0x050B: // Audio Output Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // audio output list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 36; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _AudioOutputInfo + _AudioOutputInfo entry; + SuccessOrExit(err = _AudioOutputInfo::FromEmberBuffer(&entry, src + entryOffset, 36)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x050A: // Content Launcher Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // accepts header list + { + for (size_t index = 0; index < count; index++) + { + entryOffset = GetByteSpanOffsetFromIndex(src, len, static_cast(index)); + if (entryOffset == 0) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + + chip::ByteSpan acceptsHeaderListSpan; // OCTET_STRING + uint16_t acceptsHeaderListRemainingSpace = static_cast(len - entryOffset); + if (CHIP_NO_ERROR != ReadByteSpan(src + entryOffset, acceptsHeaderListRemainingSpace, &acceptsHeaderListSpan)) + { + ChipLogError(Zcl, "Index %zu is invalid. Not enough remaining space", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + writer.Put(TLV::AnonymousTag, acceptsHeaderListSpan); + } + break; + } + case 0x0001: // supported streaming types + { + for (size_t index = 0; index < count; index++) + { + entryLength = 1; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + uint8_t entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, + entryLength); // ContentLaunchStreamingType + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + } + break; + } + case 0x001D: // Descriptor Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // device list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 6; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _DeviceType + _DeviceType entry; + SuccessOrExit(err = _DeviceType::FromEmberBuffer(&entry, src + entryOffset, 6)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x0001: // server list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 4; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + chip::ClusterId entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // CLUSTER_ID + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + case 0x0002: // client list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 4; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + chip::ClusterId entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // CLUSTER_ID + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + case 0x0003: // parts list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 2; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + chip::EndpointId entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // ENDPOINT_NO + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + } + break; + } + case 0x0040: // Fixed Label Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // label list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 36; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _LabelStruct + _LabelStruct entry; + SuccessOrExit(err = _LabelStruct::FromEmberBuffer(&entry, src + entryOffset, 36)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x0030: // General Commissioning Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0001: // BasicCommissioningInfoList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 4; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _BasicCommissioningInfoType + _BasicCommissioningInfoType entry; + SuccessOrExit(err = _BasicCommissioningInfoType::FromEmberBuffer(&entry, src + entryOffset, 4)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x0033: // General Diagnostics Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // NetworkInterfaces + { + for (size_t index = 0; index < count; index++) + { + entryLength = 48; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _NetworkInterfaceType + _NetworkInterfaceType entry; + SuccessOrExit(err = _NetworkInterfaceType::FromEmberBuffer(&entry, src + entryOffset, 48)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0xF004: // Group Key Management Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // groups + { + for (size_t index = 0; index < count; index++) + { + entryLength = 6; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _GroupState + _GroupState entry; + SuccessOrExit(err = _GroupState::FromEmberBuffer(&entry, src + entryOffset, 6)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x0001: // group keys + { + for (size_t index = 0; index < count; index++) + { + entryLength = 31; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _GroupKey + _GroupKey entry; + SuccessOrExit(err = _GroupKey::FromEmberBuffer(&entry, src + entryOffset, 31)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x0507: // Media Input Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // media input list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 70; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _MediaInputInfo + _MediaInputInfo entry; + SuccessOrExit(err = _MediaInputInfo::FromEmberBuffer(&entry, src + entryOffset, 70)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x003E: // Operational Credentials Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0001: // fabrics list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 120; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _FabricDescriptor + _FabricDescriptor entry; + SuccessOrExit(err = _FabricDescriptor::FromEmberBuffer(&entry, src + entryOffset, 120)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x0004: // TrustedRootCertificates + { + for (size_t index = 0; index < count; index++) + { + entryOffset = GetByteSpanOffsetFromIndex(src, len, static_cast(index)); + if (entryOffset == 0) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + + chip::ByteSpan trustedRootCertificatesSpan; // OCTET_STRING + uint16_t trustedRootCertificatesRemainingSpace = static_cast(len - entryOffset); + if (CHIP_NO_ERROR != + ReadByteSpan(src + entryOffset, trustedRootCertificatesRemainingSpace, &trustedRootCertificatesSpan)) + { + ChipLogError(Zcl, "Index %zu is invalid. Not enough remaining space", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + writer.Put(TLV::AnonymousTag, trustedRootCertificatesSpan); + } + break; + } + } + break; + } + case 0x0504: // TV Channel Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // tv channel list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 106; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _TvChannelInfo + _TvChannelInfo entry; + SuccessOrExit(err = _TvChannelInfo::FromEmberBuffer(&entry, src + entryOffset, 106)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x0505: // Target Navigator Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // target navigator list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 35; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _NavigateTargetTargetInfo + _NavigateTargetTargetInfo entry; + SuccessOrExit(err = _NavigateTargetTargetInfo::FromEmberBuffer(&entry, src + entryOffset, 35)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x050F: // Test Cluster Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x001A: // list_int8u + { + for (size_t index = 0; index < count; index++) + { + entryLength = 1; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + uint8_t entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // INT8U + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + case 0x001B: // list_octet_string + { + for (size_t index = 0; index < count; index++) + { + entryOffset = GetByteSpanOffsetFromIndex(src, len, static_cast(index)); + if (entryOffset == 0) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + + chip::ByteSpan listOctetStringSpan; // OCTET_STRING + uint16_t listOctetStringRemainingSpace = static_cast(len - entryOffset); + if (CHIP_NO_ERROR != ReadByteSpan(src + entryOffset, listOctetStringRemainingSpace, &listOctetStringSpan)) + { + ChipLogError(Zcl, "Index %zu is invalid. Not enough remaining space", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + writer.Put(TLV::AnonymousTag, listOctetStringSpan); + } + break; + } + case 0x001C: // list_struct_octet_string + { + for (size_t index = 0; index < count; index++) + { + entryLength = 42; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _TestListStructOctet + _TestListStructOctet entry; + SuccessOrExit(err = _TestListStructOctet::FromEmberBuffer(&entry, src + entryOffset, 42)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x0035: // Thread Network Diagnostics Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0007: // NeighborTableList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 31; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _NeighborTable + _NeighborTable entry; + SuccessOrExit(err = _NeighborTable::FromEmberBuffer(&entry, src + entryOffset, 31)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x0008: // RouteTableList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 18; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _RouteTable + _RouteTable entry; + SuccessOrExit(err = _RouteTable::FromEmberBuffer(&entry, src + entryOffset, 18)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x003B: // SecurityPolicy + { + for (size_t index = 0; index < count; index++) + { + entryLength = 3; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _SecurityPolicy + _SecurityPolicy entry; + SuccessOrExit(err = _SecurityPolicy::FromEmberBuffer(&entry, src + entryOffset, 3)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x003D: // OperationalDatasetComponents + { + for (size_t index = 0; index < count; index++) + { + entryLength = 12; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _OperationalDatasetComponents + _OperationalDatasetComponents entry; + SuccessOrExit(err = _OperationalDatasetComponents::FromEmberBuffer(&entry, src + entryOffset, 12)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x003E: // ActiveNetworkFaultsList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 1; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + uint8_t entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // NetworkFault + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + } + break; + } + } +exit: + err = writer.EndContainer(tmpType); + return err; +} + uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, bool write, uint8_t * dest, uint8_t * src, int32_t index) { @@ -80,8 +698,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo { case 0x050C: // Application Launcher Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // application launcher list { @@ -100,8 +719,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x050B: // Audio Output Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // audio output list { @@ -114,18 +734,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _AudioOutputInfo _AudioOutputInfo * entry = reinterpret_cast<_AudioOutputInfo *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->index, write ? (uint8_t *) &entry->index : src, write, &entryOffset, - sizeof(entry->index)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->outputType, write ? (uint8_t *) &entry->outputType : src, write, - &entryOffset, sizeof(entry->outputType)); // AudioOutputType - ByteSpan * nameSpan = &entry->name; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _AudioOutputInfo::ToEmberBuffer(entry, dest + entryOffset, 36, unusedLen); + } + else + { + _AudioOutputInfo::FromEmberBuffer(entry, src + entryOffset, 36); } - entryOffset = static_cast(entryOffset + 34); break; } } @@ -133,8 +750,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x050A: // Content Launcher Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // accepts header list { @@ -180,8 +798,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x001D: // Descriptor Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // device list { @@ -194,10 +813,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _DeviceType _DeviceType * entry = reinterpret_cast<_DeviceType *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->type, write ? (uint8_t *) &entry->type : src, write, &entryOffset, - sizeof(entry->type)); // DEVTYPE_ID - copyListMember(write ? dest : (uint8_t *) &entry->revision, write ? (uint8_t *) &entry->revision : src, write, - &entryOffset, sizeof(entry->revision)); // INT16U + if (write) + { + size_t unusedLen; + _DeviceType::ToEmberBuffer(entry, dest + entryOffset, 6, unusedLen); + } + else + { + _DeviceType::FromEmberBuffer(entry, src + entryOffset, 6); + } break; } case 0x0001: // server list @@ -241,8 +865,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0040: // Fixed Label Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // label list { @@ -255,22 +880,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _LabelStruct _LabelStruct * entry = reinterpret_cast<_LabelStruct *>(write ? src : dest); - ByteSpan * labelSpan = &entry->label; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 18, labelSpan) : ReadByteSpan(src + entryOffset, 18, labelSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _LabelStruct::ToEmberBuffer(entry, dest + entryOffset, 36, unusedLen); } - entryOffset = static_cast(entryOffset + 18); - ByteSpan * valueSpan = &entry->value; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 18, valueSpan) : ReadByteSpan(src + entryOffset, 18, valueSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _LabelStruct::FromEmberBuffer(entry, src + entryOffset, 36); } - entryOffset = static_cast(entryOffset + 18); break; } } @@ -278,8 +896,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0030: // General Commissioning Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0001: // BasicCommissioningInfoList { @@ -292,9 +911,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _BasicCommissioningInfoType _BasicCommissioningInfoType * entry = reinterpret_cast<_BasicCommissioningInfoType *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->FailSafeExpiryLengthMs, - write ? (uint8_t *) &entry->FailSafeExpiryLengthMs : src, write, &entryOffset, - sizeof(entry->FailSafeExpiryLengthMs)); // INT32U + if (write) + { + size_t unusedLen; + _BasicCommissioningInfoType::ToEmberBuffer(entry, dest + entryOffset, 4, unusedLen); + } + else + { + _BasicCommissioningInfoType::FromEmberBuffer(entry, src + entryOffset, 4); + } break; } } @@ -302,8 +927,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0033: // General Diagnostics Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // NetworkInterfaces { @@ -316,33 +942,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NetworkInterfaceType _NetworkInterfaceType * entry = reinterpret_cast<_NetworkInterfaceType *>(write ? src : dest); - ByteSpan * NameSpan = &entry->Name; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, NameSpan) : ReadByteSpan(src + entryOffset, 34, NameSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _NetworkInterfaceType::ToEmberBuffer(entry, dest + entryOffset, 48, unusedLen); } - entryOffset = static_cast(entryOffset + 34); - copyListMember(write ? dest : (uint8_t *) &entry->FabricConnected, write ? (uint8_t *) &entry->FabricConnected : src, - write, &entryOffset, sizeof(entry->FabricConnected)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->OffPremiseServicesReachableIPv4, - write ? (uint8_t *) &entry->OffPremiseServicesReachableIPv4 : src, write, &entryOffset, - sizeof(entry->OffPremiseServicesReachableIPv4)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->OffPremiseServicesReachableIPv6, - write ? (uint8_t *) &entry->OffPremiseServicesReachableIPv6 : src, write, &entryOffset, - sizeof(entry->OffPremiseServicesReachableIPv6)); // BOOLEAN - ByteSpan * HardwareAddressSpan = &entry->HardwareAddress; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 10, HardwareAddressSpan) - : ReadByteSpan(src + entryOffset, 10, HardwareAddressSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _NetworkInterfaceType::FromEmberBuffer(entry, src + entryOffset, 48); } - entryOffset = static_cast(entryOffset + 10); - copyListMember(write ? dest : (uint8_t *) &entry->Type, write ? (uint8_t *) &entry->Type : src, write, &entryOffset, - sizeof(entry->Type)); // ENUM8 break; } } @@ -350,8 +958,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0xF004: // Group Key Management Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // groups { @@ -364,12 +973,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _GroupState _GroupState * entry = reinterpret_cast<_GroupState *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->VendorId, write ? (uint8_t *) &entry->VendorId : src, write, - &entryOffset, sizeof(entry->VendorId)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->VendorGroupId, write ? (uint8_t *) &entry->VendorGroupId : src, write, - &entryOffset, sizeof(entry->VendorGroupId)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->GroupKeySetIndex, write ? (uint8_t *) &entry->GroupKeySetIndex : src, - write, &entryOffset, sizeof(entry->GroupKeySetIndex)); // INT16U + if (write) + { + size_t unusedLen; + _GroupState::ToEmberBuffer(entry, dest + entryOffset, 6, unusedLen); + } + else + { + _GroupState::FromEmberBuffer(entry, src + entryOffset, 6); + } break; } case 0x0001: // group keys @@ -383,25 +995,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _GroupKey _GroupKey * entry = reinterpret_cast<_GroupKey *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->VendorId, write ? (uint8_t *) &entry->VendorId : src, write, - &entryOffset, sizeof(entry->VendorId)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->GroupKeyIndex, write ? (uint8_t *) &entry->GroupKeyIndex : src, write, - &entryOffset, sizeof(entry->GroupKeyIndex)); // INT16U - ByteSpan * GroupKeyRootSpan = &entry->GroupKeyRoot; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 18, GroupKeyRootSpan) - : ReadByteSpan(src + entryOffset, 18, GroupKeyRootSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _GroupKey::ToEmberBuffer(entry, dest + entryOffset, 31, unusedLen); + } + else + { + _GroupKey::FromEmberBuffer(entry, src + entryOffset, 31); } - entryOffset = static_cast(entryOffset + 18); - copyListMember(write ? dest : (uint8_t *) &entry->GroupKeyEpochStartTime, - write ? (uint8_t *) &entry->GroupKeyEpochStartTime : src, write, &entryOffset, - sizeof(entry->GroupKeyEpochStartTime)); // INT64U - copyListMember(write ? dest : (uint8_t *) &entry->GroupKeySecurityPolicy, - write ? (uint8_t *) &entry->GroupKeySecurityPolicy : src, write, &entryOffset, - sizeof(entry->GroupKeySecurityPolicy)); // GroupKeySecurityPolicy break; } } @@ -409,8 +1011,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0507: // Media Input Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // media input list { @@ -423,27 +1026,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _MediaInputInfo _MediaInputInfo * entry = reinterpret_cast<_MediaInputInfo *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->index, write ? (uint8_t *) &entry->index : src, write, &entryOffset, - sizeof(entry->index)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->inputType, write ? (uint8_t *) &entry->inputType : src, write, - &entryOffset, sizeof(entry->inputType)); // MediaInputType - ByteSpan * nameSpan = &entry->name; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _MediaInputInfo::ToEmberBuffer(entry, dest + entryOffset, 70, unusedLen); } - entryOffset = static_cast(entryOffset + 34); - ByteSpan * descriptionSpan = &entry->description; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, descriptionSpan) - : ReadByteSpan(src + entryOffset, 34, descriptionSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _MediaInputInfo::FromEmberBuffer(entry, src + entryOffset, 70); } - entryOffset = static_cast(entryOffset + 34); break; } } @@ -451,8 +1042,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x003E: // Operational Credentials Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0001: // fabrics list { @@ -465,31 +1057,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _FabricDescriptor _FabricDescriptor * entry = reinterpret_cast<_FabricDescriptor *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->FabricIndex, write ? (uint8_t *) &entry->FabricIndex : src, write, - &entryOffset, sizeof(entry->FabricIndex)); // INT8U - ByteSpan * RootPublicKeySpan = &entry->RootPublicKey; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 67, RootPublicKeySpan) - : ReadByteSpan(src + entryOffset, 67, RootPublicKeySpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _FabricDescriptor::ToEmberBuffer(entry, dest + entryOffset, 120, unusedLen); } - entryOffset = static_cast(entryOffset + 67); - copyListMember(write ? dest : (uint8_t *) &entry->VendorId, write ? (uint8_t *) &entry->VendorId : src, write, - &entryOffset, sizeof(entry->VendorId)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->FabricId, write ? (uint8_t *) &entry->FabricId : src, write, - &entryOffset, sizeof(entry->FabricId)); // FABRIC_ID - copyListMember(write ? dest : (uint8_t *) &entry->NodeId, write ? (uint8_t *) &entry->NodeId : src, write, &entryOffset, - sizeof(entry->NodeId)); // NODE_ID - ByteSpan * LabelSpan = &entry->Label; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, LabelSpan) : ReadByteSpan(src + entryOffset, 34, LabelSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _FabricDescriptor::FromEmberBuffer(entry, src + entryOffset, 120); } - entryOffset = static_cast(entryOffset + 34); break; } case 0x0004: // TrustedRootCertificates @@ -524,8 +1100,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0504: // TV Channel Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // tv channel list { @@ -538,35 +1115,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _TvChannelInfo _TvChannelInfo * entry = reinterpret_cast<_TvChannelInfo *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->majorNumber, write ? (uint8_t *) &entry->majorNumber : src, write, - &entryOffset, sizeof(entry->majorNumber)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->minorNumber, write ? (uint8_t *) &entry->minorNumber : src, write, - &entryOffset, sizeof(entry->minorNumber)); // INT16U - ByteSpan * nameSpan = &entry->name; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _TvChannelInfo::ToEmberBuffer(entry, dest + entryOffset, 106, unusedLen); } - entryOffset = static_cast(entryOffset + 34); - ByteSpan * callSignSpan = &entry->callSign; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, callSignSpan) : ReadByteSpan(src + entryOffset, 34, callSignSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _TvChannelInfo::FromEmberBuffer(entry, src + entryOffset, 106); } - entryOffset = static_cast(entryOffset + 34); - ByteSpan * affiliateCallSignSpan = &entry->affiliateCallSign; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, affiliateCallSignSpan) - : ReadByteSpan(src + entryOffset, 34, affiliateCallSignSpan))) - { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; - } - entryOffset = static_cast(entryOffset + 34); break; } } @@ -574,8 +1131,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0505: // Target Navigator Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // target navigator list { @@ -588,16 +1146,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NavigateTargetTargetInfo _NavigateTargetTargetInfo * entry = reinterpret_cast<_NavigateTargetTargetInfo *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->identifier, write ? (uint8_t *) &entry->identifier : src, write, - &entryOffset, sizeof(entry->identifier)); // INT8U - ByteSpan * nameSpan = &entry->name; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _NavigateTargetTargetInfo::ToEmberBuffer(entry, dest + entryOffset, 35, unusedLen); + } + else + { + _NavigateTargetTargetInfo::FromEmberBuffer(entry, src + entryOffset, 35); } - entryOffset = static_cast(entryOffset + 34); break; } } @@ -605,8 +1162,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x050F: // Test Cluster Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x001A: // list_int8u { @@ -658,17 +1216,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _TestListStructOctet _TestListStructOctet * entry = reinterpret_cast<_TestListStructOctet *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->fabricIndex, write ? (uint8_t *) &entry->fabricIndex : src, write, - &entryOffset, sizeof(entry->fabricIndex)); // INT64U - ByteSpan * operationalCertSpan = &entry->operationalCert; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, operationalCertSpan) - : ReadByteSpan(src + entryOffset, 34, operationalCertSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _TestListStructOctet::ToEmberBuffer(entry, dest + entryOffset, 42, unusedLen); + } + else + { + _TestListStructOctet::FromEmberBuffer(entry, src + entryOffset, 42); } - entryOffset = static_cast(entryOffset + 34); break; } } @@ -676,8 +1232,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0035: // Thread Network Diagnostics Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0007: // NeighborTableList { @@ -690,34 +1247,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NeighborTable _NeighborTable * entry = reinterpret_cast<_NeighborTable *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->ExtAddress, write ? (uint8_t *) &entry->ExtAddress : src, write, - &entryOffset, sizeof(entry->ExtAddress)); // INT64U - copyListMember(write ? dest : (uint8_t *) &entry->Age, write ? (uint8_t *) &entry->Age : src, write, &entryOffset, - sizeof(entry->Age)); // INT32U - copyListMember(write ? dest : (uint8_t *) &entry->Rloc16, write ? (uint8_t *) &entry->Rloc16 : src, write, &entryOffset, - sizeof(entry->Rloc16)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->LinkFrameCounter, write ? (uint8_t *) &entry->LinkFrameCounter : src, - write, &entryOffset, sizeof(entry->LinkFrameCounter)); // INT32U - copyListMember(write ? dest : (uint8_t *) &entry->MleFrameCounter, write ? (uint8_t *) &entry->MleFrameCounter : src, - write, &entryOffset, sizeof(entry->MleFrameCounter)); // INT32U - copyListMember(write ? dest : (uint8_t *) &entry->LQI, write ? (uint8_t *) &entry->LQI : src, write, &entryOffset, - sizeof(entry->LQI)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->AverageRssi, write ? (uint8_t *) &entry->AverageRssi : src, write, - &entryOffset, sizeof(entry->AverageRssi)); // INT8S - copyListMember(write ? dest : (uint8_t *) &entry->LastRssi, write ? (uint8_t *) &entry->LastRssi : src, write, - &entryOffset, sizeof(entry->LastRssi)); // INT8S - copyListMember(write ? dest : (uint8_t *) &entry->FrameErrorRate, write ? (uint8_t *) &entry->FrameErrorRate : src, - write, &entryOffset, sizeof(entry->FrameErrorRate)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->MessageErrorRate, write ? (uint8_t *) &entry->MessageErrorRate : src, - write, &entryOffset, sizeof(entry->MessageErrorRate)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->RxOnWhenIdle, write ? (uint8_t *) &entry->RxOnWhenIdle : src, write, - &entryOffset, sizeof(entry->RxOnWhenIdle)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->FullThreadDevice, write ? (uint8_t *) &entry->FullThreadDevice : src, - write, &entryOffset, sizeof(entry->FullThreadDevice)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->FullNetworkData, write ? (uint8_t *) &entry->FullNetworkData : src, - write, &entryOffset, sizeof(entry->FullNetworkData)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->IsChild, write ? (uint8_t *) &entry->IsChild : src, write, - &entryOffset, sizeof(entry->IsChild)); // BOOLEAN + if (write) + { + size_t unusedLen; + _NeighborTable::ToEmberBuffer(entry, dest + entryOffset, 31, unusedLen); + } + else + { + _NeighborTable::FromEmberBuffer(entry, src + entryOffset, 31); + } break; } case 0x0008: // RouteTableList @@ -731,26 +1269,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _RouteTable _RouteTable * entry = reinterpret_cast<_RouteTable *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->ExtAddress, write ? (uint8_t *) &entry->ExtAddress : src, write, - &entryOffset, sizeof(entry->ExtAddress)); // INT64U - copyListMember(write ? dest : (uint8_t *) &entry->Rloc16, write ? (uint8_t *) &entry->Rloc16 : src, write, &entryOffset, - sizeof(entry->Rloc16)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->RouterId, write ? (uint8_t *) &entry->RouterId : src, write, - &entryOffset, sizeof(entry->RouterId)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->NextHop, write ? (uint8_t *) &entry->NextHop : src, write, - &entryOffset, sizeof(entry->NextHop)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->PathCost, write ? (uint8_t *) &entry->PathCost : src, write, - &entryOffset, sizeof(entry->PathCost)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->LQIIn, write ? (uint8_t *) &entry->LQIIn : src, write, &entryOffset, - sizeof(entry->LQIIn)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->LQIOut, write ? (uint8_t *) &entry->LQIOut : src, write, &entryOffset, - sizeof(entry->LQIOut)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->Age, write ? (uint8_t *) &entry->Age : src, write, &entryOffset, - sizeof(entry->Age)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->Allocated, write ? (uint8_t *) &entry->Allocated : src, write, - &entryOffset, sizeof(entry->Allocated)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->LinkEstablished, write ? (uint8_t *) &entry->LinkEstablished : src, - write, &entryOffset, sizeof(entry->LinkEstablished)); // BOOLEAN + if (write) + { + size_t unusedLen; + _RouteTable::ToEmberBuffer(entry, dest + entryOffset, 18, unusedLen); + } + else + { + _RouteTable::FromEmberBuffer(entry, src + entryOffset, 18); + } break; } case 0x003B: // SecurityPolicy @@ -764,10 +1291,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _SecurityPolicy _SecurityPolicy * entry = reinterpret_cast<_SecurityPolicy *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->RotationTime, write ? (uint8_t *) &entry->RotationTime : src, write, - &entryOffset, sizeof(entry->RotationTime)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->Flags, write ? (uint8_t *) &entry->Flags : src, write, &entryOffset, - sizeof(entry->Flags)); // INT8U + if (write) + { + size_t unusedLen; + _SecurityPolicy::ToEmberBuffer(entry, dest + entryOffset, 3, unusedLen); + } + else + { + _SecurityPolicy::FromEmberBuffer(entry, src + entryOffset, 3); + } break; } case 0x003D: // OperationalDatasetComponents @@ -781,37 +1313,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _OperationalDatasetComponents _OperationalDatasetComponents * entry = reinterpret_cast<_OperationalDatasetComponents *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->ActiveTimestampPresent, - write ? (uint8_t *) &entry->ActiveTimestampPresent : src, write, &entryOffset, - sizeof(entry->ActiveTimestampPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->PendingTimestampPresent, - write ? (uint8_t *) &entry->PendingTimestampPresent : src, write, &entryOffset, - sizeof(entry->PendingTimestampPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->MasterKeyPresent, write ? (uint8_t *) &entry->MasterKeyPresent : src, - write, &entryOffset, sizeof(entry->MasterKeyPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->NetworkNamePresent, - write ? (uint8_t *) &entry->NetworkNamePresent : src, write, &entryOffset, - sizeof(entry->NetworkNamePresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->ExtendedPanIdPresent, - write ? (uint8_t *) &entry->ExtendedPanIdPresent : src, write, &entryOffset, - sizeof(entry->ExtendedPanIdPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->MeshLocalPrefixPresent, - write ? (uint8_t *) &entry->MeshLocalPrefixPresent : src, write, &entryOffset, - sizeof(entry->MeshLocalPrefixPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->DelayPresent, write ? (uint8_t *) &entry->DelayPresent : src, write, - &entryOffset, sizeof(entry->DelayPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->PanIdPresent, write ? (uint8_t *) &entry->PanIdPresent : src, write, - &entryOffset, sizeof(entry->PanIdPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->ChannelPresent, write ? (uint8_t *) &entry->ChannelPresent : src, - write, &entryOffset, sizeof(entry->ChannelPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->PskcPresent, write ? (uint8_t *) &entry->PskcPresent : src, write, - &entryOffset, sizeof(entry->PskcPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->SecurityPolicyPresent, - write ? (uint8_t *) &entry->SecurityPolicyPresent : src, write, &entryOffset, - sizeof(entry->SecurityPolicyPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->ChannelMaskPresent, - write ? (uint8_t *) &entry->ChannelMaskPresent : src, write, &entryOffset, - sizeof(entry->ChannelMaskPresent)); // BOOLEAN + if (write) + { + size_t unusedLen; + _OperationalDatasetComponents::ToEmberBuffer(entry, dest + entryOffset, 12, unusedLen); + } + else + { + _OperationalDatasetComponents::FromEmberBuffer(entry, src + entryOffset, 12); + } break; } case 0x003E: // ActiveNetworkFaultsList diff --git a/zzz_generated/tv-app/zap-generated/CHIPClientCallbacks.cpp b/zzz_generated/tv-app/zap-generated/CHIPClientCallbacks.cpp index 55312721d0c01e..089a2ad0112c0a 100644 --- a/zzz_generated/tv-app/zap-generated/CHIPClientCallbacks.cpp +++ b/zzz_generated/tv-app/zap-generated/CHIPClientCallbacks.cpp @@ -30,6 +30,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -37,10 +40,6 @@ using namespace ::chip; using namespace ::chip::app::List; -namespace { -[[maybe_unused]] constexpr uint16_t kByteSpanSizeLengthInBytes = 2; -} // namespace - #define CHECK_STATUS_WITH_RETVAL(error, retval) \ if (CHIP_NO_ERROR != error) \ { \ @@ -355,105 +354,139 @@ void GeneralCommissioningClusterBasicCommissioningInfoListListAttributeFilter(TL Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { - // TODO: Add actual support for array and lists. - const uint8_t * message = nullptr; - uint16_t messageLen = 0; - EmberAfStatus res = PrepareListFromTLV(tlvData, message, messageLen); - if (res != EMBER_ZCL_STATUS_SUCCESS) + CHIP_ERROR err = CHIP_NO_ERROR; + size_t count = 0; + TLV::TLVType tmpType; + TLV::TLVReader reader; + + if (tlvData != nullptr && tlvData->GetType() == chip::TLV::TLVType::kTLVType_Array) + { + reader.Init(*tlvData); + reader.EnterContainer(tmpType); + } + if (tlvData == nullptr || tlvData->GetType() != chip::TLV::TLVType::kTLVType_Array || + chip::TLV::Utilities::Count(reader, count, false /* recursive */) != CHIP_NO_ERROR || !chip::CanCastTo(count)) { Callback::Callback * cb = Callback::Callback::FromCancelable(onFailureCallback); - cb->mCall(cb->mContext, res); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); return; } - - CHECK_MESSAGE_LENGTH_VOID(2); - uint16_t count = Encoding::LittleEndian::Read16(message); _BasicCommissioningInfoType data[count]; - for (size_t i = 0; i < count; i++) + for (size_t i = 0; i < count && CHIP_NO_ERROR == (err = reader.Next()); i++) { - CHECK_MESSAGE_LENGTH_VOID(4); - data[i].FailSafeExpiryLengthMs = emberAfGetInt32u(message, 0, 4); - message += 4; + SuccessOrExit(reader.Get(data[i])); + } + SuccessOrExit(err); + // If we have exactly count elements, we should not see any errors above, but should meet an error exactly after we iterated all + // elements. + VerifyOrExit(reader.Next() == CHIP_END_OF_TLV, err = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT); +exit: + if (CHIP_NO_ERROR == err) + { + Callback::Callback * cb = + Callback::Callback::FromCancelable( + onSuccessCallback); + cb->mCall(cb->mContext, static_cast(count), data); + } + else + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); } - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, count, data); } - void OperationalCredentialsClusterFabricsListListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { - // TODO: Add actual support for array and lists. - const uint8_t * message = nullptr; - uint16_t messageLen = 0; - EmberAfStatus res = PrepareListFromTLV(tlvData, message, messageLen); - if (res != EMBER_ZCL_STATUS_SUCCESS) + CHIP_ERROR err = CHIP_NO_ERROR; + size_t count = 0; + TLV::TLVType tmpType; + TLV::TLVReader reader; + + if (tlvData != nullptr && tlvData->GetType() == chip::TLV::TLVType::kTLVType_Array) + { + reader.Init(*tlvData); + reader.EnterContainer(tmpType); + } + if (tlvData == nullptr || tlvData->GetType() != chip::TLV::TLVType::kTLVType_Array || + chip::TLV::Utilities::Count(reader, count, false /* recursive */) != CHIP_NO_ERROR || !chip::CanCastTo(count)) { Callback::Callback * cb = Callback::Callback::FromCancelable(onFailureCallback); - cb->mCall(cb->mContext, res); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); return; } - - CHECK_MESSAGE_LENGTH_VOID(2); - uint16_t count = Encoding::LittleEndian::Read16(message); _FabricDescriptor data[count]; - for (size_t i = 0; i < count; i++) + for (size_t i = 0; i < count && CHIP_NO_ERROR == (err = reader.Next()); i++) { - CHECK_MESSAGE_LENGTH_VOID(1); - data[i].FabricIndex = emberAfGetInt8u(message, 0, 1); - message += 1; - CHECK_STATUS_VOID(ReadByteSpan(message, 67, &data[i].RootPublicKey)); - messageLen = static_cast(messageLen - 67); - message += 67; - CHECK_MESSAGE_LENGTH_VOID(2); - data[i].VendorId = emberAfGetInt16u(message, 0, 2); - message += 2; - CHECK_MESSAGE_LENGTH_VOID(8); - data[i].FabricId = emberAfGetInt64u(message, 0, 8); - message += 8; - CHECK_MESSAGE_LENGTH_VOID(8); - data[i].NodeId = emberAfGetInt64u(message, 0, 8); - message += 8; - CHECK_STATUS_VOID(ReadByteSpan(message, 34, &data[i].Label)); - messageLen = static_cast(messageLen - 34); - message += 34; + SuccessOrExit(reader.Get(data[i])); + } + SuccessOrExit(err); + // If we have exactly count elements, we should not see any errors above, but should meet an error exactly after we iterated all + // elements. + VerifyOrExit(reader.Next() == CHIP_END_OF_TLV, err = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT); +exit: + if (CHIP_NO_ERROR == err) + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, static_cast(count), data); + } + else + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); } - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, count, data); } - void OperationalCredentialsClusterTrustedRootCertificatesListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { - // TODO: Add actual support for array and lists. - const uint8_t * message = nullptr; - uint16_t messageLen = 0; - EmberAfStatus res = PrepareListFromTLV(tlvData, message, messageLen); - if (res != EMBER_ZCL_STATUS_SUCCESS) + CHIP_ERROR err = CHIP_NO_ERROR; + size_t count = 0; + TLV::TLVType tmpType; + TLV::TLVReader reader; + + if (tlvData != nullptr && tlvData->GetType() == chip::TLV::TLVType::kTLVType_Array) + { + reader.Init(*tlvData); + reader.EnterContainer(tmpType); + } + if (tlvData == nullptr || tlvData->GetType() != chip::TLV::TLVType::kTLVType_Array || + chip::TLV::Utilities::Count(reader, count, false /* recursive */) != CHIP_NO_ERROR || !chip::CanCastTo(count)) { Callback::Callback * cb = Callback::Callback::FromCancelable(onFailureCallback); - cb->mCall(cb->mContext, res); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); return; } - - CHECK_MESSAGE_LENGTH_VOID(2); - uint16_t count = Encoding::LittleEndian::Read16(message); chip::ByteSpan data[count]; - for (size_t i = 0; i < count; i++) + for (size_t i = 0; i < count && CHIP_NO_ERROR == (err = reader.Next()); i++) + { + const uint8_t * dataPtr = nullptr; + SuccessOrExit(reader.GetDataPtr(dataPtr)); + data[i] = chip::ByteSpan(dataPtr, reader.GetLength()); + } + SuccessOrExit(err); + // If we have exactly count elements, we should not see any errors above, but should meet an error exactly after we iterated all + // elements. + VerifyOrExit(reader.Next() == CHIP_END_OF_TLV, err = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT); +exit: + if (CHIP_NO_ERROR == err) { - CHECK_STATUS_VOID(ReadByteSpan(message, messageLen, &data[i])); - uint16_t entryLength = static_cast(data[i].size() + kByteSpanSizeLengthInBytes); - messageLen = static_cast(messageLen - entryLength); - message += entryLength; + Callback::Callback * cb = + Callback::Callback::FromCancelable( + onSuccessCallback); + cb->mCall(cb->mContext, static_cast(count), data); + } + else + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, EMBER_ZCL_STATUS_INVALID_VALUE); } - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, count, data); } bool emberAfGeneralCommissioningClusterArmFailSafeResponseCallback(EndpointId endpoint, app::CommandSender * commandObj, diff --git a/zzz_generated/tv-app/zap-generated/attribute-size.cpp b/zzz_generated/tv-app/zap-generated/attribute-size.cpp index 2c7d90fdc285df..8af903f8a95f88 100644 --- a/zzz_generated/tv-app/zap-generated/attribute-size.cpp +++ b/zzz_generated/tv-app/zap-generated/attribute-size.cpp @@ -21,10 +21,13 @@ #include #include #include +#include +#include #include #include using namespace chip; +using namespace chip::app; using namespace chip::app::List; // The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid @@ -45,6 +48,530 @@ void copyListMember(uint8_t * dest, uint8_t * src, bool write, uint16_t * offset *offset = static_cast(*offset + length); } +CHIP_ERROR CopyStructAttributeToCHIPTLV(ClusterId clusterId, AttributeId attributeId, uint8_t * src, uint16_t len, + TLV::TLVWriter & writer, uint64_t tag) +{ + switch (clusterId) + { + } + return CHIP_ERROR_INVALID_ARGUMENT; +} + +CHIP_ERROR EmberListToCHIPTLV(ClusterId clusterId, AttributeId attributeId, uint8_t * src, uint16_t len, TLV::TLVWriter & writer, + uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + size_t count = *reinterpret_cast(src); + uint16_t entryLength = 0; + // Suppress error of unused variable. + (void) entryLength; + (void) count; + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Array, tmpType)); + switch (clusterId) + { + case 0x050C: // Application Launcher Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // application launcher list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 2; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + uint16_t entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // INT16U + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + } + break; + } + case 0x050B: // Audio Output Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // audio output list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 36; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _AudioOutputInfo + _AudioOutputInfo entry; + SuccessOrExit(err = _AudioOutputInfo::FromEmberBuffer(&entry, src + entryOffset, 36)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x050A: // Content Launcher Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // accepts header list + { + for (size_t index = 0; index < count; index++) + { + entryOffset = GetByteSpanOffsetFromIndex(src, len, static_cast(index)); + if (entryOffset == 0) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + + chip::ByteSpan acceptsHeaderListSpan; // OCTET_STRING + uint16_t acceptsHeaderListRemainingSpace = static_cast(len - entryOffset); + if (CHIP_NO_ERROR != ReadByteSpan(src + entryOffset, acceptsHeaderListRemainingSpace, &acceptsHeaderListSpan)) + { + ChipLogError(Zcl, "Index %zu is invalid. Not enough remaining space", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + writer.Put(TLV::AnonymousTag, acceptsHeaderListSpan); + } + break; + } + case 0x0001: // supported streaming types + { + for (size_t index = 0; index < count; index++) + { + entryLength = 1; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + uint8_t entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, + entryLength); // ContentLaunchStreamingType + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + } + break; + } + case 0x001D: // Descriptor Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // device list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 6; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _DeviceType + _DeviceType entry; + SuccessOrExit(err = _DeviceType::FromEmberBuffer(&entry, src + entryOffset, 6)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x0001: // server list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 4; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + chip::ClusterId entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // CLUSTER_ID + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + case 0x0002: // client list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 4; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + chip::ClusterId entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // CLUSTER_ID + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + case 0x0003: // parts list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 2; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + chip::EndpointId entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // ENDPOINT_NO + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + } + break; + } + case 0x0030: // General Commissioning Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0001: // BasicCommissioningInfoList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 4; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _BasicCommissioningInfoType + _BasicCommissioningInfoType entry; + SuccessOrExit(err = _BasicCommissioningInfoType::FromEmberBuffer(&entry, src + entryOffset, 4)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x0033: // General Diagnostics Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // NetworkInterfaces + { + for (size_t index = 0; index < count; index++) + { + entryLength = 48; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _NetworkInterfaceType + _NetworkInterfaceType entry; + SuccessOrExit(err = _NetworkInterfaceType::FromEmberBuffer(&entry, src + entryOffset, 48)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0xF004: // Group Key Management Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // groups + { + for (size_t index = 0; index < count; index++) + { + entryLength = 6; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _GroupState + _GroupState entry; + SuccessOrExit(err = _GroupState::FromEmberBuffer(&entry, src + entryOffset, 6)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x0001: // group keys + { + for (size_t index = 0; index < count; index++) + { + entryLength = 31; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _GroupKey + _GroupKey entry; + SuccessOrExit(err = _GroupKey::FromEmberBuffer(&entry, src + entryOffset, 31)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x0507: // Media Input Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // media input list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 70; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _MediaInputInfo + _MediaInputInfo entry; + SuccessOrExit(err = _MediaInputInfo::FromEmberBuffer(&entry, src + entryOffset, 70)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x003E: // Operational Credentials Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0001: // fabrics list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 120; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _FabricDescriptor + _FabricDescriptor entry; + SuccessOrExit(err = _FabricDescriptor::FromEmberBuffer(&entry, src + entryOffset, 120)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x0004: // TrustedRootCertificates + { + for (size_t index = 0; index < count; index++) + { + entryOffset = GetByteSpanOffsetFromIndex(src, len, static_cast(index)); + if (entryOffset == 0) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + + chip::ByteSpan trustedRootCertificatesSpan; // OCTET_STRING + uint16_t trustedRootCertificatesRemainingSpace = static_cast(len - entryOffset); + if (CHIP_NO_ERROR != + ReadByteSpan(src + entryOffset, trustedRootCertificatesRemainingSpace, &trustedRootCertificatesSpan)) + { + ChipLogError(Zcl, "Index %zu is invalid. Not enough remaining space", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + writer.Put(TLV::AnonymousTag, trustedRootCertificatesSpan); + } + break; + } + } + break; + } + case 0x0504: // TV Channel Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // tv channel list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 106; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _TvChannelInfo + _TvChannelInfo entry; + SuccessOrExit(err = _TvChannelInfo::FromEmberBuffer(&entry, src + entryOffset, 106)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x0505: // Target Navigator Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // target navigator list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 35; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _NavigateTargetTargetInfo + _NavigateTargetTargetInfo entry; + SuccessOrExit(err = _NavigateTargetTargetInfo::FromEmberBuffer(&entry, src + entryOffset, 35)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x0035: // Thread Network Diagnostics Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0007: // NeighborTableList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 31; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _NeighborTable + _NeighborTable entry; + SuccessOrExit(err = _NeighborTable::FromEmberBuffer(&entry, src + entryOffset, 31)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x0008: // RouteTableList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 18; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _RouteTable + _RouteTable entry; + SuccessOrExit(err = _RouteTable::FromEmberBuffer(&entry, src + entryOffset, 18)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x003B: // SecurityPolicy + { + for (size_t index = 0; index < count; index++) + { + entryLength = 3; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _SecurityPolicy + _SecurityPolicy entry; + SuccessOrExit(err = _SecurityPolicy::FromEmberBuffer(&entry, src + entryOffset, 3)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x003D: // OperationalDatasetComponents + { + for (size_t index = 0; index < count; index++) + { + entryLength = 12; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _OperationalDatasetComponents + _OperationalDatasetComponents entry; + SuccessOrExit(err = _OperationalDatasetComponents::FromEmberBuffer(&entry, src + entryOffset, 12)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x003E: // ActiveNetworkFaultsList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 1; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + uint8_t entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // NetworkFault + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + } + break; + } + } +exit: + err = writer.EndContainer(tmpType); + return err; +} + uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, bool write, uint8_t * dest, uint8_t * src, int32_t index) { @@ -80,8 +607,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo { case 0x050C: // Application Launcher Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // application launcher list { @@ -100,8 +628,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x050B: // Audio Output Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // audio output list { @@ -114,18 +643,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _AudioOutputInfo _AudioOutputInfo * entry = reinterpret_cast<_AudioOutputInfo *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->index, write ? (uint8_t *) &entry->index : src, write, &entryOffset, - sizeof(entry->index)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->outputType, write ? (uint8_t *) &entry->outputType : src, write, - &entryOffset, sizeof(entry->outputType)); // AudioOutputType - ByteSpan * nameSpan = &entry->name; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _AudioOutputInfo::ToEmberBuffer(entry, dest + entryOffset, 36, unusedLen); + } + else + { + _AudioOutputInfo::FromEmberBuffer(entry, src + entryOffset, 36); } - entryOffset = static_cast(entryOffset + 34); break; } } @@ -133,8 +659,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x050A: // Content Launcher Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // accepts header list { @@ -180,8 +707,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x001D: // Descriptor Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // device list { @@ -194,10 +722,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _DeviceType _DeviceType * entry = reinterpret_cast<_DeviceType *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->type, write ? (uint8_t *) &entry->type : src, write, &entryOffset, - sizeof(entry->type)); // DEVTYPE_ID - copyListMember(write ? dest : (uint8_t *) &entry->revision, write ? (uint8_t *) &entry->revision : src, write, - &entryOffset, sizeof(entry->revision)); // INT16U + if (write) + { + size_t unusedLen; + _DeviceType::ToEmberBuffer(entry, dest + entryOffset, 6, unusedLen); + } + else + { + _DeviceType::FromEmberBuffer(entry, src + entryOffset, 6); + } break; } case 0x0001: // server list @@ -241,8 +774,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0030: // General Commissioning Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0001: // BasicCommissioningInfoList { @@ -255,9 +789,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _BasicCommissioningInfoType _BasicCommissioningInfoType * entry = reinterpret_cast<_BasicCommissioningInfoType *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->FailSafeExpiryLengthMs, - write ? (uint8_t *) &entry->FailSafeExpiryLengthMs : src, write, &entryOffset, - sizeof(entry->FailSafeExpiryLengthMs)); // INT32U + if (write) + { + size_t unusedLen; + _BasicCommissioningInfoType::ToEmberBuffer(entry, dest + entryOffset, 4, unusedLen); + } + else + { + _BasicCommissioningInfoType::FromEmberBuffer(entry, src + entryOffset, 4); + } break; } } @@ -265,8 +805,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0033: // General Diagnostics Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // NetworkInterfaces { @@ -279,33 +820,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NetworkInterfaceType _NetworkInterfaceType * entry = reinterpret_cast<_NetworkInterfaceType *>(write ? src : dest); - ByteSpan * NameSpan = &entry->Name; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, NameSpan) : ReadByteSpan(src + entryOffset, 34, NameSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _NetworkInterfaceType::ToEmberBuffer(entry, dest + entryOffset, 48, unusedLen); } - entryOffset = static_cast(entryOffset + 34); - copyListMember(write ? dest : (uint8_t *) &entry->FabricConnected, write ? (uint8_t *) &entry->FabricConnected : src, - write, &entryOffset, sizeof(entry->FabricConnected)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->OffPremiseServicesReachableIPv4, - write ? (uint8_t *) &entry->OffPremiseServicesReachableIPv4 : src, write, &entryOffset, - sizeof(entry->OffPremiseServicesReachableIPv4)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->OffPremiseServicesReachableIPv6, - write ? (uint8_t *) &entry->OffPremiseServicesReachableIPv6 : src, write, &entryOffset, - sizeof(entry->OffPremiseServicesReachableIPv6)); // BOOLEAN - ByteSpan * HardwareAddressSpan = &entry->HardwareAddress; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 10, HardwareAddressSpan) - : ReadByteSpan(src + entryOffset, 10, HardwareAddressSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _NetworkInterfaceType::FromEmberBuffer(entry, src + entryOffset, 48); } - entryOffset = static_cast(entryOffset + 10); - copyListMember(write ? dest : (uint8_t *) &entry->Type, write ? (uint8_t *) &entry->Type : src, write, &entryOffset, - sizeof(entry->Type)); // ENUM8 break; } } @@ -313,8 +836,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0xF004: // Group Key Management Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // groups { @@ -327,12 +851,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _GroupState _GroupState * entry = reinterpret_cast<_GroupState *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->VendorId, write ? (uint8_t *) &entry->VendorId : src, write, - &entryOffset, sizeof(entry->VendorId)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->VendorGroupId, write ? (uint8_t *) &entry->VendorGroupId : src, write, - &entryOffset, sizeof(entry->VendorGroupId)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->GroupKeySetIndex, write ? (uint8_t *) &entry->GroupKeySetIndex : src, - write, &entryOffset, sizeof(entry->GroupKeySetIndex)); // INT16U + if (write) + { + size_t unusedLen; + _GroupState::ToEmberBuffer(entry, dest + entryOffset, 6, unusedLen); + } + else + { + _GroupState::FromEmberBuffer(entry, src + entryOffset, 6); + } break; } case 0x0001: // group keys @@ -346,25 +873,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _GroupKey _GroupKey * entry = reinterpret_cast<_GroupKey *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->VendorId, write ? (uint8_t *) &entry->VendorId : src, write, - &entryOffset, sizeof(entry->VendorId)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->GroupKeyIndex, write ? (uint8_t *) &entry->GroupKeyIndex : src, write, - &entryOffset, sizeof(entry->GroupKeyIndex)); // INT16U - ByteSpan * GroupKeyRootSpan = &entry->GroupKeyRoot; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 18, GroupKeyRootSpan) - : ReadByteSpan(src + entryOffset, 18, GroupKeyRootSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _GroupKey::ToEmberBuffer(entry, dest + entryOffset, 31, unusedLen); + } + else + { + _GroupKey::FromEmberBuffer(entry, src + entryOffset, 31); } - entryOffset = static_cast(entryOffset + 18); - copyListMember(write ? dest : (uint8_t *) &entry->GroupKeyEpochStartTime, - write ? (uint8_t *) &entry->GroupKeyEpochStartTime : src, write, &entryOffset, - sizeof(entry->GroupKeyEpochStartTime)); // INT64U - copyListMember(write ? dest : (uint8_t *) &entry->GroupKeySecurityPolicy, - write ? (uint8_t *) &entry->GroupKeySecurityPolicy : src, write, &entryOffset, - sizeof(entry->GroupKeySecurityPolicy)); // GroupKeySecurityPolicy break; } } @@ -372,8 +889,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0507: // Media Input Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // media input list { @@ -386,27 +904,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _MediaInputInfo _MediaInputInfo * entry = reinterpret_cast<_MediaInputInfo *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->index, write ? (uint8_t *) &entry->index : src, write, &entryOffset, - sizeof(entry->index)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->inputType, write ? (uint8_t *) &entry->inputType : src, write, - &entryOffset, sizeof(entry->inputType)); // MediaInputType - ByteSpan * nameSpan = &entry->name; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _MediaInputInfo::ToEmberBuffer(entry, dest + entryOffset, 70, unusedLen); } - entryOffset = static_cast(entryOffset + 34); - ByteSpan * descriptionSpan = &entry->description; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, descriptionSpan) - : ReadByteSpan(src + entryOffset, 34, descriptionSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _MediaInputInfo::FromEmberBuffer(entry, src + entryOffset, 70); } - entryOffset = static_cast(entryOffset + 34); break; } } @@ -414,8 +920,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x003E: // Operational Credentials Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0001: // fabrics list { @@ -428,31 +935,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _FabricDescriptor _FabricDescriptor * entry = reinterpret_cast<_FabricDescriptor *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->FabricIndex, write ? (uint8_t *) &entry->FabricIndex : src, write, - &entryOffset, sizeof(entry->FabricIndex)); // INT8U - ByteSpan * RootPublicKeySpan = &entry->RootPublicKey; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 67, RootPublicKeySpan) - : ReadByteSpan(src + entryOffset, 67, RootPublicKeySpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _FabricDescriptor::ToEmberBuffer(entry, dest + entryOffset, 120, unusedLen); } - entryOffset = static_cast(entryOffset + 67); - copyListMember(write ? dest : (uint8_t *) &entry->VendorId, write ? (uint8_t *) &entry->VendorId : src, write, - &entryOffset, sizeof(entry->VendorId)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->FabricId, write ? (uint8_t *) &entry->FabricId : src, write, - &entryOffset, sizeof(entry->FabricId)); // FABRIC_ID - copyListMember(write ? dest : (uint8_t *) &entry->NodeId, write ? (uint8_t *) &entry->NodeId : src, write, &entryOffset, - sizeof(entry->NodeId)); // NODE_ID - ByteSpan * LabelSpan = &entry->Label; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, LabelSpan) : ReadByteSpan(src + entryOffset, 34, LabelSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _FabricDescriptor::FromEmberBuffer(entry, src + entryOffset, 120); } - entryOffset = static_cast(entryOffset + 34); break; } case 0x0004: // TrustedRootCertificates @@ -487,8 +978,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0504: // TV Channel Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // tv channel list { @@ -501,35 +993,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _TvChannelInfo _TvChannelInfo * entry = reinterpret_cast<_TvChannelInfo *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->majorNumber, write ? (uint8_t *) &entry->majorNumber : src, write, - &entryOffset, sizeof(entry->majorNumber)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->minorNumber, write ? (uint8_t *) &entry->minorNumber : src, write, - &entryOffset, sizeof(entry->minorNumber)); // INT16U - ByteSpan * nameSpan = &entry->name; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _TvChannelInfo::ToEmberBuffer(entry, dest + entryOffset, 106, unusedLen); } - entryOffset = static_cast(entryOffset + 34); - ByteSpan * callSignSpan = &entry->callSign; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, callSignSpan) : ReadByteSpan(src + entryOffset, 34, callSignSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; - } - entryOffset = static_cast(entryOffset + 34); - ByteSpan * affiliateCallSignSpan = &entry->affiliateCallSign; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, affiliateCallSignSpan) - : ReadByteSpan(src + entryOffset, 34, affiliateCallSignSpan))) - { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _TvChannelInfo::FromEmberBuffer(entry, src + entryOffset, 106); } - entryOffset = static_cast(entryOffset + 34); break; } } @@ -537,8 +1009,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0505: // Target Navigator Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // target navigator list { @@ -551,16 +1024,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NavigateTargetTargetInfo _NavigateTargetTargetInfo * entry = reinterpret_cast<_NavigateTargetTargetInfo *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->identifier, write ? (uint8_t *) &entry->identifier : src, write, - &entryOffset, sizeof(entry->identifier)); // INT8U - ByteSpan * nameSpan = &entry->name; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _NavigateTargetTargetInfo::ToEmberBuffer(entry, dest + entryOffset, 35, unusedLen); + } + else + { + _NavigateTargetTargetInfo::FromEmberBuffer(entry, src + entryOffset, 35); } - entryOffset = static_cast(entryOffset + 34); break; } } @@ -568,8 +1040,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0035: // Thread Network Diagnostics Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0007: // NeighborTableList { @@ -582,34 +1055,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NeighborTable _NeighborTable * entry = reinterpret_cast<_NeighborTable *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->ExtAddress, write ? (uint8_t *) &entry->ExtAddress : src, write, - &entryOffset, sizeof(entry->ExtAddress)); // INT64U - copyListMember(write ? dest : (uint8_t *) &entry->Age, write ? (uint8_t *) &entry->Age : src, write, &entryOffset, - sizeof(entry->Age)); // INT32U - copyListMember(write ? dest : (uint8_t *) &entry->Rloc16, write ? (uint8_t *) &entry->Rloc16 : src, write, &entryOffset, - sizeof(entry->Rloc16)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->LinkFrameCounter, write ? (uint8_t *) &entry->LinkFrameCounter : src, - write, &entryOffset, sizeof(entry->LinkFrameCounter)); // INT32U - copyListMember(write ? dest : (uint8_t *) &entry->MleFrameCounter, write ? (uint8_t *) &entry->MleFrameCounter : src, - write, &entryOffset, sizeof(entry->MleFrameCounter)); // INT32U - copyListMember(write ? dest : (uint8_t *) &entry->LQI, write ? (uint8_t *) &entry->LQI : src, write, &entryOffset, - sizeof(entry->LQI)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->AverageRssi, write ? (uint8_t *) &entry->AverageRssi : src, write, - &entryOffset, sizeof(entry->AverageRssi)); // INT8S - copyListMember(write ? dest : (uint8_t *) &entry->LastRssi, write ? (uint8_t *) &entry->LastRssi : src, write, - &entryOffset, sizeof(entry->LastRssi)); // INT8S - copyListMember(write ? dest : (uint8_t *) &entry->FrameErrorRate, write ? (uint8_t *) &entry->FrameErrorRate : src, - write, &entryOffset, sizeof(entry->FrameErrorRate)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->MessageErrorRate, write ? (uint8_t *) &entry->MessageErrorRate : src, - write, &entryOffset, sizeof(entry->MessageErrorRate)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->RxOnWhenIdle, write ? (uint8_t *) &entry->RxOnWhenIdle : src, write, - &entryOffset, sizeof(entry->RxOnWhenIdle)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->FullThreadDevice, write ? (uint8_t *) &entry->FullThreadDevice : src, - write, &entryOffset, sizeof(entry->FullThreadDevice)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->FullNetworkData, write ? (uint8_t *) &entry->FullNetworkData : src, - write, &entryOffset, sizeof(entry->FullNetworkData)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->IsChild, write ? (uint8_t *) &entry->IsChild : src, write, - &entryOffset, sizeof(entry->IsChild)); // BOOLEAN + if (write) + { + size_t unusedLen; + _NeighborTable::ToEmberBuffer(entry, dest + entryOffset, 31, unusedLen); + } + else + { + _NeighborTable::FromEmberBuffer(entry, src + entryOffset, 31); + } break; } case 0x0008: // RouteTableList @@ -623,26 +1077,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _RouteTable _RouteTable * entry = reinterpret_cast<_RouteTable *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->ExtAddress, write ? (uint8_t *) &entry->ExtAddress : src, write, - &entryOffset, sizeof(entry->ExtAddress)); // INT64U - copyListMember(write ? dest : (uint8_t *) &entry->Rloc16, write ? (uint8_t *) &entry->Rloc16 : src, write, &entryOffset, - sizeof(entry->Rloc16)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->RouterId, write ? (uint8_t *) &entry->RouterId : src, write, - &entryOffset, sizeof(entry->RouterId)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->NextHop, write ? (uint8_t *) &entry->NextHop : src, write, - &entryOffset, sizeof(entry->NextHop)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->PathCost, write ? (uint8_t *) &entry->PathCost : src, write, - &entryOffset, sizeof(entry->PathCost)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->LQIIn, write ? (uint8_t *) &entry->LQIIn : src, write, &entryOffset, - sizeof(entry->LQIIn)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->LQIOut, write ? (uint8_t *) &entry->LQIOut : src, write, &entryOffset, - sizeof(entry->LQIOut)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->Age, write ? (uint8_t *) &entry->Age : src, write, &entryOffset, - sizeof(entry->Age)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->Allocated, write ? (uint8_t *) &entry->Allocated : src, write, - &entryOffset, sizeof(entry->Allocated)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->LinkEstablished, write ? (uint8_t *) &entry->LinkEstablished : src, - write, &entryOffset, sizeof(entry->LinkEstablished)); // BOOLEAN + if (write) + { + size_t unusedLen; + _RouteTable::ToEmberBuffer(entry, dest + entryOffset, 18, unusedLen); + } + else + { + _RouteTable::FromEmberBuffer(entry, src + entryOffset, 18); + } break; } case 0x003B: // SecurityPolicy @@ -656,10 +1099,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _SecurityPolicy _SecurityPolicy * entry = reinterpret_cast<_SecurityPolicy *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->RotationTime, write ? (uint8_t *) &entry->RotationTime : src, write, - &entryOffset, sizeof(entry->RotationTime)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->Flags, write ? (uint8_t *) &entry->Flags : src, write, &entryOffset, - sizeof(entry->Flags)); // INT8U + if (write) + { + size_t unusedLen; + _SecurityPolicy::ToEmberBuffer(entry, dest + entryOffset, 3, unusedLen); + } + else + { + _SecurityPolicy::FromEmberBuffer(entry, src + entryOffset, 3); + } break; } case 0x003D: // OperationalDatasetComponents @@ -673,37 +1121,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _OperationalDatasetComponents _OperationalDatasetComponents * entry = reinterpret_cast<_OperationalDatasetComponents *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->ActiveTimestampPresent, - write ? (uint8_t *) &entry->ActiveTimestampPresent : src, write, &entryOffset, - sizeof(entry->ActiveTimestampPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->PendingTimestampPresent, - write ? (uint8_t *) &entry->PendingTimestampPresent : src, write, &entryOffset, - sizeof(entry->PendingTimestampPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->MasterKeyPresent, write ? (uint8_t *) &entry->MasterKeyPresent : src, - write, &entryOffset, sizeof(entry->MasterKeyPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->NetworkNamePresent, - write ? (uint8_t *) &entry->NetworkNamePresent : src, write, &entryOffset, - sizeof(entry->NetworkNamePresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->ExtendedPanIdPresent, - write ? (uint8_t *) &entry->ExtendedPanIdPresent : src, write, &entryOffset, - sizeof(entry->ExtendedPanIdPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->MeshLocalPrefixPresent, - write ? (uint8_t *) &entry->MeshLocalPrefixPresent : src, write, &entryOffset, - sizeof(entry->MeshLocalPrefixPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->DelayPresent, write ? (uint8_t *) &entry->DelayPresent : src, write, - &entryOffset, sizeof(entry->DelayPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->PanIdPresent, write ? (uint8_t *) &entry->PanIdPresent : src, write, - &entryOffset, sizeof(entry->PanIdPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->ChannelPresent, write ? (uint8_t *) &entry->ChannelPresent : src, - write, &entryOffset, sizeof(entry->ChannelPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->PskcPresent, write ? (uint8_t *) &entry->PskcPresent : src, write, - &entryOffset, sizeof(entry->PskcPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->SecurityPolicyPresent, - write ? (uint8_t *) &entry->SecurityPolicyPresent : src, write, &entryOffset, - sizeof(entry->SecurityPolicyPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->ChannelMaskPresent, - write ? (uint8_t *) &entry->ChannelMaskPresent : src, write, &entryOffset, - sizeof(entry->ChannelMaskPresent)); // BOOLEAN + if (write) + { + size_t unusedLen; + _OperationalDatasetComponents::ToEmberBuffer(entry, dest + entryOffset, 12, unusedLen); + } + else + { + _OperationalDatasetComponents::FromEmberBuffer(entry, src + entryOffset, 12); + } break; } case 0x003E: // ActiveNetworkFaultsList diff --git a/zzz_generated/tv-casting-app/zap-generated/attribute-size.cpp b/zzz_generated/tv-casting-app/zap-generated/attribute-size.cpp index 8bfb2c6064b510..7d30db28fe09a5 100644 --- a/zzz_generated/tv-casting-app/zap-generated/attribute-size.cpp +++ b/zzz_generated/tv-casting-app/zap-generated/attribute-size.cpp @@ -21,10 +21,13 @@ #include #include #include +#include +#include #include #include using namespace chip; +using namespace chip::app; using namespace chip::app::List; // The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid @@ -45,6 +48,598 @@ void copyListMember(uint8_t * dest, uint8_t * src, bool write, uint16_t * offset *offset = static_cast(*offset + length); } +CHIP_ERROR CopyStructAttributeToCHIPTLV(ClusterId clusterId, AttributeId attributeId, uint8_t * src, uint16_t len, + TLV::TLVWriter & writer, uint64_t tag) +{ + switch (clusterId) + { + } + return CHIP_ERROR_INVALID_ARGUMENT; +} + +CHIP_ERROR EmberListToCHIPTLV(ClusterId clusterId, AttributeId attributeId, uint8_t * src, uint16_t len, TLV::TLVWriter & writer, + uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + size_t count = *reinterpret_cast(src); + uint16_t entryLength = 0; + // Suppress error of unused variable. + (void) entryLength; + (void) count; + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Array, tmpType)); + switch (clusterId) + { + case 0x050C: // Application Launcher Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // application launcher list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 2; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + uint16_t entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // INT16U + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + } + break; + } + case 0x050B: // Audio Output Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // audio output list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 36; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _AudioOutputInfo + _AudioOutputInfo entry; + SuccessOrExit(err = _AudioOutputInfo::FromEmberBuffer(&entry, src + entryOffset, 36)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x050A: // Content Launcher Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // accepts header list + { + for (size_t index = 0; index < count; index++) + { + entryOffset = GetByteSpanOffsetFromIndex(src, len, static_cast(index)); + if (entryOffset == 0) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + + chip::ByteSpan acceptsHeaderListSpan; // OCTET_STRING + uint16_t acceptsHeaderListRemainingSpace = static_cast(len - entryOffset); + if (CHIP_NO_ERROR != ReadByteSpan(src + entryOffset, acceptsHeaderListRemainingSpace, &acceptsHeaderListSpan)) + { + ChipLogError(Zcl, "Index %zu is invalid. Not enough remaining space", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + writer.Put(TLV::AnonymousTag, acceptsHeaderListSpan); + } + break; + } + case 0x0001: // supported streaming types + { + for (size_t index = 0; index < count; index++) + { + entryLength = 1; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + uint8_t entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, + entryLength); // ContentLaunchStreamingType + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + } + break; + } + case 0x001D: // Descriptor Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // device list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 6; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _DeviceType + _DeviceType entry; + SuccessOrExit(err = _DeviceType::FromEmberBuffer(&entry, src + entryOffset, 6)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x0001: // server list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 4; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + chip::ClusterId entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // CLUSTER_ID + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + case 0x0002: // client list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 4; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + chip::ClusterId entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // CLUSTER_ID + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + case 0x0003: // parts list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 2; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + chip::EndpointId entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // ENDPOINT_NO + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + } + break; + } + case 0x0040: // Fixed Label Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // label list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 36; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _LabelStruct + _LabelStruct entry; + SuccessOrExit(err = _LabelStruct::FromEmberBuffer(&entry, src + entryOffset, 36)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x0030: // General Commissioning Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0001: // BasicCommissioningInfoList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 4; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _BasicCommissioningInfoType + _BasicCommissioningInfoType entry; + SuccessOrExit(err = _BasicCommissioningInfoType::FromEmberBuffer(&entry, src + entryOffset, 4)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x0033: // General Diagnostics Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // NetworkInterfaces + { + for (size_t index = 0; index < count; index++) + { + entryLength = 48; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _NetworkInterfaceType + _NetworkInterfaceType entry; + SuccessOrExit(err = _NetworkInterfaceType::FromEmberBuffer(&entry, src + entryOffset, 48)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0xF004: // Group Key Management Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // groups + { + for (size_t index = 0; index < count; index++) + { + entryLength = 6; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _GroupState + _GroupState entry; + SuccessOrExit(err = _GroupState::FromEmberBuffer(&entry, src + entryOffset, 6)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x0001: // group keys + { + for (size_t index = 0; index < count; index++) + { + entryLength = 31; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _GroupKey + _GroupKey entry; + SuccessOrExit(err = _GroupKey::FromEmberBuffer(&entry, src + entryOffset, 31)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x0507: // Media Input Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // media input list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 70; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _MediaInputInfo + _MediaInputInfo entry; + SuccessOrExit(err = _MediaInputInfo::FromEmberBuffer(&entry, src + entryOffset, 70)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x003E: // Operational Credentials Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0001: // fabrics list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 120; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _FabricDescriptor + _FabricDescriptor entry; + SuccessOrExit(err = _FabricDescriptor::FromEmberBuffer(&entry, src + entryOffset, 120)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x0504: // TV Channel Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // tv channel list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 106; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _TvChannelInfo + _TvChannelInfo entry; + SuccessOrExit(err = _TvChannelInfo::FromEmberBuffer(&entry, src + entryOffset, 106)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x0505: // Target Navigator Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // target navigator list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 35; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _NavigateTargetTargetInfo + _NavigateTargetTargetInfo entry; + SuccessOrExit(err = _NavigateTargetTargetInfo::FromEmberBuffer(&entry, src + entryOffset, 35)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x050F: // Test Cluster Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x001A: // list_int8u + { + for (size_t index = 0; index < count; index++) + { + entryLength = 1; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + uint8_t entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // INT8U + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + case 0x001B: // list_octet_string + { + for (size_t index = 0; index < count; index++) + { + entryOffset = GetByteSpanOffsetFromIndex(src, len, static_cast(index)); + if (entryOffset == 0) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + + chip::ByteSpan listOctetStringSpan; // OCTET_STRING + uint16_t listOctetStringRemainingSpace = static_cast(len - entryOffset); + if (CHIP_NO_ERROR != ReadByteSpan(src + entryOffset, listOctetStringRemainingSpace, &listOctetStringSpan)) + { + ChipLogError(Zcl, "Index %zu is invalid. Not enough remaining space", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + writer.Put(TLV::AnonymousTag, listOctetStringSpan); + } + break; + } + case 0x001C: // list_struct_octet_string + { + for (size_t index = 0; index < count; index++) + { + entryLength = 42; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _TestListStructOctet + _TestListStructOctet entry; + SuccessOrExit(err = _TestListStructOctet::FromEmberBuffer(&entry, src + entryOffset, 42)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x0035: // Thread Network Diagnostics Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0007: // NeighborTableList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 31; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _NeighborTable + _NeighborTable entry; + SuccessOrExit(err = _NeighborTable::FromEmberBuffer(&entry, src + entryOffset, 31)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x0008: // RouteTableList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 18; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _RouteTable + _RouteTable entry; + SuccessOrExit(err = _RouteTable::FromEmberBuffer(&entry, src + entryOffset, 18)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x003B: // SecurityPolicy + { + for (size_t index = 0; index < count; index++) + { + entryLength = 3; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _SecurityPolicy + _SecurityPolicy entry; + SuccessOrExit(err = _SecurityPolicy::FromEmberBuffer(&entry, src + entryOffset, 3)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x003D: // OperationalDatasetComponents + { + for (size_t index = 0; index < count; index++) + { + entryLength = 12; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _OperationalDatasetComponents + _OperationalDatasetComponents entry; + SuccessOrExit(err = _OperationalDatasetComponents::FromEmberBuffer(&entry, src + entryOffset, 12)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x003E: // ActiveNetworkFaultsList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 1; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + uint8_t entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // NetworkFault + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + } + break; + } + } +exit: + err = writer.EndContainer(tmpType); + return err; +} + uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, bool write, uint8_t * dest, uint8_t * src, int32_t index) { @@ -80,8 +675,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo { case 0x050C: // Application Launcher Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // application launcher list { @@ -100,8 +696,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x050B: // Audio Output Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // audio output list { @@ -114,18 +711,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _AudioOutputInfo _AudioOutputInfo * entry = reinterpret_cast<_AudioOutputInfo *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->index, write ? (uint8_t *) &entry->index : src, write, &entryOffset, - sizeof(entry->index)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->outputType, write ? (uint8_t *) &entry->outputType : src, write, - &entryOffset, sizeof(entry->outputType)); // AudioOutputType - ByteSpan * nameSpan = &entry->name; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _AudioOutputInfo::ToEmberBuffer(entry, dest + entryOffset, 36, unusedLen); + } + else + { + _AudioOutputInfo::FromEmberBuffer(entry, src + entryOffset, 36); } - entryOffset = static_cast(entryOffset + 34); break; } } @@ -133,8 +727,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x050A: // Content Launcher Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // accepts header list { @@ -180,8 +775,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x001D: // Descriptor Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // device list { @@ -194,10 +790,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _DeviceType _DeviceType * entry = reinterpret_cast<_DeviceType *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->type, write ? (uint8_t *) &entry->type : src, write, &entryOffset, - sizeof(entry->type)); // DEVTYPE_ID - copyListMember(write ? dest : (uint8_t *) &entry->revision, write ? (uint8_t *) &entry->revision : src, write, - &entryOffset, sizeof(entry->revision)); // INT16U + if (write) + { + size_t unusedLen; + _DeviceType::ToEmberBuffer(entry, dest + entryOffset, 6, unusedLen); + } + else + { + _DeviceType::FromEmberBuffer(entry, src + entryOffset, 6); + } break; } case 0x0001: // server list @@ -241,8 +842,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0040: // Fixed Label Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // label list { @@ -255,22 +857,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _LabelStruct _LabelStruct * entry = reinterpret_cast<_LabelStruct *>(write ? src : dest); - ByteSpan * labelSpan = &entry->label; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 18, labelSpan) : ReadByteSpan(src + entryOffset, 18, labelSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _LabelStruct::ToEmberBuffer(entry, dest + entryOffset, 36, unusedLen); } - entryOffset = static_cast(entryOffset + 18); - ByteSpan * valueSpan = &entry->value; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 18, valueSpan) : ReadByteSpan(src + entryOffset, 18, valueSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _LabelStruct::FromEmberBuffer(entry, src + entryOffset, 36); } - entryOffset = static_cast(entryOffset + 18); break; } } @@ -278,8 +873,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0030: // General Commissioning Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0001: // BasicCommissioningInfoList { @@ -292,9 +888,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _BasicCommissioningInfoType _BasicCommissioningInfoType * entry = reinterpret_cast<_BasicCommissioningInfoType *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->FailSafeExpiryLengthMs, - write ? (uint8_t *) &entry->FailSafeExpiryLengthMs : src, write, &entryOffset, - sizeof(entry->FailSafeExpiryLengthMs)); // INT32U + if (write) + { + size_t unusedLen; + _BasicCommissioningInfoType::ToEmberBuffer(entry, dest + entryOffset, 4, unusedLen); + } + else + { + _BasicCommissioningInfoType::FromEmberBuffer(entry, src + entryOffset, 4); + } break; } } @@ -302,8 +904,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0033: // General Diagnostics Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // NetworkInterfaces { @@ -316,33 +919,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NetworkInterfaceType _NetworkInterfaceType * entry = reinterpret_cast<_NetworkInterfaceType *>(write ? src : dest); - ByteSpan * NameSpan = &entry->Name; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, NameSpan) : ReadByteSpan(src + entryOffset, 34, NameSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _NetworkInterfaceType::ToEmberBuffer(entry, dest + entryOffset, 48, unusedLen); } - entryOffset = static_cast(entryOffset + 34); - copyListMember(write ? dest : (uint8_t *) &entry->FabricConnected, write ? (uint8_t *) &entry->FabricConnected : src, - write, &entryOffset, sizeof(entry->FabricConnected)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->OffPremiseServicesReachableIPv4, - write ? (uint8_t *) &entry->OffPremiseServicesReachableIPv4 : src, write, &entryOffset, - sizeof(entry->OffPremiseServicesReachableIPv4)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->OffPremiseServicesReachableIPv6, - write ? (uint8_t *) &entry->OffPremiseServicesReachableIPv6 : src, write, &entryOffset, - sizeof(entry->OffPremiseServicesReachableIPv6)); // BOOLEAN - ByteSpan * HardwareAddressSpan = &entry->HardwareAddress; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 10, HardwareAddressSpan) - : ReadByteSpan(src + entryOffset, 10, HardwareAddressSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _NetworkInterfaceType::FromEmberBuffer(entry, src + entryOffset, 48); } - entryOffset = static_cast(entryOffset + 10); - copyListMember(write ? dest : (uint8_t *) &entry->Type, write ? (uint8_t *) &entry->Type : src, write, &entryOffset, - sizeof(entry->Type)); // ENUM8 break; } } @@ -350,8 +935,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0xF004: // Group Key Management Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // groups { @@ -364,12 +950,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _GroupState _GroupState * entry = reinterpret_cast<_GroupState *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->VendorId, write ? (uint8_t *) &entry->VendorId : src, write, - &entryOffset, sizeof(entry->VendorId)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->VendorGroupId, write ? (uint8_t *) &entry->VendorGroupId : src, write, - &entryOffset, sizeof(entry->VendorGroupId)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->GroupKeySetIndex, write ? (uint8_t *) &entry->GroupKeySetIndex : src, - write, &entryOffset, sizeof(entry->GroupKeySetIndex)); // INT16U + if (write) + { + size_t unusedLen; + _GroupState::ToEmberBuffer(entry, dest + entryOffset, 6, unusedLen); + } + else + { + _GroupState::FromEmberBuffer(entry, src + entryOffset, 6); + } break; } case 0x0001: // group keys @@ -383,25 +972,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _GroupKey _GroupKey * entry = reinterpret_cast<_GroupKey *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->VendorId, write ? (uint8_t *) &entry->VendorId : src, write, - &entryOffset, sizeof(entry->VendorId)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->GroupKeyIndex, write ? (uint8_t *) &entry->GroupKeyIndex : src, write, - &entryOffset, sizeof(entry->GroupKeyIndex)); // INT16U - ByteSpan * GroupKeyRootSpan = &entry->GroupKeyRoot; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 18, GroupKeyRootSpan) - : ReadByteSpan(src + entryOffset, 18, GroupKeyRootSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _GroupKey::ToEmberBuffer(entry, dest + entryOffset, 31, unusedLen); + } + else + { + _GroupKey::FromEmberBuffer(entry, src + entryOffset, 31); } - entryOffset = static_cast(entryOffset + 18); - copyListMember(write ? dest : (uint8_t *) &entry->GroupKeyEpochStartTime, - write ? (uint8_t *) &entry->GroupKeyEpochStartTime : src, write, &entryOffset, - sizeof(entry->GroupKeyEpochStartTime)); // INT64U - copyListMember(write ? dest : (uint8_t *) &entry->GroupKeySecurityPolicy, - write ? (uint8_t *) &entry->GroupKeySecurityPolicy : src, write, &entryOffset, - sizeof(entry->GroupKeySecurityPolicy)); // GroupKeySecurityPolicy break; } } @@ -409,8 +988,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0507: // Media Input Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // media input list { @@ -423,27 +1003,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _MediaInputInfo _MediaInputInfo * entry = reinterpret_cast<_MediaInputInfo *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->index, write ? (uint8_t *) &entry->index : src, write, &entryOffset, - sizeof(entry->index)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->inputType, write ? (uint8_t *) &entry->inputType : src, write, - &entryOffset, sizeof(entry->inputType)); // MediaInputType - ByteSpan * nameSpan = &entry->name; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _MediaInputInfo::ToEmberBuffer(entry, dest + entryOffset, 70, unusedLen); } - entryOffset = static_cast(entryOffset + 34); - ByteSpan * descriptionSpan = &entry->description; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, descriptionSpan) - : ReadByteSpan(src + entryOffset, 34, descriptionSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _MediaInputInfo::FromEmberBuffer(entry, src + entryOffset, 70); } - entryOffset = static_cast(entryOffset + 34); break; } } @@ -451,8 +1019,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x003E: // Operational Credentials Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0001: // fabrics list { @@ -465,31 +1034,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _FabricDescriptor _FabricDescriptor * entry = reinterpret_cast<_FabricDescriptor *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->FabricIndex, write ? (uint8_t *) &entry->FabricIndex : src, write, - &entryOffset, sizeof(entry->FabricIndex)); // INT8U - ByteSpan * RootPublicKeySpan = &entry->RootPublicKey; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 67, RootPublicKeySpan) - : ReadByteSpan(src + entryOffset, 67, RootPublicKeySpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _FabricDescriptor::ToEmberBuffer(entry, dest + entryOffset, 120, unusedLen); } - entryOffset = static_cast(entryOffset + 67); - copyListMember(write ? dest : (uint8_t *) &entry->VendorId, write ? (uint8_t *) &entry->VendorId : src, write, - &entryOffset, sizeof(entry->VendorId)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->FabricId, write ? (uint8_t *) &entry->FabricId : src, write, - &entryOffset, sizeof(entry->FabricId)); // FABRIC_ID - copyListMember(write ? dest : (uint8_t *) &entry->NodeId, write ? (uint8_t *) &entry->NodeId : src, write, &entryOffset, - sizeof(entry->NodeId)); // NODE_ID - ByteSpan * LabelSpan = &entry->Label; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, LabelSpan) : ReadByteSpan(src + entryOffset, 34, LabelSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _FabricDescriptor::FromEmberBuffer(entry, src + entryOffset, 120); } - entryOffset = static_cast(entryOffset + 34); break; } } @@ -497,8 +1050,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0504: // TV Channel Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // tv channel list { @@ -511,35 +1065,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _TvChannelInfo _TvChannelInfo * entry = reinterpret_cast<_TvChannelInfo *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->majorNumber, write ? (uint8_t *) &entry->majorNumber : src, write, - &entryOffset, sizeof(entry->majorNumber)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->minorNumber, write ? (uint8_t *) &entry->minorNumber : src, write, - &entryOffset, sizeof(entry->minorNumber)); // INT16U - ByteSpan * nameSpan = &entry->name; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; - } - entryOffset = static_cast(entryOffset + 34); - ByteSpan * callSignSpan = &entry->callSign; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, callSignSpan) : ReadByteSpan(src + entryOffset, 34, callSignSpan))) - { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _TvChannelInfo::ToEmberBuffer(entry, dest + entryOffset, 106, unusedLen); } - entryOffset = static_cast(entryOffset + 34); - ByteSpan * affiliateCallSignSpan = &entry->affiliateCallSign; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, affiliateCallSignSpan) - : ReadByteSpan(src + entryOffset, 34, affiliateCallSignSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _TvChannelInfo::FromEmberBuffer(entry, src + entryOffset, 106); } - entryOffset = static_cast(entryOffset + 34); break; } } @@ -547,8 +1081,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0505: // Target Navigator Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // target navigator list { @@ -561,16 +1096,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NavigateTargetTargetInfo _NavigateTargetTargetInfo * entry = reinterpret_cast<_NavigateTargetTargetInfo *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->identifier, write ? (uint8_t *) &entry->identifier : src, write, - &entryOffset, sizeof(entry->identifier)); // INT8U - ByteSpan * nameSpan = &entry->name; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _NavigateTargetTargetInfo::ToEmberBuffer(entry, dest + entryOffset, 35, unusedLen); + } + else + { + _NavigateTargetTargetInfo::FromEmberBuffer(entry, src + entryOffset, 35); } - entryOffset = static_cast(entryOffset + 34); break; } } @@ -578,8 +1112,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x050F: // Test Cluster Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x001A: // list_int8u { @@ -631,17 +1166,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _TestListStructOctet _TestListStructOctet * entry = reinterpret_cast<_TestListStructOctet *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->fabricIndex, write ? (uint8_t *) &entry->fabricIndex : src, write, - &entryOffset, sizeof(entry->fabricIndex)); // INT64U - ByteSpan * operationalCertSpan = &entry->operationalCert; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, operationalCertSpan) - : ReadByteSpan(src + entryOffset, 34, operationalCertSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _TestListStructOctet::ToEmberBuffer(entry, dest + entryOffset, 42, unusedLen); + } + else + { + _TestListStructOctet::FromEmberBuffer(entry, src + entryOffset, 42); } - entryOffset = static_cast(entryOffset + 34); break; } } @@ -649,8 +1182,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0035: // Thread Network Diagnostics Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0007: // NeighborTableList { @@ -663,34 +1197,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NeighborTable _NeighborTable * entry = reinterpret_cast<_NeighborTable *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->ExtAddress, write ? (uint8_t *) &entry->ExtAddress : src, write, - &entryOffset, sizeof(entry->ExtAddress)); // INT64U - copyListMember(write ? dest : (uint8_t *) &entry->Age, write ? (uint8_t *) &entry->Age : src, write, &entryOffset, - sizeof(entry->Age)); // INT32U - copyListMember(write ? dest : (uint8_t *) &entry->Rloc16, write ? (uint8_t *) &entry->Rloc16 : src, write, &entryOffset, - sizeof(entry->Rloc16)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->LinkFrameCounter, write ? (uint8_t *) &entry->LinkFrameCounter : src, - write, &entryOffset, sizeof(entry->LinkFrameCounter)); // INT32U - copyListMember(write ? dest : (uint8_t *) &entry->MleFrameCounter, write ? (uint8_t *) &entry->MleFrameCounter : src, - write, &entryOffset, sizeof(entry->MleFrameCounter)); // INT32U - copyListMember(write ? dest : (uint8_t *) &entry->LQI, write ? (uint8_t *) &entry->LQI : src, write, &entryOffset, - sizeof(entry->LQI)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->AverageRssi, write ? (uint8_t *) &entry->AverageRssi : src, write, - &entryOffset, sizeof(entry->AverageRssi)); // INT8S - copyListMember(write ? dest : (uint8_t *) &entry->LastRssi, write ? (uint8_t *) &entry->LastRssi : src, write, - &entryOffset, sizeof(entry->LastRssi)); // INT8S - copyListMember(write ? dest : (uint8_t *) &entry->FrameErrorRate, write ? (uint8_t *) &entry->FrameErrorRate : src, - write, &entryOffset, sizeof(entry->FrameErrorRate)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->MessageErrorRate, write ? (uint8_t *) &entry->MessageErrorRate : src, - write, &entryOffset, sizeof(entry->MessageErrorRate)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->RxOnWhenIdle, write ? (uint8_t *) &entry->RxOnWhenIdle : src, write, - &entryOffset, sizeof(entry->RxOnWhenIdle)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->FullThreadDevice, write ? (uint8_t *) &entry->FullThreadDevice : src, - write, &entryOffset, sizeof(entry->FullThreadDevice)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->FullNetworkData, write ? (uint8_t *) &entry->FullNetworkData : src, - write, &entryOffset, sizeof(entry->FullNetworkData)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->IsChild, write ? (uint8_t *) &entry->IsChild : src, write, - &entryOffset, sizeof(entry->IsChild)); // BOOLEAN + if (write) + { + size_t unusedLen; + _NeighborTable::ToEmberBuffer(entry, dest + entryOffset, 31, unusedLen); + } + else + { + _NeighborTable::FromEmberBuffer(entry, src + entryOffset, 31); + } break; } case 0x0008: // RouteTableList @@ -704,26 +1219,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _RouteTable _RouteTable * entry = reinterpret_cast<_RouteTable *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->ExtAddress, write ? (uint8_t *) &entry->ExtAddress : src, write, - &entryOffset, sizeof(entry->ExtAddress)); // INT64U - copyListMember(write ? dest : (uint8_t *) &entry->Rloc16, write ? (uint8_t *) &entry->Rloc16 : src, write, &entryOffset, - sizeof(entry->Rloc16)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->RouterId, write ? (uint8_t *) &entry->RouterId : src, write, - &entryOffset, sizeof(entry->RouterId)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->NextHop, write ? (uint8_t *) &entry->NextHop : src, write, - &entryOffset, sizeof(entry->NextHop)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->PathCost, write ? (uint8_t *) &entry->PathCost : src, write, - &entryOffset, sizeof(entry->PathCost)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->LQIIn, write ? (uint8_t *) &entry->LQIIn : src, write, &entryOffset, - sizeof(entry->LQIIn)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->LQIOut, write ? (uint8_t *) &entry->LQIOut : src, write, &entryOffset, - sizeof(entry->LQIOut)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->Age, write ? (uint8_t *) &entry->Age : src, write, &entryOffset, - sizeof(entry->Age)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->Allocated, write ? (uint8_t *) &entry->Allocated : src, write, - &entryOffset, sizeof(entry->Allocated)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->LinkEstablished, write ? (uint8_t *) &entry->LinkEstablished : src, - write, &entryOffset, sizeof(entry->LinkEstablished)); // BOOLEAN + if (write) + { + size_t unusedLen; + _RouteTable::ToEmberBuffer(entry, dest + entryOffset, 18, unusedLen); + } + else + { + _RouteTable::FromEmberBuffer(entry, src + entryOffset, 18); + } break; } case 0x003B: // SecurityPolicy @@ -737,10 +1241,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _SecurityPolicy _SecurityPolicy * entry = reinterpret_cast<_SecurityPolicy *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->RotationTime, write ? (uint8_t *) &entry->RotationTime : src, write, - &entryOffset, sizeof(entry->RotationTime)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->Flags, write ? (uint8_t *) &entry->Flags : src, write, &entryOffset, - sizeof(entry->Flags)); // INT8U + if (write) + { + size_t unusedLen; + _SecurityPolicy::ToEmberBuffer(entry, dest + entryOffset, 3, unusedLen); + } + else + { + _SecurityPolicy::FromEmberBuffer(entry, src + entryOffset, 3); + } break; } case 0x003D: // OperationalDatasetComponents @@ -754,37 +1263,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _OperationalDatasetComponents _OperationalDatasetComponents * entry = reinterpret_cast<_OperationalDatasetComponents *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->ActiveTimestampPresent, - write ? (uint8_t *) &entry->ActiveTimestampPresent : src, write, &entryOffset, - sizeof(entry->ActiveTimestampPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->PendingTimestampPresent, - write ? (uint8_t *) &entry->PendingTimestampPresent : src, write, &entryOffset, - sizeof(entry->PendingTimestampPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->MasterKeyPresent, write ? (uint8_t *) &entry->MasterKeyPresent : src, - write, &entryOffset, sizeof(entry->MasterKeyPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->NetworkNamePresent, - write ? (uint8_t *) &entry->NetworkNamePresent : src, write, &entryOffset, - sizeof(entry->NetworkNamePresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->ExtendedPanIdPresent, - write ? (uint8_t *) &entry->ExtendedPanIdPresent : src, write, &entryOffset, - sizeof(entry->ExtendedPanIdPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->MeshLocalPrefixPresent, - write ? (uint8_t *) &entry->MeshLocalPrefixPresent : src, write, &entryOffset, - sizeof(entry->MeshLocalPrefixPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->DelayPresent, write ? (uint8_t *) &entry->DelayPresent : src, write, - &entryOffset, sizeof(entry->DelayPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->PanIdPresent, write ? (uint8_t *) &entry->PanIdPresent : src, write, - &entryOffset, sizeof(entry->PanIdPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->ChannelPresent, write ? (uint8_t *) &entry->ChannelPresent : src, - write, &entryOffset, sizeof(entry->ChannelPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->PskcPresent, write ? (uint8_t *) &entry->PskcPresent : src, write, - &entryOffset, sizeof(entry->PskcPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->SecurityPolicyPresent, - write ? (uint8_t *) &entry->SecurityPolicyPresent : src, write, &entryOffset, - sizeof(entry->SecurityPolicyPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->ChannelMaskPresent, - write ? (uint8_t *) &entry->ChannelMaskPresent : src, write, &entryOffset, - sizeof(entry->ChannelMaskPresent)); // BOOLEAN + if (write) + { + size_t unusedLen; + _OperationalDatasetComponents::ToEmberBuffer(entry, dest + entryOffset, 12, unusedLen); + } + else + { + _OperationalDatasetComponents::FromEmberBuffer(entry, src + entryOffset, 12); + } break; } case 0x003E: // ActiveNetworkFaultsList diff --git a/zzz_generated/window-app/zap-generated/attribute-size.cpp b/zzz_generated/window-app/zap-generated/attribute-size.cpp index 4e6eb9372d81a1..5b98225a951233 100644 --- a/zzz_generated/window-app/zap-generated/attribute-size.cpp +++ b/zzz_generated/window-app/zap-generated/attribute-size.cpp @@ -21,10 +21,13 @@ #include #include #include +#include +#include #include #include using namespace chip; +using namespace chip::app; using namespace chip::app::List; // The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid @@ -45,6 +48,232 @@ void copyListMember(uint8_t * dest, uint8_t * src, bool write, uint16_t * offset *offset = static_cast(*offset + length); } +CHIP_ERROR CopyStructAttributeToCHIPTLV(ClusterId clusterId, AttributeId attributeId, uint8_t * src, uint16_t len, + TLV::TLVWriter & writer, uint64_t tag) +{ + switch (clusterId) + { + } + return CHIP_ERROR_INVALID_ARGUMENT; +} + +CHIP_ERROR EmberListToCHIPTLV(ClusterId clusterId, AttributeId attributeId, uint8_t * src, uint16_t len, TLV::TLVWriter & writer, + uint64_t tag) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + chip::TLV::TLVType tmpType; + size_t count = *reinterpret_cast(src); + uint16_t entryLength = 0; + // Suppress error of unused variable. + (void) entryLength; + (void) count; + SuccessOrExit(err = writer.StartContainer(tag, TLV::TLVType::kTLVType_Array, tmpType)); + switch (clusterId) + { + case 0x0030: // General Commissioning Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0001: // BasicCommissioningInfoList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 4; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _BasicCommissioningInfoType + _BasicCommissioningInfoType entry; + SuccessOrExit(err = _BasicCommissioningInfoType::FromEmberBuffer(&entry, src + entryOffset, 4)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x0033: // General Diagnostics Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0000: // NetworkInterfaces + { + for (size_t index = 0; index < count; index++) + { + entryLength = 48; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _NetworkInterfaceType + _NetworkInterfaceType entry; + SuccessOrExit(err = _NetworkInterfaceType::FromEmberBuffer(&entry, src + entryOffset, 48)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + } + break; + } + case 0x003E: // Operational Credentials Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0001: // fabrics list + { + for (size_t index = 0; index < count; index++) + { + entryLength = 120; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _FabricDescriptor + _FabricDescriptor entry; + SuccessOrExit(err = _FabricDescriptor::FromEmberBuffer(&entry, src + entryOffset, 120)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x0004: // TrustedRootCertificates + { + for (size_t index = 0; index < count; index++) + { + entryOffset = GetByteSpanOffsetFromIndex(src, len, static_cast(index)); + if (entryOffset == 0) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + + chip::ByteSpan trustedRootCertificatesSpan; // OCTET_STRING + uint16_t trustedRootCertificatesRemainingSpace = static_cast(len - entryOffset); + if (CHIP_NO_ERROR != + ReadByteSpan(src + entryOffset, trustedRootCertificatesRemainingSpace, &trustedRootCertificatesSpan)) + { + ChipLogError(Zcl, "Index %zu is invalid. Not enough remaining space", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + writer.Put(TLV::AnonymousTag, trustedRootCertificatesSpan); + } + break; + } + } + break; + } + case 0x0035: // Thread Network Diagnostics Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (attributeId) + { + case 0x0007: // NeighborTableList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 31; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _NeighborTable + _NeighborTable entry; + SuccessOrExit(err = _NeighborTable::FromEmberBuffer(&entry, src + entryOffset, 31)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x0008: // RouteTableList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 18; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _RouteTable + _RouteTable entry; + SuccessOrExit(err = _RouteTable::FromEmberBuffer(&entry, src + entryOffset, 18)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x003B: // SecurityPolicy + { + for (size_t index = 0; index < count; index++) + { + entryLength = 3; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _SecurityPolicy + _SecurityPolicy entry; + SuccessOrExit(err = _SecurityPolicy::FromEmberBuffer(&entry, src + entryOffset, 3)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x003D: // OperationalDatasetComponents + { + for (size_t index = 0; index < count; index++) + { + entryLength = 12; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + // Struct _OperationalDatasetComponents + _OperationalDatasetComponents entry; + SuccessOrExit(err = _OperationalDatasetComponents::FromEmberBuffer(&entry, src + entryOffset, 12)); + SuccessOrExit(err = writer.Put(TLV::AnonymousTag, entry)); + } + break; + } + case 0x003E: // ActiveNetworkFaultsList + { + for (size_t index = 0; index < count; index++) + { + entryLength = 1; + if ((index * entryLength) > static_cast(len - entryLength)) + { + ChipLogError(Zcl, "Index %zu is invalid.", index); + ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); + } + entryOffset = static_cast(kSizeLengthInBytes + (index * entryLength)); + uint8_t entry; + copyListMember(reinterpret_cast(&entry), src, false, &entryOffset, entryLength); // NetworkFault + writer.Put(TLV::AnonymousTag, entry); + } + break; + } + } + break; + } + } +exit: + err = writer.EndContainer(tmpType); + return err; +} + uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, bool write, uint8_t * dest, uint8_t * src, int32_t index) { @@ -80,8 +309,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo { case 0x0030: // General Commissioning Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0001: // BasicCommissioningInfoList { @@ -94,9 +324,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _BasicCommissioningInfoType _BasicCommissioningInfoType * entry = reinterpret_cast<_BasicCommissioningInfoType *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->FailSafeExpiryLengthMs, - write ? (uint8_t *) &entry->FailSafeExpiryLengthMs : src, write, &entryOffset, - sizeof(entry->FailSafeExpiryLengthMs)); // INT32U + if (write) + { + size_t unusedLen; + _BasicCommissioningInfoType::ToEmberBuffer(entry, dest + entryOffset, 4, unusedLen); + } + else + { + _BasicCommissioningInfoType::FromEmberBuffer(entry, src + entryOffset, 4); + } break; } } @@ -104,8 +340,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0033: // General Diagnostics Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0000: // NetworkInterfaces { @@ -118,33 +355,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NetworkInterfaceType _NetworkInterfaceType * entry = reinterpret_cast<_NetworkInterfaceType *>(write ? src : dest); - ByteSpan * NameSpan = &entry->Name; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, NameSpan) : ReadByteSpan(src + entryOffset, 34, NameSpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _NetworkInterfaceType::ToEmberBuffer(entry, dest + entryOffset, 48, unusedLen); } - entryOffset = static_cast(entryOffset + 34); - copyListMember(write ? dest : (uint8_t *) &entry->FabricConnected, write ? (uint8_t *) &entry->FabricConnected : src, - write, &entryOffset, sizeof(entry->FabricConnected)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->OffPremiseServicesReachableIPv4, - write ? (uint8_t *) &entry->OffPremiseServicesReachableIPv4 : src, write, &entryOffset, - sizeof(entry->OffPremiseServicesReachableIPv4)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->OffPremiseServicesReachableIPv6, - write ? (uint8_t *) &entry->OffPremiseServicesReachableIPv6 : src, write, &entryOffset, - sizeof(entry->OffPremiseServicesReachableIPv6)); // BOOLEAN - ByteSpan * HardwareAddressSpan = &entry->HardwareAddress; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 10, HardwareAddressSpan) - : ReadByteSpan(src + entryOffset, 10, HardwareAddressSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _NetworkInterfaceType::FromEmberBuffer(entry, src + entryOffset, 48); } - entryOffset = static_cast(entryOffset + 10); - copyListMember(write ? dest : (uint8_t *) &entry->Type, write ? (uint8_t *) &entry->Type : src, write, &entryOffset, - sizeof(entry->Type)); // ENUM8 break; } } @@ -152,8 +371,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x003E: // Operational Credentials Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0001: // fabrics list { @@ -166,31 +386,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _FabricDescriptor _FabricDescriptor * entry = reinterpret_cast<_FabricDescriptor *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->FabricIndex, write ? (uint8_t *) &entry->FabricIndex : src, write, - &entryOffset, sizeof(entry->FabricIndex)); // INT8U - ByteSpan * RootPublicKeySpan = &entry->RootPublicKey; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 67, RootPublicKeySpan) - : ReadByteSpan(src + entryOffset, 67, RootPublicKeySpan))) + if (write) { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + size_t unusedLen; + _FabricDescriptor::ToEmberBuffer(entry, dest + entryOffset, 120, unusedLen); } - entryOffset = static_cast(entryOffset + 67); - copyListMember(write ? dest : (uint8_t *) &entry->VendorId, write ? (uint8_t *) &entry->VendorId : src, write, - &entryOffset, sizeof(entry->VendorId)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->FabricId, write ? (uint8_t *) &entry->FabricId : src, write, - &entryOffset, sizeof(entry->FabricId)); // FABRIC_ID - copyListMember(write ? dest : (uint8_t *) &entry->NodeId, write ? (uint8_t *) &entry->NodeId : src, write, &entryOffset, - sizeof(entry->NodeId)); // NODE_ID - ByteSpan * LabelSpan = &entry->Label; // OCTET_STRING - if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, 34, LabelSpan) : ReadByteSpan(src + entryOffset, 34, LabelSpan))) + else { - ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); - return 0; + _FabricDescriptor::FromEmberBuffer(entry, src + entryOffset, 120); } - entryOffset = static_cast(entryOffset + 34); break; } case 0x0004: // TrustedRootCertificates @@ -225,8 +429,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo } case 0x0035: // Thread Network Diagnostics Cluster { - uint16_t entryOffset = kSizeLengthInBytes; - switch (am->attributeId) + uint16_t entryOffset = kSizeLengthInBytes; + AttributeId attributeId = am->attributeId; + switch (attributeId) { case 0x0007: // NeighborTableList { @@ -239,34 +444,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NeighborTable _NeighborTable * entry = reinterpret_cast<_NeighborTable *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->ExtAddress, write ? (uint8_t *) &entry->ExtAddress : src, write, - &entryOffset, sizeof(entry->ExtAddress)); // INT64U - copyListMember(write ? dest : (uint8_t *) &entry->Age, write ? (uint8_t *) &entry->Age : src, write, &entryOffset, - sizeof(entry->Age)); // INT32U - copyListMember(write ? dest : (uint8_t *) &entry->Rloc16, write ? (uint8_t *) &entry->Rloc16 : src, write, &entryOffset, - sizeof(entry->Rloc16)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->LinkFrameCounter, write ? (uint8_t *) &entry->LinkFrameCounter : src, - write, &entryOffset, sizeof(entry->LinkFrameCounter)); // INT32U - copyListMember(write ? dest : (uint8_t *) &entry->MleFrameCounter, write ? (uint8_t *) &entry->MleFrameCounter : src, - write, &entryOffset, sizeof(entry->MleFrameCounter)); // INT32U - copyListMember(write ? dest : (uint8_t *) &entry->LQI, write ? (uint8_t *) &entry->LQI : src, write, &entryOffset, - sizeof(entry->LQI)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->AverageRssi, write ? (uint8_t *) &entry->AverageRssi : src, write, - &entryOffset, sizeof(entry->AverageRssi)); // INT8S - copyListMember(write ? dest : (uint8_t *) &entry->LastRssi, write ? (uint8_t *) &entry->LastRssi : src, write, - &entryOffset, sizeof(entry->LastRssi)); // INT8S - copyListMember(write ? dest : (uint8_t *) &entry->FrameErrorRate, write ? (uint8_t *) &entry->FrameErrorRate : src, - write, &entryOffset, sizeof(entry->FrameErrorRate)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->MessageErrorRate, write ? (uint8_t *) &entry->MessageErrorRate : src, - write, &entryOffset, sizeof(entry->MessageErrorRate)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->RxOnWhenIdle, write ? (uint8_t *) &entry->RxOnWhenIdle : src, write, - &entryOffset, sizeof(entry->RxOnWhenIdle)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->FullThreadDevice, write ? (uint8_t *) &entry->FullThreadDevice : src, - write, &entryOffset, sizeof(entry->FullThreadDevice)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->FullNetworkData, write ? (uint8_t *) &entry->FullNetworkData : src, - write, &entryOffset, sizeof(entry->FullNetworkData)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->IsChild, write ? (uint8_t *) &entry->IsChild : src, write, - &entryOffset, sizeof(entry->IsChild)); // BOOLEAN + if (write) + { + size_t unusedLen; + _NeighborTable::ToEmberBuffer(entry, dest + entryOffset, 31, unusedLen); + } + else + { + _NeighborTable::FromEmberBuffer(entry, src + entryOffset, 31); + } break; } case 0x0008: // RouteTableList @@ -280,26 +466,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _RouteTable _RouteTable * entry = reinterpret_cast<_RouteTable *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->ExtAddress, write ? (uint8_t *) &entry->ExtAddress : src, write, - &entryOffset, sizeof(entry->ExtAddress)); // INT64U - copyListMember(write ? dest : (uint8_t *) &entry->Rloc16, write ? (uint8_t *) &entry->Rloc16 : src, write, &entryOffset, - sizeof(entry->Rloc16)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->RouterId, write ? (uint8_t *) &entry->RouterId : src, write, - &entryOffset, sizeof(entry->RouterId)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->NextHop, write ? (uint8_t *) &entry->NextHop : src, write, - &entryOffset, sizeof(entry->NextHop)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->PathCost, write ? (uint8_t *) &entry->PathCost : src, write, - &entryOffset, sizeof(entry->PathCost)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->LQIIn, write ? (uint8_t *) &entry->LQIIn : src, write, &entryOffset, - sizeof(entry->LQIIn)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->LQIOut, write ? (uint8_t *) &entry->LQIOut : src, write, &entryOffset, - sizeof(entry->LQIOut)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->Age, write ? (uint8_t *) &entry->Age : src, write, &entryOffset, - sizeof(entry->Age)); // INT8U - copyListMember(write ? dest : (uint8_t *) &entry->Allocated, write ? (uint8_t *) &entry->Allocated : src, write, - &entryOffset, sizeof(entry->Allocated)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->LinkEstablished, write ? (uint8_t *) &entry->LinkEstablished : src, - write, &entryOffset, sizeof(entry->LinkEstablished)); // BOOLEAN + if (write) + { + size_t unusedLen; + _RouteTable::ToEmberBuffer(entry, dest + entryOffset, 18, unusedLen); + } + else + { + _RouteTable::FromEmberBuffer(entry, src + entryOffset, 18); + } break; } case 0x003B: // SecurityPolicy @@ -313,10 +488,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _SecurityPolicy _SecurityPolicy * entry = reinterpret_cast<_SecurityPolicy *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->RotationTime, write ? (uint8_t *) &entry->RotationTime : src, write, - &entryOffset, sizeof(entry->RotationTime)); // INT16U - copyListMember(write ? dest : (uint8_t *) &entry->Flags, write ? (uint8_t *) &entry->Flags : src, write, &entryOffset, - sizeof(entry->Flags)); // INT8U + if (write) + { + size_t unusedLen; + _SecurityPolicy::ToEmberBuffer(entry, dest + entryOffset, 3, unusedLen); + } + else + { + _SecurityPolicy::FromEmberBuffer(entry, src + entryOffset, 3); + } break; } case 0x003D: // OperationalDatasetComponents @@ -330,37 +510,15 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _OperationalDatasetComponents _OperationalDatasetComponents * entry = reinterpret_cast<_OperationalDatasetComponents *>(write ? src : dest); - copyListMember(write ? dest : (uint8_t *) &entry->ActiveTimestampPresent, - write ? (uint8_t *) &entry->ActiveTimestampPresent : src, write, &entryOffset, - sizeof(entry->ActiveTimestampPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->PendingTimestampPresent, - write ? (uint8_t *) &entry->PendingTimestampPresent : src, write, &entryOffset, - sizeof(entry->PendingTimestampPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->MasterKeyPresent, write ? (uint8_t *) &entry->MasterKeyPresent : src, - write, &entryOffset, sizeof(entry->MasterKeyPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->NetworkNamePresent, - write ? (uint8_t *) &entry->NetworkNamePresent : src, write, &entryOffset, - sizeof(entry->NetworkNamePresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->ExtendedPanIdPresent, - write ? (uint8_t *) &entry->ExtendedPanIdPresent : src, write, &entryOffset, - sizeof(entry->ExtendedPanIdPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->MeshLocalPrefixPresent, - write ? (uint8_t *) &entry->MeshLocalPrefixPresent : src, write, &entryOffset, - sizeof(entry->MeshLocalPrefixPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->DelayPresent, write ? (uint8_t *) &entry->DelayPresent : src, write, - &entryOffset, sizeof(entry->DelayPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->PanIdPresent, write ? (uint8_t *) &entry->PanIdPresent : src, write, - &entryOffset, sizeof(entry->PanIdPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->ChannelPresent, write ? (uint8_t *) &entry->ChannelPresent : src, - write, &entryOffset, sizeof(entry->ChannelPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->PskcPresent, write ? (uint8_t *) &entry->PskcPresent : src, write, - &entryOffset, sizeof(entry->PskcPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->SecurityPolicyPresent, - write ? (uint8_t *) &entry->SecurityPolicyPresent : src, write, &entryOffset, - sizeof(entry->SecurityPolicyPresent)); // BOOLEAN - copyListMember(write ? dest : (uint8_t *) &entry->ChannelMaskPresent, - write ? (uint8_t *) &entry->ChannelMaskPresent : src, write, &entryOffset, - sizeof(entry->ChannelMaskPresent)); // BOOLEAN + if (write) + { + size_t unusedLen; + _OperationalDatasetComponents::ToEmberBuffer(entry, dest + entryOffset, 12, unusedLen); + } + else + { + _OperationalDatasetComponents::FromEmberBuffer(entry, src + entryOffset, 12); + } break; } case 0x003E: // ActiveNetworkFaultsList