diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index f1e980a8a0225f..90f48ce7e1de85 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -1294,7 +1294,7 @@ "outgoing": 1 }, { - "name": "ApplyUpdateRequestResponse", + "name": "ApplyUpdateResponse", "code": 4, "mfgCode": null, "source": "server", @@ -8380,7 +8380,7 @@ "outgoing": 1 }, { - "name": "ApplyUpdateRequestResponse", + "name": "ApplyUpdateResponse", "code": 4, "mfgCode": null, "source": "server", @@ -15636,6 +15636,276 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "unsupported", + "code": 255, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_boolean", + "code": 32768, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "false", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_bitmap8", + "code": 32769, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_bitmap16", + "code": 32770, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_bitmap32", + "code": 32771, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_bitmap64", + "code": 32772, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_int8u", + "code": 32773, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_int16u", + "code": 32774, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_int32u", + "code": 32776, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_int64u", + "code": 32780, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_int8s", + "code": 32781, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_int16s", + "code": 32782, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_int32s", + "code": 32784, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_int64s", + "code": 32788, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_enum8", + "code": 32789, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_enum16", + "code": 32790, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_octet_string", + "code": 32793, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_char_string", + "code": 32798, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ClusterRevision", "code": 65533, diff --git a/src/app/tests/suites/TestClusterComplexTypes.yaml b/src/app/tests/suites/TestClusterComplexTypes.yaml index 8241a66258ba69..522ec7d4803d4b 100644 --- a/src/app/tests/suites/TestClusterComplexTypes.yaml +++ b/src/app/tests/suites/TestClusterComplexTypes.yaml @@ -479,3 +479,683 @@ tests: value: true - name: "originalValue" value: null + + # Nullable attributes + + # Tests for nullable Boolean attribute + + - label: "Write attribute NULLABLE_BOOLEAN null" + command: "writeAttribute" + attribute: "nullable_boolean" + arguments: + value: null + + - label: "Read attribute NULLABLE_BOOLEAN null" + command: "readAttribute" + attribute: "nullable_boolean" + response: + value: null + + - label: "Write attribute NULLABLE_BOOLEAN True" + command: "writeAttribute" + attribute: "nullable_boolean" + arguments: + value: true + + - label: "Read attribute NULLABLE_BOOLEAN True" + command: "readAttribute" + attribute: "nullable_boolean" + response: + value: true + + # Tests for nullable Bitmap8 attribute + + - label: "Write attribute NULLABLE_BITMAP8 Max Value" + command: "writeAttribute" + attribute: "nullable_bitmap8" + arguments: + value: 254 + + - label: "Read attribute NULLABLE_BITMAP8 Max Value" + command: "readAttribute" + attribute: "nullable_bitmap8" + response: + value: 254 + + - label: "Write attribute NULLABLE_BITMAP8 Invalid Value" + command: "writeAttribute" + attribute: "nullable_bitmap8" + arguments: + value: 255 + response: + error: 1 + + - label: "Read attribute NULLABLE_BITMAP8 unchanged Value" + command: "readAttribute" + attribute: "nullable_bitmap8" + response: + value: 254 + + - label: "Write attribute NULLABLE_BITMAP8 null Value" + command: "writeAttribute" + attribute: "nullable_bitmap8" + arguments: + value: null + + - label: "Read attribute NULLABLE_BITMAP8 null Value" + command: "readAttribute" + attribute: "nullable_bitmap8" + response: + value: null + + # Tests for nullable Bitmap16 attribute + + - label: "Write attribute NULLABLE_BITMAP16 Max Value" + command: "writeAttribute" + attribute: "nullable_bitmap16" + arguments: + value: 65534 + + - label: "Read attribute NULLABLE_BITMAP16 Max Value" + command: "readAttribute" + attribute: "nullable_bitmap16" + response: + value: 65534 + + - label: "Write attribute NULLABLE_BITMAP16 Invalid Value" + command: "writeAttribute" + attribute: "nullable_bitmap16" + arguments: + value: 65535 + response: + error: 1 + + - label: "Read attribute NULLABLE_BITMAP16 unchanged Value" + command: "readAttribute" + attribute: "nullable_bitmap16" + response: + value: 65534 + + - label: "Write attribute NULLABLE_BITMAP16 null Value" + command: "writeAttribute" + attribute: "nullable_bitmap16" + arguments: + value: null + + - label: "Read attribute NULLABLE_BITMAP16 null Value" + command: "readAttribute" + attribute: "nullable_bitmap16" + response: + value: null + + # Tests for nullable Bitmap32 attribute + + - label: "Write attribute NULLABLE_BITMAP32 Max Value" + command: "writeAttribute" + attribute: "nullable_bitmap32" + arguments: + value: 4294967294 + + - label: "Read attribute NULLABLE_BITMAP32 Max Value" + command: "readAttribute" + attribute: "nullable_bitmap32" + response: + value: 4294967294 + + - label: "Write attribute NULLABLE_BITMAP32 Invalid Value" + command: "writeAttribute" + attribute: "nullable_bitmap32" + arguments: + value: 4294967295 + response: + error: 1 + + - label: "Read attribute NULLABLE_BITMAP32 unchanged Value" + command: "readAttribute" + attribute: "nullable_bitmap32" + response: + value: 4294967294 + + - label: "Write attribute NULLABLE_BITMAP32 null Value" + command: "writeAttribute" + attribute: "nullable_bitmap32" + arguments: + value: null + + - label: "Read attribute NULLABLE_BITMAP32 null Value" + command: "readAttribute" + attribute: "nullable_bitmap32" + response: + value: null + + # Tests for nullable Bitmap64 attribute + + - label: "Write attribute NULLABLE_BITMAP64 Max Value" + command: "writeAttribute" + attribute: "nullable_bitmap64" + arguments: + value: "18446744073709551614" + + - label: "Read attribute NULLABLE_BITMAP64 Max Value" + command: "readAttribute" + attribute: "nullable_bitmap64" + response: + value: "18446744073709551614" + + - label: "Write attribute NULLABLE_BITMAP64 Invalid Value" + command: "writeAttribute" + attribute: "nullable_bitmap64" + arguments: + value: "18446744073709551615" + response: + error: 1 + + - label: "Read attribute NULLABLE_BITMAP64 unchanged Value" + command: "readAttribute" + attribute: "nullable_bitmap64" + response: + value: "18446744073709551614" + + - label: "Write attribute NULLABLE_BITMAP64 null Value" + command: "writeAttribute" + attribute: "nullable_bitmap64" + arguments: + value: null + + - label: "Read attribute NULLABLE_BITMAP64 null Value" + command: "readAttribute" + attribute: "nullable_bitmap64" + response: + value: null + + # Tests for UInt8 attribute + + - label: "Write attribute NULLABLE_INT8U Max Value" + command: "writeAttribute" + attribute: "nullable_int8u" + arguments: + value: 254 + + - label: "Read attribute NULLABLE_INT8U Max Value" + command: "readAttribute" + attribute: "nullable_int8u" + response: + value: 254 + + - label: "Write attribute NULLABLE_INT8U Invalid Value" + command: "writeAttribute" + attribute: "nullable_int8u" + arguments: + value: 255 + response: + error: 1 + + - label: "Read attribute NULLABLE_INT8U unchanged Value" + command: "readAttribute" + attribute: "nullable_int8u" + response: + value: 254 + + - label: "Write attribute NULLABLE_INT8U null Value" + command: "writeAttribute" + attribute: "nullable_int8u" + arguments: + value: null + + - label: "Read attribute NULLABLE_INT8U null Value" + command: "readAttribute" + attribute: "nullable_int8u" + response: + value: null + + # Tests for UInt16 attribute + + - label: "Write attribute NULLABLE_INT16U Max Value" + command: "writeAttribute" + attribute: "nullable_int16u" + arguments: + value: 65534 + + - label: "Read attribute NULLABLE_INT16U Max Value" + command: "readAttribute" + attribute: "nullable_int16u" + response: + value: 65534 + + - label: "Write attribute NULLABLE_INT16U Invalid Value" + command: "writeAttribute" + attribute: "nullable_int16u" + arguments: + value: 65535 + response: + error: 1 + + - label: "Read attribute NULLABLE_INT16U unchanged Value" + command: "readAttribute" + attribute: "nullable_int16u" + response: + value: 65534 + + - label: "Write attribute NULLABLE_INT16U null Value" + command: "writeAttribute" + attribute: "nullable_int16u" + arguments: + value: null + + - label: "Read attribute NULLABLE_INT16U null Value" + command: "readAttribute" + attribute: "nullable_int16u" + response: + value: null + + # Tests for UInt32 attribute + + - label: "Write attribute NULLABLE_INT32U Max Value" + command: "writeAttribute" + attribute: "nullable_int32u" + arguments: + value: 4294967294 + + - label: "Read attribute NULLABLE_INT32U Max Value" + command: "readAttribute" + attribute: "nullable_int32u" + response: + value: 4294967294 + + - label: "Write attribute NULLABLE_INT32U Invalid Value" + command: "writeAttribute" + attribute: "nullable_int32u" + arguments: + value: 4294967295 + response: + error: 1 + + - label: "Read attribute NULLABLE_INT32U unchanged Value" + command: "readAttribute" + attribute: "nullable_int32u" + response: + value: 4294967294 + + - label: "Write attribute NULLABLE_INT32U null Value" + command: "writeAttribute" + attribute: "nullable_int32u" + arguments: + value: null + + - label: "Read attribute NULLABLE_INT32U null Value" + command: "readAttribute" + attribute: "nullable_int32u" + response: + value: null + + # Tests for UInt64 attribute + + - label: "Write attribute NULLABLE_INT64U Max Value" + command: "writeAttribute" + attribute: "nullable_int64u" + arguments: + value: "18446744073709551614" + + - label: "Read attribute NULLABLE_INT64U Max Value" + command: "readAttribute" + attribute: "nullable_int64u" + response: + value: "18446744073709551614" + + - label: "Write attribute NULLABLE_INT64U Invalid Value" + command: "writeAttribute" + attribute: "nullable_int64u" + arguments: + value: "18446744073709551615" + response: + error: 1 + + - label: "Read attribute NULLABLE_INT64U unchanged Value" + command: "readAttribute" + attribute: "nullable_int64u" + response: + value: "18446744073709551614" + + - label: "Write attribute NULLABLE_INT64U null Value" + command: "writeAttribute" + attribute: "nullable_int64u" + arguments: + value: null + + - label: "Read attribute NULLABLE_INT64U null Value" + command: "readAttribute" + attribute: "nullable_int64u" + response: + value: null + + # Tests for Int8 attribute + + - label: "Write attribute NULLABLE_INT8S Min Value" + command: "writeAttribute" + attribute: "nullable_int8s" + arguments: + value: -127 + + - label: "Read attribute NULLABLE_INT8S Min Value" + command: "readAttribute" + attribute: "nullable_int8s" + response: + value: -127 + + - label: "Write attribute NULLABLE_INT8S Invalid Value" + command: "writeAttribute" + attribute: "nullable_int8s" + arguments: + value: -128 + response: + error: 1 + + - label: "Read attribute NULLABLE_INT8S unchanged Value" + command: "readAttribute" + attribute: "nullable_int8s" + response: + value: -127 + + - label: "Write attribute NULLABLE_INT8S null Value" + command: "writeAttribute" + attribute: "nullable_int8s" + arguments: + value: null + + - label: "Read attribute NULLABLE_INT8S null Value" + command: "readAttribute" + attribute: "nullable_int8s" + response: + value: null + + # Tests for Int16 attribute + + - label: "Write attribute NULLABLE_INT16S Min Value" + command: "writeAttribute" + attribute: "nullable_int16s" + arguments: + value: -32767 + + - label: "Read attribute NULLABLE_INT16S Min Value" + command: "readAttribute" + attribute: "nullable_int16s" + response: + value: -32767 + + - label: "Write attribute NULLABLE_INT16S Invalid Value" + command: "writeAttribute" + attribute: "nullable_int16s" + arguments: + value: -32768 + response: + error: 1 + + - label: "Read attribute NULLABLE_INT16S unchanged Value" + command: "readAttribute" + attribute: "nullable_int16s" + response: + value: -32767 + + - label: "Write attribute NULLABLE_INT16S null Value" + command: "writeAttribute" + attribute: "nullable_int16s" + arguments: + value: null + + - label: "Read attribute NULLABLE_INT16S null Value" + command: "readAttribute" + attribute: "nullable_int16s" + response: + value: null + + # Tests for Int32 attribute + + - label: "Write attribute NULLABLE_INT32S Min Value" + command: "writeAttribute" + attribute: "nullable_int32s" + arguments: + value: -2147483647 + + - label: "Read attribute NULLABLE_INT32S Min Value" + command: "readAttribute" + attribute: "nullable_int32s" + response: + value: -2147483647 + + - label: "Write attribute NULLABLE_INT32S Invalid Value" + command: "writeAttribute" + attribute: "nullable_int32s" + arguments: + value: -2147483648 + response: + error: 1 + + - label: "Read attribute NULLABLE_INT32S unchanged Value" + command: "readAttribute" + attribute: "nullable_int32s" + response: + value: -2147483647 + + - label: "Write attribute NULLABLE_INT32S null Value" + command: "writeAttribute" + attribute: "nullable_int32s" + arguments: + value: null + + - label: "Read attribute NULLABLE_INT32S null Value" + command: "readAttribute" + attribute: "nullable_int32s" + response: + value: null + + # Tests for Int64 attribute + + - label: "Write attribute NULLABLE_INT64S Min Value" + command: "writeAttribute" + attribute: "nullable_int64s" + arguments: + value: "-9223372036854775807" + + - label: "Read attribute NULLABLE_INT64S Min Value" + command: "readAttribute" + attribute: "nullable_int64s" + response: + value: "-9223372036854775807" + + - label: "Write attribute NULLABLE_INT64S Invalid Value" + command: "writeAttribute" + attribute: "nullable_int64s" + arguments: + # This is a nasty hack: -9223372036854775808 is not a valid way to + # write a long long in C++, leading to warnings. So this tries to + # work around that. + value: "-9223372036854775807LL - 1" + response: + error: 1 + + - label: "Read attribute NULLABLE_INT64S unchanged Value" + command: "readAttribute" + attribute: "nullable_int64s" + response: + value: "-9223372036854775807" + + - label: "Write attribute NULLABLE_INT64S null Value" + command: "writeAttribute" + attribute: "nullable_int64s" + arguments: + value: null + + - label: "Read attribute NULLABLE_INT64S null Value" + command: "readAttribute" + attribute: "nullable_int64s" + response: + value: null + + # Tests for Enum8 attribute + + - label: "Write attribute NULLABLE_ENUM8 Max Value" + command: "writeAttribute" + attribute: "nullable_enum8" + arguments: + value: 254 + + - label: "Read attribute NULLABLE_ENUM8 Max Value" + command: "readAttribute" + attribute: "nullable_enum8" + response: + value: 254 + + - label: "Write attribute NULLABLE_ENUM8 Invalid Value" + command: "writeAttribute" + attribute: "nullable_enum8" + arguments: + value: 255 + response: + error: 1 + + - label: "Read attribute NULLABLE_ENUM8 unchanged Value" + command: "readAttribute" + attribute: "nullable_enum8" + response: + value: 254 + + - label: "Write attribute NULLABLE_ENUM8 null Value" + command: "writeAttribute" + attribute: "nullable_enum8" + arguments: + value: null + + - label: "Read attribute NULLABLE_ENUM8 null Value" + command: "readAttribute" + attribute: "nullable_enum8" + response: + value: null + + # Tests for Enum16 attribute + + - label: "Write attribute NULLABLE_ENUM16 Max Value" + command: "writeAttribute" + attribute: "nullable_enum16" + arguments: + value: 65534 + + - label: "Read attribute NULLABLE_ENUM16 Max Value" + command: "readAttribute" + attribute: "nullable_enum16" + response: + value: 65534 + + - label: "Write attribute NULLABLE_ENUM16 Invalid Value" + command: "writeAttribute" + attribute: "nullable_enum16" + arguments: + value: 65535 + response: + error: 1 + + - label: "Read attribute NULLABLE_ENUM16 unchanged Value" + command: "readAttribute" + attribute: "nullable_enum16" + response: + value: 65534 + + - label: "Write attribute NULLABLE_ENUM16 null Value" + command: "writeAttribute" + attribute: "nullable_enum16" + arguments: + value: null + + - label: "Read attribute NULLABLE_ENUM16 null Value" + command: "readAttribute" + attribute: "nullable_enum16" + response: + value: null + + # Tests for Octet String attribute + + - label: "Read attribute NULLABLE_OCTET_STRING Default Value" + command: "readAttribute" + attribute: "nullable_octet_string" + response: + value: "" + + - label: "Write attribute NULLABLE_OCTET_STRING" + command: "writeAttribute" + attribute: "nullable_octet_string" + arguments: + value: "TestValue" + + - label: "Read attribute NULLABLE_OCTET_STRING" + command: "readAttribute" + attribute: "nullable_octet_string" + response: + value: "TestValue" + + - label: "Write attribute NULLABLE_OCTET_STRING" + command: "writeAttribute" + attribute: "nullable_octet_string" + arguments: + value: null + + - label: "Read attribute NULLABLE_OCTET_STRING" + command: "readAttribute" + attribute: "nullable_octet_string" + response: + value: null + + - label: "Write attribute NULLABLE_OCTET_STRING" + command: "writeAttribute" + attribute: "nullable_octet_string" + arguments: + value: "" + + - label: "Read attribute NULLABLE_OCTET_STRING" + command: "readAttribute" + attribute: "nullable_octet_string" + response: + value: "" + + # Tests for Char String attribute + + - label: "Read attribute NULLABLE_CHAR_STRING Default Value" + command: "readAttribute" + attribute: "nullable_char_string" + response: + value: "" + + - label: "Write attribute NULLABLE_CHAR_STRING" + command: "writeAttribute" + attribute: "nullable_char_string" + arguments: + value: "☉T☉" + + - label: "Read attribute NULLABLE_CHAR_STRING" + command: "readAttribute" + attribute: "nullable_char_string" + disabled: true + response: + value: "☉T☉" + + - label: "Write attribute NULLABLE_CHAR_STRING - Value too long" + command: "writeAttribute" + attribute: "nullable_char_string" + arguments: + value: null + + - label: "Read attribute NULLABLE_CHAR_STRING" + command: "readAttribute" + attribute: "nullable_char_string" + response: + value: null + + - label: "Write attribute NULLABLE_CHAR_STRING - Empty" + command: "writeAttribute" + attribute: "nullable_char_string" + arguments: + value: "" + + - label: "Read attribute NULLABLE_CHAR_STRING" + command: "readAttribute" + attribute: "nullable_char_string" + response: + value: "" diff --git a/src/app/util/af-types.h b/src/app/util/af-types.h index 4c81c8c219ba7b..570a77d0a508ef 100644 --- a/src/app/util/af-types.h +++ b/src/app/util/af-types.h @@ -164,12 +164,31 @@ union EmberAfDefaultOrMinMaxAttributeValue EmberAfAttributeMinMaxValue * ptrToMinMaxValue; }; +// Attribute masks modify how attributes are used by the framework +// +// Attribute that has this mask is NOT read-only +#define ATTRIBUTE_MASK_WRITABLE (0x01) +// Attribute that has this mask is saved to a token +#define ATTRIBUTE_MASK_TOKENIZE (0x02) +// Attribute that has this mask has a min/max values +#define ATTRIBUTE_MASK_MIN_MAX (0x04) +// Manufacturer specific attribute +#define ATTRIBUTE_MASK_MANUFACTURER_SPECIFIC (0x08) +// Attribute deferred to external storage +#define ATTRIBUTE_MASK_EXTERNAL_STORAGE (0x10) +// Attribute is singleton +#define ATTRIBUTE_MASK_SINGLETON (0x20) +// Attribute is a client attribute +#define ATTRIBUTE_MASK_CLIENT (0x40) +// Attribute is nullable +#define ATTRIBUTE_MASK_NULLABLE (0x80) + /** * @brief Each attribute has it's metadata stored in such struct. * * There is only one of these per attribute across all endpoints. */ -typedef struct +struct EmberAfAttributeMetadata { /** * Attribute ID, according to ZCL specs. @@ -185,8 +204,7 @@ typedef struct uint16_t size; /** * Attribute mask, tagging attribute with specific - * functionality. See ATTRIBUTE_MASK_ macros defined - * in att-storage.h. + * functionality. */ EmberAfAttributeMask mask; /** @@ -194,7 +212,12 @@ typedef struct * depends on the mask. */ EmberAfDefaultOrMinMaxAttributeValue defaultValue; -} EmberAfAttributeMetadata; + + /** + * Check whether this attribute is nullable. + */ + bool IsNullable() const { return mask & ATTRIBUTE_MASK_NULLABLE; } +}; /** * @brief Struct describing cluster diff --git a/src/app/util/attribute-storage-helpers.h b/src/app/util/attribute-storage-helpers.h new file mode 100644 index 00000000000000..f748d364ed1a09 --- /dev/null +++ b/src/app/util/attribute-storage-helpers.h @@ -0,0 +1,75 @@ +/* + * + * 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. + */ + +/** + * Helpers for manipulating values that are going into and out of the attribute + * store. + */ + +#pragma once + +#include + +#include + +namespace chip { +namespace app { + +template +struct NumericAttributeTraits +{ + // StorageType is the type used to represent this C++ type in the attribute + // store. + using StorageType = T; + + // The value reserved in the value space of StorageType to represent null, + // for cases when we have a nullable value. + static constexpr StorageType kNullValue = + std::is_signed::value ? std::numeric_limits::min() : std::numeric_limits::max(); + + static constexpr bool IsNullValue(StorageType value) { return value == kNullValue; } + + // Test whether a value can be represented in a "not null" value of the + // given type, which may be a nullable value or not. This needs to be + // implemented for both T and StorageType if the two are distinct. + static constexpr bool CanRepresentValue(bool isNullable, T value) + { + // For now, allow the null-marker value for non-nullable types. It's + // not what the spec says to do at the moment, but that might well + // change, and we have quite a number of tests relying on this behavior + // for now that we should only change once the spec really decides what + // it's doing. + return !isNullable || !IsNullValue(value); + } +}; + +template <> +struct NumericAttributeTraits +{ + using StorageType = uint8_t; + static constexpr StorageType kNullValue = 0xFF; + static constexpr bool IsNullValue(StorageType value) { return value == kNullValue; } + static constexpr bool CanRepresentValue(bool isNullable, StorageType value) + { + // This treats all nonzero values (except the null value) as true. + return !IsNullValue(value); + } + static constexpr bool CanRepresentValue(bool isNullable, bool value) { return true; } +}; + +} // namespace app +} // namespace chip diff --git a/src/app/util/ember-compatibility-functions.cpp b/src/app/util/ember-compatibility-functions.cpp index 450fe340d4f5c0..14e7d6859356b8 100644 --- a/src/app/util/ember-compatibility-functions.cpp +++ b/src/app/util/ember-compatibility-functions.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -45,6 +46,8 @@ #include +#include + using namespace chip; using namespace chip::app; using namespace chip::app::Compatibility; @@ -178,7 +181,27 @@ void ResetEmberAfObjects() namespace { // Common buffer for ReadSingleClusterData & WriteSingleClusterData uint8_t attributeData[kAttributeReadBufferSize]; -} // namespace + +template +CHIP_ERROR attributeBufferToNumericTlvData(TLV::TLVWriter & writer, bool isNullable) +{ + typename NumericAttributeTraits::StorageType value; + memcpy(&value, attributeData, sizeof(value)); + TLV::Tag tag = TLV::ContextTag(to_underlying(AttributeDataIB::Tag::kData)); + if (isNullable && NumericAttributeTraits::IsNullValue(value)) + { + return writer.PutNull(tag); + } + + if (!NumericAttributeTraits::CanRepresentValue(isNullable, value)) + { + return CHIP_ERROR_INCORRECT_STATE; + } + + return writer.Put(tag, static_cast(value)); +} + +} // anonymous namespace bool ServerClusterCommandExists(const ConcreteCommandPath & aCommandPath) { @@ -227,123 +250,151 @@ CHIP_ERROR ReadSingleClusterData(FabricIndex aAccessingFabricIndex, const Concre } } - EmberAfAttributeType attributeType; - EmberAfStatus emberStatus = EMBER_ZCL_STATUS_SUCCESS; - emberStatus = emberAfReadAttribute(aPath.mEndpointId, aPath.mClusterId, aPath.mAttributeId, CLUSTER_MASK_SERVER, attributeData, - sizeof(attributeData), &attributeType); + EmberAfAttributeMetadata * metadata = NULL; + EmberAfAttributeSearchRecord record; + record.endpoint = aPath.mEndpointId; + record.clusterId = aPath.mClusterId; + record.clusterMask = CLUSTER_MASK_SERVER; + record.attributeId = aPath.mAttributeId; + record.manufacturerCode = EMBER_AF_NULL_MANUFACTURER_CODE; + EmberAfStatus emberStatus = emAfReadOrWriteAttribute(&record, &metadata, attributeData, sizeof(attributeData), + /* write = */ false); if (emberStatus == EMBER_ZCL_STATUS_SUCCESS) { - writer = attributeDataIBBuilder.GetWriter(); + EmberAfAttributeType attributeType = metadata->attributeType; + bool isNullable = metadata->IsNullable(); + writer = attributeDataIBBuilder.GetWriter(); VerifyOrReturnError(writer != nullptr, CHIP_NO_ERROR); - // TODO: ZCL_STRUCT_ATTRIBUTE_TYPE is not included in this switch case currently, should add support for structures. + TLV::Tag tag = TLV::ContextTag(to_underlying(AttributeDataIB::Tag::kData)); switch (BaseType(attributeType)) { case ZCL_NO_DATA_ATTRIBUTE_TYPE: // No data - ReturnErrorOnFailure(writer->PutNull(TLV::ContextTag(to_underlying(AttributeDataIB::Tag::kData)))); + ReturnErrorOnFailure(writer->PutNull(tag)); break; case ZCL_BOOLEAN_ATTRIBUTE_TYPE: // Boolean - ReturnErrorOnFailure( - writer->PutBoolean(TLV::ContextTag(to_underlying(AttributeDataIB::Tag::kData)), !!attributeData[0])); + ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); break; case ZCL_INT8U_ATTRIBUTE_TYPE: // Unsigned 8-bit integer - ReturnErrorOnFailure(writer->Put(TLV::ContextTag(to_underlying(AttributeDataIB::Tag::kData)), attributeData[0])); + ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); break; case ZCL_INT16U_ATTRIBUTE_TYPE: // Unsigned 16-bit integer { - uint16_t uint16_data; - memcpy(&uint16_data, attributeData, sizeof(uint16_data)); - ReturnErrorOnFailure(writer->Put(TLV::ContextTag(to_underlying(AttributeDataIB::Tag::kData)), uint16_data)); + ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); break; } case ZCL_INT32U_ATTRIBUTE_TYPE: // Unsigned 32-bit integer { - uint32_t uint32_data; - memcpy(&uint32_data, attributeData, sizeof(uint32_data)); - ReturnErrorOnFailure(writer->Put(TLV::ContextTag(to_underlying(AttributeDataIB::Tag::kData)), uint32_data)); + ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); break; } case ZCL_INT64U_ATTRIBUTE_TYPE: // Unsigned 64-bit integer { - uint64_t uint64_data; - memcpy(&uint64_data, attributeData, sizeof(uint64_data)); - ReturnErrorOnFailure(writer->Put(TLV::ContextTag(to_underlying(AttributeDataIB::Tag::kData)), uint64_data)); + ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); break; } case ZCL_INT8S_ATTRIBUTE_TYPE: // Signed 8-bit integer { - int8_t int8_data; - memcpy(&int8_data, attributeData, sizeof(int8_data)); - ReturnErrorOnFailure(writer->Put(TLV::ContextTag(to_underlying(AttributeDataIB::Tag::kData)), int8_data)); + ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); break; } case ZCL_INT16S_ATTRIBUTE_TYPE: // Signed 16-bit integer { - int16_t int16_data; - memcpy(&int16_data, attributeData, sizeof(int16_data)); - ReturnErrorOnFailure(writer->Put(TLV::ContextTag(to_underlying(AttributeDataIB::Tag::kData)), int16_data)); + ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); break; } case ZCL_INT32S_ATTRIBUTE_TYPE: // Signed 32-bit integer { - int32_t int32_data; - memcpy(&int32_data, attributeData, sizeof(int32_data)); - ReturnErrorOnFailure(writer->Put(TLV::ContextTag(to_underlying(AttributeDataIB::Tag::kData)), int32_data)); + ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); break; } case ZCL_INT64S_ATTRIBUTE_TYPE: // Signed 64-bit integer { - int64_t int64_data; - memcpy(&int64_data, attributeData, sizeof(int64_data)); - ReturnErrorOnFailure(writer->Put(TLV::ContextTag(to_underlying(AttributeDataIB::Tag::kData)), int64_data)); + ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); break; } case ZCL_CHAR_STRING_ATTRIBUTE_TYPE: // Char string { char * actualData = reinterpret_cast(attributeData + 1); uint8_t dataLength = attributeData[0]; - if (dataLength == 0xFF /* invalid data, put empty value instead */) + if (dataLength == 0xFF) + { + if (isNullable) + { + ReturnErrorOnFailure(writer->PutNull(tag)); + } + else + { + return CHIP_ERROR_INCORRECT_STATE; + } + } + else { - dataLength = 0; + ReturnErrorOnFailure(writer->PutString(tag, actualData, dataLength)); } - ReturnErrorOnFailure( - writer->PutString(TLV::ContextTag(to_underlying(AttributeDataIB::Tag::kData)), actualData, dataLength)); break; } case ZCL_LONG_CHAR_STRING_ATTRIBUTE_TYPE: { char * actualData = reinterpret_cast(attributeData + 2); // The pascal string contains 2 bytes length uint16_t dataLength; memcpy(&dataLength, attributeData, sizeof(dataLength)); - if (dataLength == 0xFFFF /* invalid data, put empty value instead */) + if (dataLength == 0xFFFF) + { + if (isNullable) + { + ReturnErrorOnFailure(writer->PutNull(tag)); + } + else + { + return CHIP_ERROR_INCORRECT_STATE; + } + } + else { - dataLength = 0; + ReturnErrorOnFailure(writer->PutString(tag, actualData, dataLength)); } - ReturnErrorOnFailure( - writer->PutString(TLV::ContextTag(to_underlying(AttributeDataIB::Tag::kData)), actualData, dataLength)); break; } case ZCL_OCTET_STRING_ATTRIBUTE_TYPE: // Octet string { uint8_t * actualData = attributeData + 1; uint8_t dataLength = attributeData[0]; - if (dataLength == 0xFF /* invalid data, put empty value instead */) + if (dataLength == 0xFF) + { + if (isNullable) + { + ReturnErrorOnFailure(writer->PutNull(tag)); + } + else + { + return CHIP_ERROR_INCORRECT_STATE; + } + } + else { - dataLength = 0; + ReturnErrorOnFailure(writer->Put(tag, chip::ByteSpan(actualData, dataLength))); } - ReturnErrorOnFailure( - writer->Put(TLV::ContextTag(to_underlying(AttributeDataIB::Tag::kData)), chip::ByteSpan(actualData, dataLength))); break; } case ZCL_LONG_OCTET_STRING_ATTRIBUTE_TYPE: { uint8_t * actualData = attributeData + 2; // The pascal string contains 2 bytes length uint16_t dataLength; memcpy(&dataLength, attributeData, sizeof(dataLength)); - if (dataLength == 0xFFFF /* invalid data, put empty value instead */) + if (dataLength == 0xFFFF) + { + if (isNullable) + { + ReturnErrorOnFailure(writer->PutNull(tag)); + } + else + { + return CHIP_ERROR_INCORRECT_STATE; + } + } + else { - dataLength = 0; + ReturnErrorOnFailure(writer->Put(tag, chip::ByteSpan(actualData, dataLength))); } - ReturnErrorOnFailure( - writer->Put(TLV::ContextTag(to_underlying(AttributeDataIB::Tag::kData)), chip::ByteSpan(actualData, dataLength))); break; } case ZCL_ARRAY_ATTRIBUTE_TYPE: { @@ -400,63 +451,90 @@ CHIP_ERROR ReadSingleClusterData(FabricIndex aAccessingFabricIndex, const Concre } namespace { + template -CHIP_ERROR numericTlvDataToAttributeBuffer(TLV::TLVReader & aReader, uint16_t & dataLen) +CHIP_ERROR numericTlvDataToAttributeBuffer(TLV::TLVReader & aReader, bool isNullable, uint16_t & dataLen) { - T value; + typename NumericAttributeTraits::StorageType value; static_assert(sizeof(value) <= sizeof(attributeData), "Value cannot fit into attribute data"); - ReturnErrorOnFailure(aReader.Get(value)); + if (isNullable && aReader.GetType() == TLV::kTLVType_Null) + { + value = NumericAttributeTraits::kNullValue; + } + else + { + T val; + ReturnErrorOnFailure(aReader.Get(val)); + VerifyOrReturnError(NumericAttributeTraits::CanRepresentValue(isNullable, val), CHIP_ERROR_INVALID_ARGUMENT); + value = val; + } dataLen = sizeof(value); memcpy(attributeData, &value, sizeof(value)); return CHIP_NO_ERROR; } + template -CHIP_ERROR stringTlvDataToAttributeBuffer(TLV::TLVReader & aReader, uint16_t & dataLen) +CHIP_ERROR stringTlvDataToAttributeBuffer(TLV::TLVReader & aReader, bool isOctetString, bool isNullable, uint16_t & dataLen) { const uint8_t * data = nullptr; T len; - VerifyOrReturnError(aReader.GetType() == TLV::TLVType::kTLVType_ByteString || - aReader.GetType() == TLV::TLVType::kTLVType_UTF8String, - CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrReturnError(CanCastTo(aReader.GetLength()), CHIP_ERROR_MESSAGE_TOO_LONG); - ReturnErrorOnFailure(aReader.GetDataPtr(data)); - len = static_cast(aReader.GetLength()); - VerifyOrReturnError(len + sizeof(len) /* length at the beginning of data */ <= sizeof(attributeData), - CHIP_ERROR_MESSAGE_TOO_LONG); - memcpy(&attributeData[0], &len, sizeof(len)); - memcpy(&attributeData[sizeof(len)], data, len); - dataLen = static_cast(len + sizeof(len)); + if (isNullable && aReader.GetType() == TLV::kTLVType_Null) + { + // Null is represented by an 0xFF or 0xFFFF length, respectively. + len = std::numeric_limits::max(); + memcpy(&attributeData[0], &len, sizeof(len)); + dataLen = sizeof(len); + } + else + { + VerifyOrReturnError((isOctetString && aReader.GetType() == TLV::TLVType::kTLVType_ByteString) || + (!isOctetString && aReader.GetType() == TLV::TLVType::kTLVType_UTF8String), + CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnError(CanCastTo(aReader.GetLength()), CHIP_ERROR_MESSAGE_TOO_LONG); + ReturnErrorOnFailure(aReader.GetDataPtr(data)); + len = static_cast(aReader.GetLength()); + VerifyOrReturnError(len != std::numeric_limits::max(), CHIP_ERROR_MESSAGE_TOO_LONG); + VerifyOrReturnError(len + sizeof(len) /* length at the beginning of data */ <= sizeof(attributeData), + CHIP_ERROR_MESSAGE_TOO_LONG); + memcpy(&attributeData[0], &len, sizeof(len)); + memcpy(&attributeData[sizeof(len)], data, len); + dataLen = static_cast(len + sizeof(len)); + } return CHIP_NO_ERROR; } -CHIP_ERROR prepareWriteData(EmberAfAttributeType expectedType, TLV::TLVReader & aReader, uint16_t & dataLen) +CHIP_ERROR prepareWriteData(const EmberAfAttributeMetadata * metadata, TLV::TLVReader & aReader, uint16_t & dataLen) { - switch (BaseType(expectedType)) + EmberAfAttributeType expectedType = BaseType(metadata->attributeType); + bool isNullable = metadata->IsNullable(); + switch (expectedType) { case ZCL_BOOLEAN_ATTRIBUTE_TYPE: // Boolean - return numericTlvDataToAttributeBuffer(aReader, dataLen); + return numericTlvDataToAttributeBuffer(aReader, isNullable, dataLen); case ZCL_INT8U_ATTRIBUTE_TYPE: // Unsigned 8-bit integer - return numericTlvDataToAttributeBuffer(aReader, dataLen); + return numericTlvDataToAttributeBuffer(aReader, isNullable, dataLen); case ZCL_INT16U_ATTRIBUTE_TYPE: // Unsigned 16-bit integer - return numericTlvDataToAttributeBuffer(aReader, dataLen); + return numericTlvDataToAttributeBuffer(aReader, isNullable, dataLen); case ZCL_INT32U_ATTRIBUTE_TYPE: // Unsigned 32-bit integer - return numericTlvDataToAttributeBuffer(aReader, dataLen); + return numericTlvDataToAttributeBuffer(aReader, isNullable, dataLen); case ZCL_INT64U_ATTRIBUTE_TYPE: // Unsigned 64-bit integer - return numericTlvDataToAttributeBuffer(aReader, dataLen); + return numericTlvDataToAttributeBuffer(aReader, isNullable, dataLen); case ZCL_INT8S_ATTRIBUTE_TYPE: // Signed 8-bit integer - return numericTlvDataToAttributeBuffer(aReader, dataLen); + return numericTlvDataToAttributeBuffer(aReader, isNullable, dataLen); case ZCL_INT16S_ATTRIBUTE_TYPE: // Signed 16-bit integer - return numericTlvDataToAttributeBuffer(aReader, dataLen); + return numericTlvDataToAttributeBuffer(aReader, isNullable, dataLen); case ZCL_INT32S_ATTRIBUTE_TYPE: // Signed 32-bit integer - return numericTlvDataToAttributeBuffer(aReader, dataLen); + return numericTlvDataToAttributeBuffer(aReader, isNullable, dataLen); case ZCL_INT64S_ATTRIBUTE_TYPE: // Signed 64-bit integer - return numericTlvDataToAttributeBuffer(aReader, dataLen); + return numericTlvDataToAttributeBuffer(aReader, isNullable, dataLen); case ZCL_OCTET_STRING_ATTRIBUTE_TYPE: // Octet string case ZCL_CHAR_STRING_ATTRIBUTE_TYPE: // Char string - return stringTlvDataToAttributeBuffer(aReader, dataLen); + return stringTlvDataToAttributeBuffer(aReader, expectedType == ZCL_OCTET_STRING_ATTRIBUTE_TYPE, isNullable, + dataLen); case ZCL_LONG_OCTET_STRING_ATTRIBUTE_TYPE: // Long octet string case ZCL_LONG_CHAR_STRING_ATTRIBUTE_TYPE: // Long char string - return stringTlvDataToAttributeBuffer(aReader, dataLen); + return stringTlvDataToAttributeBuffer(aReader, expectedType == ZCL_LONG_OCTET_STRING_ATTRIBUTE_TYPE, isNullable, + dataLen); default: ChipLogError(DataManagement, "Attribute type %x not handled", static_cast(expectedType)); return CHIP_ERROR_INVALID_DATA_LIST; @@ -479,9 +557,9 @@ static Protocols::InteractionModel::Status WriteSingleClusterDataInternal(Cluste CHIP_ERROR preparationError = CHIP_NO_ERROR; uint16_t dataLen = 0; - if ((preparationError = prepareWriteData(attributeMetadata->attributeType, aReader, dataLen)) != CHIP_NO_ERROR) + if ((preparationError = prepareWriteData(attributeMetadata, aReader, dataLen)) != CHIP_NO_ERROR) { - ChipLogDetail(Zcl, "Failed to preapre data to write: %s", ErrorStr(preparationError)); + ChipLogDetail(Zcl, "Failed to prepare data to write: %s", ErrorStr(preparationError)); return Protocols::InteractionModel::Status::InvalidValue; } diff --git a/src/app/zap-templates/common/attributes/Accessors.js b/src/app/zap-templates/common/attributes/Accessors.js index 84433c7abb5a84..d151c6935a92a0 100644 --- a/src/app/zap-templates/common/attributes/Accessors.js +++ b/src/app/zap-templates/common/attributes/Accessors.js @@ -15,9 +15,11 @@ * limitations under the License. */ +const zapPath = '../../../../../third_party/zap/repo/dist/src-electron/'; const ListHelper = require('../../common/ListHelper.js'); const StringHelper = require('../../common/StringHelper.js'); const StructHelper = require('../../common/StructHelper.js'); +const zclHelper = require(zapPath + 'generator/helper-zcl.js') // Issue #8202 // The specification allow non-standard signed and unsigned integer with a width of 24, 40, 48 or 56, but those types does not have @@ -29,24 +31,52 @@ function isUnsupportedType(type) return unsupportedTypes.includes(type.toUpperCase()); } -function canHaveSimpleAccessors(type) +function canHaveSimpleAccessors(attr) { - if (ListHelper.isList(type)) { + if (attr.isArray || attr.isList) { return false; } - if (StructHelper.isStruct(type)) { + if (ListHelper.isList(attr.type)) { return false; } - if (isUnsupportedType(type)) { + if (StructHelper.isStruct(attr.type)) { + return false; + } + + if (isUnsupportedType(attr.type)) { return false; } return true; } +async function accessorGetterType(attr) +{ + let type; + let mayNeedPointer = false; + if (StringHelper.isCharString(attr.type)) { + type = "chip::MutableCharSpan"; + } else if (StringHelper.isOctetString(attr.type)) { + type = "chip::MutableByteSpan"; + } else { + mayNeedPointer = true; + const options = { 'hash' : {} }; + type = await zclHelper.asUnderlyingZclType.call(this, attr.type, options); + } + + if (attr.isNullable) { + type = `DataModel::Nullable<${type}> &`; + } else if (mayNeedPointer) { + type = `${type} *`; + } + + return type; +} + // // Module exports // exports.canHaveSimpleAccessors = canHaveSimpleAccessors; +exports.accessorGetterType = accessorGetterType; diff --git a/src/app/zap-templates/templates/app/att-storage.zapt b/src/app/zap-templates/templates/app/att-storage.zapt index dae7ad9d189509..b01f99a390eefe 100644 --- a/src/app/zap-templates/templates/app/att-storage.zapt +++ b/src/app/zap-templates/templates/app/att-storage.zapt @@ -3,25 +3,6 @@ // Prevent multiple inclusion #pragma once -// Attribute masks modify how attributes are used by the framework -// -// Attribute that has this mask is NOT read-only -#define ATTRIBUTE_MASK_WRITABLE (0x01) -// Attribute that has this mask is saved to a token -#define ATTRIBUTE_MASK_TOKENIZE (0x02) -// Attribute that has this mask has a min/max values -#define ATTRIBUTE_MASK_MIN_MAX (0x04) -// Manufacturer specific attribute -#define ATTRIBUTE_MASK_MANUFACTURER_SPECIFIC (0x08) -// Attribute deferred to external storage -#define ATTRIBUTE_MASK_EXTERNAL_STORAGE (0x10) -// Attribute is singleton -#define ATTRIBUTE_MASK_SINGLETON (0x20) -// Attribute is a client attribute -#define ATTRIBUTE_MASK_CLIENT (0x40) -// Attribute is nullable -#define ATTRIBUTE_MASK_NULLABLE (0x80) - // Cluster masks modify how clusters are used by the framework // // Does this cluster have init function? diff --git a/src/app/zap-templates/templates/app/attributes/Accessors-src.zapt b/src/app/zap-templates/templates/app/attributes/Accessors-src.zapt index 644b35310bc529..134c0612746481 100644 --- a/src/app/zap-templates/templates/app/attributes/Accessors-src.zapt +++ b/src/app/zap-templates/templates/app/attributes/Accessors-src.zapt @@ -11,6 +11,7 @@ #include #include #include +#include namespace chip { namespace app { @@ -25,39 +26,102 @@ namespace Attributes { {{/first}} {{#if clusterRef}} -{{#if (canHaveSimpleAccessors type)}} +{{#if (canHaveSimpleAccessors this)}} namespace {{asUpperCamelCase label}} { {{#*inline "clusterId"}}Clusters::{{asUpperCamelCase parent.label}}::Id{{/inline}} {{#*inline "sizingBytes"}}{{#if (isShortString type)}}1{{else}}2{{/if}}{{/inline}} -EmberAfStatus Get(chip::EndpointId endpoint, {{#if (isCharString type)}}chip::MutableCharSpan{{else if (isOctetString type)}}chip::MutableByteSpan{{else}}{{asUnderlyingZclType type}} *{{/if}} value) +EmberAfStatus Get(chip::EndpointId endpoint, {{accessorGetterType this}} value) { - {{#if (isString type)}} - VerifyOrReturnError(value.size() == {{maxLength}}, EMBER_ZCL_STATUS_INVALID_ARGUMENT); + {{~#if (isString type)}} + {{~#*inline "lengthType"}}uint{{#if (isShortString type)}}8{{else}}16{{/if}}_t{{/inline}} uint8_t zclString[{{maxLength}} + {{>sizingBytes}}]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, {{>clusterId}}, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - memcpy(value.data(), &zclString[{{>sizingBytes}}], {{maxLength}}); - value.reduce_size(emberAf{{#if (isLongString type)}}Long{{/if}}StringLength(zclString)); + size_t length = emberAf{{#if (isLongString type)}}Long{{/if}}StringLength(zclString); + if (length == NumericAttributeTraits<{{>lengthType}}>::kNullValue) + { + {{#if isNullable}} + value.SetNull(); + return EMBER_ZCL_STATUS_SUCCESS; + {{else}} + return EMBER_ZCL_STATUS_INVALID_VALUE; + {{/if}} + } + {{#if isNullable}} + auto & span = value.SetNonNull(); + {{/if}} + {{~#*inline "value"}}{{#if isNullable}}span{{else}}value{{/if}}{{/inline}} + VerifyOrReturnError({{>value}}.size() == {{maxLength}}, EMBER_ZCL_STATUS_INVALID_ARGUMENT); + memcpy({{>value}}.data(), &zclString[{{>sizingBytes}}], {{maxLength}}); + {{>value}}.reduce_size(length); return status; {{else}} - return emberAfReadServerAttribute(endpoint, {{>clusterId}}, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits<{{asUnderlyingZclType type}}>::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, {{>clusterId}}, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + {{#if isNullable}} + if (NumericAttributeTraits<{{asUnderlyingZclType type}}>::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = temp; + } + {{else}} + if (!NumericAttributeTraits<{{asUnderlyingZclType type}}>::CanRepresentValue(/* isNullable = */ {{isNullable}}, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + {{/if}} + return status; {{/if}} } EmberAfStatus Set(chip::EndpointId endpoint, {{asUnderlyingZclType type}} value) { - {{#if (isString type)}} + {{~#if (isString type)}} + {{~#*inline "lengthType"}}uint{{#if (isShortString type)}}8{{else}}16{{/if}}_t{{/inline}} + static_assert({{maxLength}} != NumericAttributeTraits<{{>lengthType}}>::kNullValue, + "value.size() might be too big"); VerifyOrReturnError(value.size() <= {{maxLength}}, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[{{maxLength}} + {{>sizingBytes}}]; - emberAfCopyInt{{#if (isShortString type)}}8{{else}}16{{/if}}u(zclString, 0, static_cast(value.size())); + emberAfCopyInt{{#if (isShortString type)}}8{{else}}16{{/if}}u(zclString, 0, static_cast<{{>lengthType}}>(value.size())); memcpy(&zclString[{{>sizingBytes}}], value.data(), value.size()); return emberAfWriteServerAttribute(endpoint, {{>clusterId}}, Id, zclString, ZCL_{{asDelimitedMacro type}}_ATTRIBUTE_TYPE); {{else}} + if (!NumericAttributeTraits<{{asUnderlyingZclType type}}>::CanRepresentValue(/* isNullable = */ {{isNullable}}, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, {{>clusterId}}, Id, (uint8_t *) &value, ZCL_{{asDelimitedMacro type}}_ATTRIBUTE_TYPE); {{/if}} } +{{#if isNullable}} +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + {{#if (isString type)}} + uint8_t zclString[{{>sizingBytes}}] = { {{#if (isShortString type)}}0xFF{{else}}0xFF, 0xFF{{/if}} }; + return emberAfWriteServerAttribute(endpoint, {{>clusterId}}, Id, zclString, ZCL_{{asDelimitedMacro type}}_ATTRIBUTE_TYPE); + {{else}} + auto value = NumericAttributeTraits<{{asUnderlyingZclType type}}>::kNullValue; + return emberAfWriteServerAttribute(endpoint, {{>clusterId}}, Id, reinterpret_cast(&value), ZCL_{{asDelimitedMacro type}}_ATTRIBUTE_TYPE); + {{/if}} +} + +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable<{{asUnderlyingZclType type}}> & value) +{ + if (value.IsNull()) { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} +{{/if}} + } // namespace {{asUpperCamelCase label}} {{/if}} diff --git a/src/app/zap-templates/templates/app/attributes/Accessors.zapt b/src/app/zap-templates/templates/app/attributes/Accessors.zapt index 232f77fad1c884..f8c7147620e642 100644 --- a/src/app/zap-templates/templates/app/attributes/Accessors.zapt +++ b/src/app/zap-templates/templates/app/attributes/Accessors.zapt @@ -7,6 +7,7 @@ #pragma once +#include #include #include @@ -23,10 +24,14 @@ namespace Attributes { {{/first}} {{#if clusterRef}} -{{#if (canHaveSimpleAccessors type)}} +{{#if (canHaveSimpleAccessors this)}} namespace {{asUpperCamelCase label}} { -EmberAfStatus Get(chip::EndpointId endpoint, {{#if (isCharString type)}}chip::MutableCharSpan{{else if (isOctetString type)}}chip::MutableByteSpan{{else}}{{asUnderlyingZclType type}} *{{/if}} value); // {{type}} {{isArray}} +EmberAfStatus Get(chip::EndpointId endpoint, {{accessorGetterType this}} value); // {{type}} {{isArray}} EmberAfStatus Set(chip::EndpointId endpoint, {{asUnderlyingZclType type}} value); +{{#if isNullable}} +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable<{{asUnderlyingZclType type}}> & value); +{{/if}} } // namespace {{asUpperCamelCase label}} {{/if}} diff --git a/src/app/zap-templates/zcl/data-model/chip/test-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/test-cluster.xml index f9967fd5f1c3da..64b229ef1f5799 100644 --- a/src/app/zap-templates/zcl/data-model/chip/test-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/test-cluster.xml @@ -141,6 +141,34 @@ limitations under the License. attribute types in ZAP --> + nullable_boolean + nullable_bitmap8 + nullable_bitmap16 + nullable_bitmap32 + nullable_bitmap64 + nullable_int8u + nullable_int16u + + nullable_int32u + + + + nullable_int64u + nullable_int8s + nullable_int16s + + nullable_int32s + + + + nullable_int64s + nullable_enum8 + nullable_enum16 + + + nullable_octet_string + nullable_char_string + unsupported diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap index 735732b7f995e9..0b745aa3113989 100644 --- a/src/controller/data_model/controller-clusters.zap +++ b/src/controller/data_model/controller-clusters.zap @@ -11880,6 +11880,261 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "nullable_boolean", + "code": 32768, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "false", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_bitmap8", + "code": 32769, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_bitmap16", + "code": 32770, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_bitmap32", + "code": 32771, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_bitmap64", + "code": 32772, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_int8u", + "code": 32773, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_int16u", + "code": 32774, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_int32u", + "code": 32776, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_int64u", + "code": 32780, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_int8s", + "code": 32781, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_int16s", + "code": 32782, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_int32s", + "code": 32784, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_int64s", + "code": 32788, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_enum8", + "code": 32789, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_enum16", + "code": 32790, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_octet_string", + "code": 32793, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_char_string", + "code": 32798, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ClusterRevision", "code": 65533, diff --git a/src/controller/java/zap-generated/CHIPClusters-JNI.cpp b/src/controller/java/zap-generated/CHIPClusters-JNI.cpp index 6e0e2defc8b83b..d864242bd2721e 100644 --- a/src/controller/java/zap-generated/CHIPClusters-JNI.cpp +++ b/src/controller/java/zap-generated/CHIPClusters-JNI.cpp @@ -16925,6 +16925,537 @@ JNI_METHOD(void, TestClusterCluster, writeUnsupportedAttribute) onSuccess.release(); onFailure.release(); } + +JNI_METHOD(void, TestClusterCluster, writeNullableBooleanAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jboolean value) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->WriteAttributeNullableBoolean(onSuccess->Cancel(), onFailure->Cancel(), static_cast(value)); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, writeNullableBitmap8Attribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint value) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->WriteAttributeNullableBitmap8(onSuccess->Cancel(), onFailure->Cancel(), static_cast(value)); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, writeNullableBitmap16Attribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint value) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->WriteAttributeNullableBitmap16(onSuccess->Cancel(), onFailure->Cancel(), static_cast(value)); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, writeNullableBitmap32Attribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jlong value) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->WriteAttributeNullableBitmap32(onSuccess->Cancel(), onFailure->Cancel(), static_cast(value)); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, writeNullableBitmap64Attribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jlong value) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->WriteAttributeNullableBitmap64(onSuccess->Cancel(), onFailure->Cancel(), static_cast(value)); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, writeNullableInt8uAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint value) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->WriteAttributeNullableInt8u(onSuccess->Cancel(), onFailure->Cancel(), static_cast(value)); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, writeNullableInt16uAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint value) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->WriteAttributeNullableInt16u(onSuccess->Cancel(), onFailure->Cancel(), static_cast(value)); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, writeNullableInt32uAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jlong value) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->WriteAttributeNullableInt32u(onSuccess->Cancel(), onFailure->Cancel(), static_cast(value)); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, writeNullableInt64uAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jlong value) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->WriteAttributeNullableInt64u(onSuccess->Cancel(), onFailure->Cancel(), static_cast(value)); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, writeNullableInt8sAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint value) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->WriteAttributeNullableInt8s(onSuccess->Cancel(), onFailure->Cancel(), static_cast(value)); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, writeNullableInt16sAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint value) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->WriteAttributeNullableInt16s(onSuccess->Cancel(), onFailure->Cancel(), static_cast(value)); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, writeNullableInt32sAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jlong value) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->WriteAttributeNullableInt32s(onSuccess->Cancel(), onFailure->Cancel(), static_cast(value)); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, writeNullableInt64sAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jlong value) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->WriteAttributeNullableInt64s(onSuccess->Cancel(), onFailure->Cancel(), static_cast(value)); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, writeNullableEnum8Attribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint value) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->WriteAttributeNullableEnum8(onSuccess->Cancel(), onFailure->Cancel(), static_cast(value)); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, writeNullableEnum16Attribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint value) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->WriteAttributeNullableEnum16(onSuccess->Cancel(), onFailure->Cancel(), static_cast(value)); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, writeNullableOctetStringAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jbyteArray value) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + JniByteArray jniArr(env, value); + err = cppCluster->WriteAttributeNullableOctetString(onSuccess->Cancel(), onFailure->Cancel(), + chip::ByteSpan((const uint8_t *) jniArr.data(), jniArr.size())); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, writeNullableCharStringAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jstring value) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + JniUtfString valueStr(env, value); + err = cppCluster->WriteAttributeNullableCharString(onSuccess->Cancel(), onFailure->Cancel(), + chip::CharSpan(valueStr.c_str(), strlen(valueStr.c_str()))); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(jlong, ThermostatCluster, initWithDevice)(JNIEnv * env, jobject self, jlong devicePtr, jint endpointId) { chip::DeviceLayer::StackLock lock; diff --git a/src/controller/java/zap-generated/CHIPClustersRead-JNI.cpp b/src/controller/java/zap-generated/CHIPClustersRead-JNI.cpp index cb8d29868fa139..a2bfb3cd2b01eb 100644 --- a/src/controller/java/zap-generated/CHIPClustersRead-JNI.cpp +++ b/src/controller/java/zap-generated/CHIPClustersRead-JNI.cpp @@ -10671,6 +10671,520 @@ JNI_METHOD(void, TestClusterCluster, readUnsupportedAttribute)(JNIEnv * env, job onFailure.release(); } +JNI_METHOD(void, TestClusterCluster, readNullableBooleanAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->ReadAttributeNullableBoolean(onSuccess->Cancel(), onFailure->Cancel()); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, readNullableBitmap8Attribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->ReadAttributeNullableBitmap8(onSuccess->Cancel(), onFailure->Cancel()); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, readNullableBitmap16Attribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->ReadAttributeNullableBitmap16(onSuccess->Cancel(), onFailure->Cancel()); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, readNullableBitmap32Attribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->ReadAttributeNullableBitmap32(onSuccess->Cancel(), onFailure->Cancel()); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, readNullableBitmap64Attribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->ReadAttributeNullableBitmap64(onSuccess->Cancel(), onFailure->Cancel()); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, readNullableInt8uAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->ReadAttributeNullableInt8u(onSuccess->Cancel(), onFailure->Cancel()); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, readNullableInt16uAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->ReadAttributeNullableInt16u(onSuccess->Cancel(), onFailure->Cancel()); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, readNullableInt32uAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->ReadAttributeNullableInt32u(onSuccess->Cancel(), onFailure->Cancel()); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, readNullableInt64uAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->ReadAttributeNullableInt64u(onSuccess->Cancel(), onFailure->Cancel()); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, readNullableInt8sAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->ReadAttributeNullableInt8s(onSuccess->Cancel(), onFailure->Cancel()); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, readNullableInt16sAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->ReadAttributeNullableInt16s(onSuccess->Cancel(), onFailure->Cancel()); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, readNullableInt32sAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->ReadAttributeNullableInt32s(onSuccess->Cancel(), onFailure->Cancel()); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, readNullableInt64sAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->ReadAttributeNullableInt64s(onSuccess->Cancel(), onFailure->Cancel()); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, readNullableEnum8Attribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->ReadAttributeNullableEnum8(onSuccess->Cancel(), onFailure->Cancel()); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, readNullableEnum16Attribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->ReadAttributeNullableEnum16(onSuccess->Cancel(), onFailure->Cancel()); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, readNullableOctetStringAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + chip::Platform::New(callback, true), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->ReadAttributeNullableOctetString(onSuccess->Cancel(), onFailure->Cancel()); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, readNullableCharStringAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + chip::Platform::New(callback, false), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->ReadAttributeNullableCharString(onSuccess->Cancel(), onFailure->Cancel()); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + JNI_METHOD(void, TestClusterCluster, readClusterRevisionAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { chip::DeviceLayer::StackLock lock; diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java index 6f5df3b2596994..b65c21be15754d 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java @@ -6415,6 +6415,142 @@ public void writeUnsupportedAttribute(DefaultClusterCallback callback, boolean v writeUnsupportedAttribute(chipClusterPtr, callback, value); } + public void readNullableBooleanAttribute(BooleanAttributeCallback callback) { + readNullableBooleanAttribute(chipClusterPtr, callback); + } + + public void writeNullableBooleanAttribute(DefaultClusterCallback callback, boolean value) { + writeNullableBooleanAttribute(chipClusterPtr, callback, value); + } + + public void readNullableBitmap8Attribute(IntegerAttributeCallback callback) { + readNullableBitmap8Attribute(chipClusterPtr, callback); + } + + public void writeNullableBitmap8Attribute(DefaultClusterCallback callback, int value) { + writeNullableBitmap8Attribute(chipClusterPtr, callback, value); + } + + public void readNullableBitmap16Attribute(IntegerAttributeCallback callback) { + readNullableBitmap16Attribute(chipClusterPtr, callback); + } + + public void writeNullableBitmap16Attribute(DefaultClusterCallback callback, int value) { + writeNullableBitmap16Attribute(chipClusterPtr, callback, value); + } + + public void readNullableBitmap32Attribute(LongAttributeCallback callback) { + readNullableBitmap32Attribute(chipClusterPtr, callback); + } + + public void writeNullableBitmap32Attribute(DefaultClusterCallback callback, long value) { + writeNullableBitmap32Attribute(chipClusterPtr, callback, value); + } + + public void readNullableBitmap64Attribute(LongAttributeCallback callback) { + readNullableBitmap64Attribute(chipClusterPtr, callback); + } + + public void writeNullableBitmap64Attribute(DefaultClusterCallback callback, long value) { + writeNullableBitmap64Attribute(chipClusterPtr, callback, value); + } + + public void readNullableInt8uAttribute(IntegerAttributeCallback callback) { + readNullableInt8uAttribute(chipClusterPtr, callback); + } + + public void writeNullableInt8uAttribute(DefaultClusterCallback callback, int value) { + writeNullableInt8uAttribute(chipClusterPtr, callback, value); + } + + public void readNullableInt16uAttribute(IntegerAttributeCallback callback) { + readNullableInt16uAttribute(chipClusterPtr, callback); + } + + public void writeNullableInt16uAttribute(DefaultClusterCallback callback, int value) { + writeNullableInt16uAttribute(chipClusterPtr, callback, value); + } + + public void readNullableInt32uAttribute(LongAttributeCallback callback) { + readNullableInt32uAttribute(chipClusterPtr, callback); + } + + public void writeNullableInt32uAttribute(DefaultClusterCallback callback, long value) { + writeNullableInt32uAttribute(chipClusterPtr, callback, value); + } + + public void readNullableInt64uAttribute(LongAttributeCallback callback) { + readNullableInt64uAttribute(chipClusterPtr, callback); + } + + public void writeNullableInt64uAttribute(DefaultClusterCallback callback, long value) { + writeNullableInt64uAttribute(chipClusterPtr, callback, value); + } + + public void readNullableInt8sAttribute(IntegerAttributeCallback callback) { + readNullableInt8sAttribute(chipClusterPtr, callback); + } + + public void writeNullableInt8sAttribute(DefaultClusterCallback callback, int value) { + writeNullableInt8sAttribute(chipClusterPtr, callback, value); + } + + public void readNullableInt16sAttribute(IntegerAttributeCallback callback) { + readNullableInt16sAttribute(chipClusterPtr, callback); + } + + public void writeNullableInt16sAttribute(DefaultClusterCallback callback, int value) { + writeNullableInt16sAttribute(chipClusterPtr, callback, value); + } + + public void readNullableInt32sAttribute(LongAttributeCallback callback) { + readNullableInt32sAttribute(chipClusterPtr, callback); + } + + public void writeNullableInt32sAttribute(DefaultClusterCallback callback, long value) { + writeNullableInt32sAttribute(chipClusterPtr, callback, value); + } + + public void readNullableInt64sAttribute(LongAttributeCallback callback) { + readNullableInt64sAttribute(chipClusterPtr, callback); + } + + public void writeNullableInt64sAttribute(DefaultClusterCallback callback, long value) { + writeNullableInt64sAttribute(chipClusterPtr, callback, value); + } + + public void readNullableEnum8Attribute(IntegerAttributeCallback callback) { + readNullableEnum8Attribute(chipClusterPtr, callback); + } + + public void writeNullableEnum8Attribute(DefaultClusterCallback callback, int value) { + writeNullableEnum8Attribute(chipClusterPtr, callback, value); + } + + public void readNullableEnum16Attribute(IntegerAttributeCallback callback) { + readNullableEnum16Attribute(chipClusterPtr, callback); + } + + public void writeNullableEnum16Attribute(DefaultClusterCallback callback, int value) { + writeNullableEnum16Attribute(chipClusterPtr, callback, value); + } + + public void readNullableOctetStringAttribute(OctetStringAttributeCallback callback) { + readNullableOctetStringAttribute(chipClusterPtr, callback); + } + + public void writeNullableOctetStringAttribute(DefaultClusterCallback callback, byte[] value) { + writeNullableOctetStringAttribute(chipClusterPtr, callback, value); + } + + public void readNullableCharStringAttribute(CharStringAttributeCallback callback) { + readNullableCharStringAttribute(chipClusterPtr, callback); + } + + public void writeNullableCharStringAttribute(DefaultClusterCallback callback, String value) { + writeNullableCharStringAttribute(chipClusterPtr, callback, value); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -6555,6 +6691,108 @@ private native void readUnsupportedAttribute( private native void writeUnsupportedAttribute( long chipClusterPtr, DefaultClusterCallback callback, boolean value); + private native void readNullableBooleanAttribute( + long chipClusterPtr, BooleanAttributeCallback callback); + + private native void writeNullableBooleanAttribute( + long chipClusterPtr, DefaultClusterCallback callback, boolean value); + + private native void readNullableBitmap8Attribute( + long chipClusterPtr, IntegerAttributeCallback callback); + + private native void writeNullableBitmap8Attribute( + long chipClusterPtr, DefaultClusterCallback callback, int value); + + private native void readNullableBitmap16Attribute( + long chipClusterPtr, IntegerAttributeCallback callback); + + private native void writeNullableBitmap16Attribute( + long chipClusterPtr, DefaultClusterCallback callback, int value); + + private native void readNullableBitmap32Attribute( + long chipClusterPtr, LongAttributeCallback callback); + + private native void writeNullableBitmap32Attribute( + long chipClusterPtr, DefaultClusterCallback callback, long value); + + private native void readNullableBitmap64Attribute( + long chipClusterPtr, LongAttributeCallback callback); + + private native void writeNullableBitmap64Attribute( + long chipClusterPtr, DefaultClusterCallback callback, long value); + + private native void readNullableInt8uAttribute( + long chipClusterPtr, IntegerAttributeCallback callback); + + private native void writeNullableInt8uAttribute( + long chipClusterPtr, DefaultClusterCallback callback, int value); + + private native void readNullableInt16uAttribute( + long chipClusterPtr, IntegerAttributeCallback callback); + + private native void writeNullableInt16uAttribute( + long chipClusterPtr, DefaultClusterCallback callback, int value); + + private native void readNullableInt32uAttribute( + long chipClusterPtr, LongAttributeCallback callback); + + private native void writeNullableInt32uAttribute( + long chipClusterPtr, DefaultClusterCallback callback, long value); + + private native void readNullableInt64uAttribute( + long chipClusterPtr, LongAttributeCallback callback); + + private native void writeNullableInt64uAttribute( + long chipClusterPtr, DefaultClusterCallback callback, long value); + + private native void readNullableInt8sAttribute( + long chipClusterPtr, IntegerAttributeCallback callback); + + private native void writeNullableInt8sAttribute( + long chipClusterPtr, DefaultClusterCallback callback, int value); + + private native void readNullableInt16sAttribute( + long chipClusterPtr, IntegerAttributeCallback callback); + + private native void writeNullableInt16sAttribute( + long chipClusterPtr, DefaultClusterCallback callback, int value); + + private native void readNullableInt32sAttribute( + long chipClusterPtr, LongAttributeCallback callback); + + private native void writeNullableInt32sAttribute( + long chipClusterPtr, DefaultClusterCallback callback, long value); + + private native void readNullableInt64sAttribute( + long chipClusterPtr, LongAttributeCallback callback); + + private native void writeNullableInt64sAttribute( + long chipClusterPtr, DefaultClusterCallback callback, long value); + + private native void readNullableEnum8Attribute( + long chipClusterPtr, IntegerAttributeCallback callback); + + private native void writeNullableEnum8Attribute( + long chipClusterPtr, DefaultClusterCallback callback, int value); + + private native void readNullableEnum16Attribute( + long chipClusterPtr, IntegerAttributeCallback callback); + + private native void writeNullableEnum16Attribute( + long chipClusterPtr, DefaultClusterCallback callback, int value); + + private native void readNullableOctetStringAttribute( + long chipClusterPtr, OctetStringAttributeCallback callback); + + private native void writeNullableOctetStringAttribute( + long chipClusterPtr, DefaultClusterCallback callback, byte[] value); + + private native void readNullableCharStringAttribute( + long chipClusterPtr, CharStringAttributeCallback callback); + + private native void writeNullableCharStringAttribute( + long chipClusterPtr, DefaultClusterCallback callback, String value); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); } diff --git a/src/controller/python/chip/clusters/CHIPClusters.cpp b/src/controller/python/chip/clusters/CHIPClusters.cpp index 5d5d36eb9d97cb..bd89b5395caccd 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.cpp +++ b/src/controller/python/chip/clusters/CHIPClusters.cpp @@ -7794,6 +7794,352 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Unsupported(chi cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeUnsupported(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_NullableBoolean(chip::DeviceProxy * 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.ReadAttributeNullableBoolean(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); +} + +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_NullableBoolean(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + bool value) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.WriteAttributeNullableBoolean(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) + .AsInteger(); +} +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_NullableBitmap8(chip::DeviceProxy * 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.ReadAttributeNullableBitmap8(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); +} + +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_NullableBitmap8(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + uint8_t value) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.WriteAttributeNullableBitmap8(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) + .AsInteger(); +} +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_NullableBitmap16(chip::DeviceProxy * 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.ReadAttributeNullableBitmap16(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); +} + +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_NullableBitmap16(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + uint16_t value) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.WriteAttributeNullableBitmap16(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) + .AsInteger(); +} +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_NullableBitmap32(chip::DeviceProxy * 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.ReadAttributeNullableBitmap32(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); +} + +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_NullableBitmap32(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + uint32_t value) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.WriteAttributeNullableBitmap32(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) + .AsInteger(); +} +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_NullableBitmap64(chip::DeviceProxy * 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.ReadAttributeNullableBitmap64(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); +} + +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_NullableBitmap64(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + uint64_t value) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.WriteAttributeNullableBitmap64(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) + .AsInteger(); +} +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_NullableInt8u(chip::DeviceProxy * 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.ReadAttributeNullableInt8u(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); +} + +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_NullableInt8u(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + uint8_t value) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.WriteAttributeNullableInt8u(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) + .AsInteger(); +} +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_NullableInt16u(chip::DeviceProxy * 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.ReadAttributeNullableInt16u(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); +} + +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_NullableInt16u(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + uint16_t value) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.WriteAttributeNullableInt16u(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) + .AsInteger(); +} +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_NullableInt32u(chip::DeviceProxy * 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.ReadAttributeNullableInt32u(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); +} + +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_NullableInt32u(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + uint32_t value) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.WriteAttributeNullableInt32u(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) + .AsInteger(); +} +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_NullableInt64u(chip::DeviceProxy * 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.ReadAttributeNullableInt64u(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); +} + +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_NullableInt64u(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + uint64_t value) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.WriteAttributeNullableInt64u(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) + .AsInteger(); +} +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_NullableInt8s(chip::DeviceProxy * 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.ReadAttributeNullableInt8s(gInt8sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); +} + +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_NullableInt8s(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + int8_t value) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.WriteAttributeNullableInt8s(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) + .AsInteger(); +} +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_NullableInt16s(chip::DeviceProxy * 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.ReadAttributeNullableInt16s(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); +} + +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_NullableInt16s(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + int16_t value) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.WriteAttributeNullableInt16s(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) + .AsInteger(); +} +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_NullableInt32s(chip::DeviceProxy * 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.ReadAttributeNullableInt32s(gInt32sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); +} + +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_NullableInt32s(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + int32_t value) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.WriteAttributeNullableInt32s(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) + .AsInteger(); +} +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_NullableInt64s(chip::DeviceProxy * 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.ReadAttributeNullableInt64s(gInt64sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); +} + +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_NullableInt64s(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + int64_t value) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.WriteAttributeNullableInt64s(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) + .AsInteger(); +} +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_NullableEnum8(chip::DeviceProxy * 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.ReadAttributeNullableEnum8(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); +} + +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_NullableEnum8(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + uint8_t value) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.WriteAttributeNullableEnum8(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) + .AsInteger(); +} +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_NullableEnum16(chip::DeviceProxy * 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.ReadAttributeNullableEnum16(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); +} + +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_NullableEnum16(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + uint16_t value) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.WriteAttributeNullableEnum16(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) + .AsInteger(); +} +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_NullableOctetString(chip::DeviceProxy * 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.ReadAttributeNullableOctetString(gOctetStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) + .AsInteger(); +} + +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_NullableOctetString(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + uint8_t * value, size_t len) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster + .WriteAttributeNullableOctetString(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), + chip::ByteSpan(value, len)) + .AsInteger(); +} +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_NullableCharString(chip::DeviceProxy * 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.ReadAttributeNullableCharString(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()) + .AsInteger(); +} + +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_NullableCharString(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, chip::GroupId, + uint8_t * value, size_t len) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster + .WriteAttributeNullableCharString(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), + chip::CharSpan(reinterpret_cast(value), len)) + .AsInteger(); +} chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 598db37a94a31c..bb30f874ffeecd 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -3537,6 +3537,108 @@ class ChipClusters: "type": "bool", "writable": True, }, + 0x00008000: { + "attributeName": "NullableBoolean", + "attributeId": 0x00008000, + "type": "bool", + "writable": True, + }, + 0x00008001: { + "attributeName": "NullableBitmap8", + "attributeId": 0x00008001, + "type": "int", + "writable": True, + }, + 0x00008002: { + "attributeName": "NullableBitmap16", + "attributeId": 0x00008002, + "type": "int", + "writable": True, + }, + 0x00008003: { + "attributeName": "NullableBitmap32", + "attributeId": 0x00008003, + "type": "int", + "writable": True, + }, + 0x00008004: { + "attributeName": "NullableBitmap64", + "attributeId": 0x00008004, + "type": "int", + "writable": True, + }, + 0x00008005: { + "attributeName": "NullableInt8u", + "attributeId": 0x00008005, + "type": "int", + "writable": True, + }, + 0x00008006: { + "attributeName": "NullableInt16u", + "attributeId": 0x00008006, + "type": "int", + "writable": True, + }, + 0x00008008: { + "attributeName": "NullableInt32u", + "attributeId": 0x00008008, + "type": "int", + "writable": True, + }, + 0x0000800C: { + "attributeName": "NullableInt64u", + "attributeId": 0x0000800C, + "type": "int", + "writable": True, + }, + 0x0000800D: { + "attributeName": "NullableInt8s", + "attributeId": 0x0000800D, + "type": "int", + "writable": True, + }, + 0x0000800E: { + "attributeName": "NullableInt16s", + "attributeId": 0x0000800E, + "type": "int", + "writable": True, + }, + 0x00008010: { + "attributeName": "NullableInt32s", + "attributeId": 0x00008010, + "type": "int", + "writable": True, + }, + 0x00008014: { + "attributeName": "NullableInt64s", + "attributeId": 0x00008014, + "type": "int", + "writable": True, + }, + 0x00008015: { + "attributeName": "NullableEnum8", + "attributeId": 0x00008015, + "type": "int", + "writable": True, + }, + 0x00008016: { + "attributeName": "NullableEnum16", + "attributeId": 0x00008016, + "type": "int", + "writable": True, + }, + 0x00008019: { + "attributeName": "NullableOctetString", + "attributeId": 0x00008019, + "type": "bytes", + "writable": True, + }, + 0x0000801E: { + "attributeName": "NullableCharString", + "attributeId": 0x0000801E, + "type": "str", + "writable": True, + }, 0x0000FFFD: { "attributeName": "ClusterRevision", "attributeId": 0x0000FFFD, @@ -6703,6 +6805,109 @@ def ClusterTestCluster_ReadAttributeUnsupported(self, device: ctypes.c_void_p, Z def ClusterTestCluster_WriteAttributeUnsupported(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, value: bool): return self._chipLib.chip_ime_WriteAttribute_TestCluster_Unsupported(device, ZCLendpoint, ZCLgroupid, value) + def ClusterTestCluster_ReadAttributeNullableBoolean(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableBoolean(device, ZCLendpoint, ZCLgroupid) + + def ClusterTestCluster_WriteAttributeNullableBoolean(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, value: bool): + return self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableBoolean(device, ZCLendpoint, ZCLgroupid, value) + + def ClusterTestCluster_ReadAttributeNullableBitmap8(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableBitmap8(device, ZCLendpoint, ZCLgroupid) + + def ClusterTestCluster_WriteAttributeNullableBitmap8(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, value: int): + return self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableBitmap8(device, ZCLendpoint, ZCLgroupid, value) + + def ClusterTestCluster_ReadAttributeNullableBitmap16(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableBitmap16(device, ZCLendpoint, ZCLgroupid) + + def ClusterTestCluster_WriteAttributeNullableBitmap16(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, value: int): + return self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableBitmap16(device, ZCLendpoint, ZCLgroupid, value) + + def ClusterTestCluster_ReadAttributeNullableBitmap32(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableBitmap32(device, ZCLendpoint, ZCLgroupid) + + def ClusterTestCluster_WriteAttributeNullableBitmap32(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, value: int): + return self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableBitmap32(device, ZCLendpoint, ZCLgroupid, value) + + def ClusterTestCluster_ReadAttributeNullableBitmap64(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableBitmap64(device, ZCLendpoint, ZCLgroupid) + + def ClusterTestCluster_WriteAttributeNullableBitmap64(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, value: int): + return self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableBitmap64(device, ZCLendpoint, ZCLgroupid, value) + + def ClusterTestCluster_ReadAttributeNullableInt8u(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableInt8u(device, ZCLendpoint, ZCLgroupid) + + def ClusterTestCluster_WriteAttributeNullableInt8u(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, value: int): + return self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableInt8u(device, ZCLendpoint, ZCLgroupid, value) + + def ClusterTestCluster_ReadAttributeNullableInt16u(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableInt16u(device, ZCLendpoint, ZCLgroupid) + + def ClusterTestCluster_WriteAttributeNullableInt16u(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, value: int): + return self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableInt16u(device, ZCLendpoint, ZCLgroupid, value) + + def ClusterTestCluster_ReadAttributeNullableInt32u(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableInt32u(device, ZCLendpoint, ZCLgroupid) + + def ClusterTestCluster_WriteAttributeNullableInt32u(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, value: int): + return self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableInt32u(device, ZCLendpoint, ZCLgroupid, value) + + def ClusterTestCluster_ReadAttributeNullableInt64u(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableInt64u(device, ZCLendpoint, ZCLgroupid) + + def ClusterTestCluster_WriteAttributeNullableInt64u(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, value: int): + return self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableInt64u(device, ZCLendpoint, ZCLgroupid, value) + + def ClusterTestCluster_ReadAttributeNullableInt8s(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableInt8s(device, ZCLendpoint, ZCLgroupid) + + def ClusterTestCluster_WriteAttributeNullableInt8s(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, value: int): + return self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableInt8s(device, ZCLendpoint, ZCLgroupid, value) + + def ClusterTestCluster_ReadAttributeNullableInt16s(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableInt16s(device, ZCLendpoint, ZCLgroupid) + + def ClusterTestCluster_WriteAttributeNullableInt16s(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, value: int): + return self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableInt16s(device, ZCLendpoint, ZCLgroupid, value) + + def ClusterTestCluster_ReadAttributeNullableInt32s(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableInt32s(device, ZCLendpoint, ZCLgroupid) + + def ClusterTestCluster_WriteAttributeNullableInt32s(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, value: int): + return self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableInt32s(device, ZCLendpoint, ZCLgroupid, value) + + def ClusterTestCluster_ReadAttributeNullableInt64s(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableInt64s(device, ZCLendpoint, ZCLgroupid) + + def ClusterTestCluster_WriteAttributeNullableInt64s(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, value: int): + return self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableInt64s(device, ZCLendpoint, ZCLgroupid, value) + + def ClusterTestCluster_ReadAttributeNullableEnum8(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableEnum8(device, ZCLendpoint, ZCLgroupid) + + def ClusterTestCluster_WriteAttributeNullableEnum8(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, value: int): + return self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableEnum8(device, ZCLendpoint, ZCLgroupid, value) + + def ClusterTestCluster_ReadAttributeNullableEnum16(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableEnum16(device, ZCLendpoint, ZCLgroupid) + + def ClusterTestCluster_WriteAttributeNullableEnum16(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, value: int): + return self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableEnum16(device, ZCLendpoint, ZCLgroupid, value) + + def ClusterTestCluster_ReadAttributeNullableOctetString(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableOctetString(device, ZCLendpoint, ZCLgroupid) + + def ClusterTestCluster_WriteAttributeNullableOctetString(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, value: bytes): + return self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableOctetString(device, ZCLendpoint, ZCLgroupid, value, len(value)) + + def ClusterTestCluster_ReadAttributeNullableCharString(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableCharString(device, ZCLendpoint, ZCLgroupid) + + def ClusterTestCluster_WriteAttributeNullableCharString(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, value: str): + value = value.encode("utf-8") + return self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableCharString(device, ZCLendpoint, ZCLgroupid, value, len(value)) + def ClusterTestCluster_ReadAttributeClusterRevision(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): return self._chipLib.chip_ime_ReadAttribute_TestCluster_ClusterRevision(device, ZCLendpoint, ZCLgroupid) @@ -9535,6 +9740,142 @@ def InitLib(self, chipLib): self._chipLib.chip_ime_WriteAttribute_TestCluster_Unsupported.argtypes = [ ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_bool] self._chipLib.chip_ime_WriteAttribute_TestCluster_Unsupported.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute NullableBoolean + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableBoolean.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableBoolean.restype = ctypes.c_uint32 + # Cluster TestCluster WriteAttribute NullableBoolean + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableBoolean.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_bool] + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableBoolean.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute NullableBitmap8 + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableBitmap8.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableBitmap8.restype = ctypes.c_uint32 + # Cluster TestCluster WriteAttribute NullableBitmap8 + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableBitmap8.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint8] + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableBitmap8.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute NullableBitmap16 + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableBitmap16.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableBitmap16.restype = ctypes.c_uint32 + # Cluster TestCluster WriteAttribute NullableBitmap16 + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableBitmap16.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint16] + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableBitmap16.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute NullableBitmap32 + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableBitmap32.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableBitmap32.restype = ctypes.c_uint32 + # Cluster TestCluster WriteAttribute NullableBitmap32 + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableBitmap32.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint32] + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableBitmap32.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute NullableBitmap64 + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableBitmap64.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableBitmap64.restype = ctypes.c_uint32 + # Cluster TestCluster WriteAttribute NullableBitmap64 + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableBitmap64.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint64] + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableBitmap64.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute NullableInt8u + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableInt8u.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableInt8u.restype = ctypes.c_uint32 + # Cluster TestCluster WriteAttribute NullableInt8u + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableInt8u.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint8] + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableInt8u.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute NullableInt16u + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableInt16u.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableInt16u.restype = ctypes.c_uint32 + # Cluster TestCluster WriteAttribute NullableInt16u + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableInt16u.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint16] + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableInt16u.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute NullableInt32u + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableInt32u.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableInt32u.restype = ctypes.c_uint32 + # Cluster TestCluster WriteAttribute NullableInt32u + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableInt32u.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint32] + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableInt32u.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute NullableInt64u + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableInt64u.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableInt64u.restype = ctypes.c_uint32 + # Cluster TestCluster WriteAttribute NullableInt64u + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableInt64u.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint64] + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableInt64u.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute NullableInt8s + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableInt8s.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableInt8s.restype = ctypes.c_uint32 + # Cluster TestCluster WriteAttribute NullableInt8s + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableInt8s.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_int8] + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableInt8s.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute NullableInt16s + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableInt16s.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableInt16s.restype = ctypes.c_uint32 + # Cluster TestCluster WriteAttribute NullableInt16s + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableInt16s.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_int16] + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableInt16s.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute NullableInt32s + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableInt32s.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableInt32s.restype = ctypes.c_uint32 + # Cluster TestCluster WriteAttribute NullableInt32s + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableInt32s.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_int32] + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableInt32s.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute NullableInt64s + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableInt64s.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableInt64s.restype = ctypes.c_uint32 + # Cluster TestCluster WriteAttribute NullableInt64s + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableInt64s.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_int64] + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableInt64s.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute NullableEnum8 + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableEnum8.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableEnum8.restype = ctypes.c_uint32 + # Cluster TestCluster WriteAttribute NullableEnum8 + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableEnum8.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint8] + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableEnum8.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute NullableEnum16 + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableEnum16.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableEnum16.restype = ctypes.c_uint32 + # Cluster TestCluster WriteAttribute NullableEnum16 + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableEnum16.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint16] + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableEnum16.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute NullableOctetString + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableOctetString.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableOctetString.restype = ctypes.c_uint32 + # Cluster TestCluster WriteAttribute NullableOctetString + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableOctetString.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_char_p, ctypes.c_uint32] + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableOctetString.restype = ctypes.c_uint32 + # Cluster TestCluster ReadAttribute NullableCharString + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableCharString.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_TestCluster_NullableCharString.restype = ctypes.c_uint32 + # Cluster TestCluster WriteAttribute NullableCharString + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableCharString.argtypes = [ + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_char_p, ctypes.c_uint32] + self._chipLib.chip_ime_WriteAttribute_TestCluster_NullableCharString.restype = ctypes.c_uint32 # Cluster TestCluster ReadAttribute ClusterRevision self._chipLib.chip_ime_ReadAttribute_TestCluster_ClusterRevision.argtypes = [ ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index c123dc32c29de7..011d4d6ce7a287 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -21686,6 +21686,227 @@ def attribute_id(cls) -> int: def attribute_type(cls) -> ClusterObjectFieldDescriptor: return ClusterObjectFieldDescriptor(Type=bool) + class NullableBoolean(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x050F + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x8000 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=bool) + + class NullableBitmap8(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x050F + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x8001 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + class NullableBitmap16(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x050F + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x8002 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + class NullableBitmap32(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x050F + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x8003 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + class NullableBitmap64(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x050F + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x8004 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + class NullableInt8u(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x050F + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x8005 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + class NullableInt16u(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x050F + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x8006 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + class NullableInt32u(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x050F + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x8008 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + class NullableInt64u(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x050F + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x800C + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + class NullableInt8s(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x050F + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x800D + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=int) + + class NullableInt16s(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x050F + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x800E + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=int) + + class NullableInt32s(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x050F + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x8010 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=int) + + class NullableInt64s(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x050F + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x8014 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=int) + + class NullableEnum8(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x050F + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x8015 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + class NullableEnum16(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x050F + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x8016 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + class NullableOctetString(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x050F + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x8019 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=bytes) + + class NullableCharString(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x050F + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x801E + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=str) + class FeatureMap(ClusterAttributeDescriptor): @ChipUtility.classproperty def cluster_id(cls) -> int: diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h index 4b61fbbaeaa1f0..481694485dab50 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h @@ -1704,6 +1704,57 @@ NS_ASSUME_NONNULL_BEGIN - (void)readAttributeUnsupportedWithResponseHandler:(ResponseHandler)responseHandler; - (void)writeAttributeUnsupportedWithValue:(bool)value responseHandler:(ResponseHandler)responseHandler; +- (void)readAttributeNullableBooleanWithResponseHandler:(ResponseHandler)responseHandler; +- (void)writeAttributeNullableBooleanWithValue:(bool)value responseHandler:(ResponseHandler)responseHandler; + +- (void)readAttributeNullableBitmap8WithResponseHandler:(ResponseHandler)responseHandler; +- (void)writeAttributeNullableBitmap8WithValue:(uint8_t)value responseHandler:(ResponseHandler)responseHandler; + +- (void)readAttributeNullableBitmap16WithResponseHandler:(ResponseHandler)responseHandler; +- (void)writeAttributeNullableBitmap16WithValue:(uint16_t)value responseHandler:(ResponseHandler)responseHandler; + +- (void)readAttributeNullableBitmap32WithResponseHandler:(ResponseHandler)responseHandler; +- (void)writeAttributeNullableBitmap32WithValue:(uint32_t)value responseHandler:(ResponseHandler)responseHandler; + +- (void)readAttributeNullableBitmap64WithResponseHandler:(ResponseHandler)responseHandler; +- (void)writeAttributeNullableBitmap64WithValue:(uint64_t)value responseHandler:(ResponseHandler)responseHandler; + +- (void)readAttributeNullableInt8uWithResponseHandler:(ResponseHandler)responseHandler; +- (void)writeAttributeNullableInt8uWithValue:(uint8_t)value responseHandler:(ResponseHandler)responseHandler; + +- (void)readAttributeNullableInt16uWithResponseHandler:(ResponseHandler)responseHandler; +- (void)writeAttributeNullableInt16uWithValue:(uint16_t)value responseHandler:(ResponseHandler)responseHandler; + +- (void)readAttributeNullableInt32uWithResponseHandler:(ResponseHandler)responseHandler; +- (void)writeAttributeNullableInt32uWithValue:(uint32_t)value responseHandler:(ResponseHandler)responseHandler; + +- (void)readAttributeNullableInt64uWithResponseHandler:(ResponseHandler)responseHandler; +- (void)writeAttributeNullableInt64uWithValue:(uint64_t)value responseHandler:(ResponseHandler)responseHandler; + +- (void)readAttributeNullableInt8sWithResponseHandler:(ResponseHandler)responseHandler; +- (void)writeAttributeNullableInt8sWithValue:(int8_t)value responseHandler:(ResponseHandler)responseHandler; + +- (void)readAttributeNullableInt16sWithResponseHandler:(ResponseHandler)responseHandler; +- (void)writeAttributeNullableInt16sWithValue:(int16_t)value responseHandler:(ResponseHandler)responseHandler; + +- (void)readAttributeNullableInt32sWithResponseHandler:(ResponseHandler)responseHandler; +- (void)writeAttributeNullableInt32sWithValue:(int32_t)value responseHandler:(ResponseHandler)responseHandler; + +- (void)readAttributeNullableInt64sWithResponseHandler:(ResponseHandler)responseHandler; +- (void)writeAttributeNullableInt64sWithValue:(int64_t)value responseHandler:(ResponseHandler)responseHandler; + +- (void)readAttributeNullableEnum8WithResponseHandler:(ResponseHandler)responseHandler; +- (void)writeAttributeNullableEnum8WithValue:(uint8_t)value responseHandler:(ResponseHandler)responseHandler; + +- (void)readAttributeNullableEnum16WithResponseHandler:(ResponseHandler)responseHandler; +- (void)writeAttributeNullableEnum16WithValue:(uint16_t)value responseHandler:(ResponseHandler)responseHandler; + +- (void)readAttributeNullableOctetStringWithResponseHandler:(ResponseHandler)responseHandler; +- (void)writeAttributeNullableOctetStringWithValue:(NSData *)value responseHandler:(ResponseHandler)responseHandler; + +- (void)readAttributeNullableCharStringWithResponseHandler:(ResponseHandler)responseHandler; +- (void)writeAttributeNullableCharStringWithValue:(NSString *)value responseHandler:(ResponseHandler)responseHandler; + - (void)readAttributeClusterRevisionWithResponseHandler:(ResponseHandler)responseHandler; @end diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm index 2a0c79e7e18dc4..b84919815ef954 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm @@ -6174,6 +6174,244 @@ new CHIPDefaultSuccessCallbackBridge(self.callbackQueue, responseHandler, ^(Canc }); } +- (void)readAttributeNullableBooleanWithResponseHandler:(ResponseHandler)responseHandler +{ + new CHIPBooleanAttributeCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.ReadAttributeNullableBoolean(success, failure); + }); +} + +- (void)writeAttributeNullableBooleanWithValue:(bool)value responseHandler:(ResponseHandler)responseHandler +{ + new CHIPDefaultSuccessCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.WriteAttributeNullableBoolean(success, failure, value); + }); +} + +- (void)readAttributeNullableBitmap8WithResponseHandler:(ResponseHandler)responseHandler +{ + new CHIPInt8uAttributeCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.ReadAttributeNullableBitmap8(success, failure); + }); +} + +- (void)writeAttributeNullableBitmap8WithValue:(uint8_t)value responseHandler:(ResponseHandler)responseHandler +{ + new CHIPDefaultSuccessCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.WriteAttributeNullableBitmap8(success, failure, value); + }); +} + +- (void)readAttributeNullableBitmap16WithResponseHandler:(ResponseHandler)responseHandler +{ + new CHIPInt16uAttributeCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.ReadAttributeNullableBitmap16(success, failure); + }); +} + +- (void)writeAttributeNullableBitmap16WithValue:(uint16_t)value responseHandler:(ResponseHandler)responseHandler +{ + new CHIPDefaultSuccessCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.WriteAttributeNullableBitmap16(success, failure, value); + }); +} + +- (void)readAttributeNullableBitmap32WithResponseHandler:(ResponseHandler)responseHandler +{ + new CHIPInt32uAttributeCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.ReadAttributeNullableBitmap32(success, failure); + }); +} + +- (void)writeAttributeNullableBitmap32WithValue:(uint32_t)value responseHandler:(ResponseHandler)responseHandler +{ + new CHIPDefaultSuccessCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.WriteAttributeNullableBitmap32(success, failure, value); + }); +} + +- (void)readAttributeNullableBitmap64WithResponseHandler:(ResponseHandler)responseHandler +{ + new CHIPInt64uAttributeCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.ReadAttributeNullableBitmap64(success, failure); + }); +} + +- (void)writeAttributeNullableBitmap64WithValue:(uint64_t)value responseHandler:(ResponseHandler)responseHandler +{ + new CHIPDefaultSuccessCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.WriteAttributeNullableBitmap64(success, failure, value); + }); +} + +- (void)readAttributeNullableInt8uWithResponseHandler:(ResponseHandler)responseHandler +{ + new CHIPInt8uAttributeCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.ReadAttributeNullableInt8u(success, failure); + }); +} + +- (void)writeAttributeNullableInt8uWithValue:(uint8_t)value responseHandler:(ResponseHandler)responseHandler +{ + new CHIPDefaultSuccessCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.WriteAttributeNullableInt8u(success, failure, value); + }); +} + +- (void)readAttributeNullableInt16uWithResponseHandler:(ResponseHandler)responseHandler +{ + new CHIPInt16uAttributeCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.ReadAttributeNullableInt16u(success, failure); + }); +} + +- (void)writeAttributeNullableInt16uWithValue:(uint16_t)value responseHandler:(ResponseHandler)responseHandler +{ + new CHIPDefaultSuccessCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.WriteAttributeNullableInt16u(success, failure, value); + }); +} + +- (void)readAttributeNullableInt32uWithResponseHandler:(ResponseHandler)responseHandler +{ + new CHIPInt32uAttributeCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.ReadAttributeNullableInt32u(success, failure); + }); +} + +- (void)writeAttributeNullableInt32uWithValue:(uint32_t)value responseHandler:(ResponseHandler)responseHandler +{ + new CHIPDefaultSuccessCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.WriteAttributeNullableInt32u(success, failure, value); + }); +} + +- (void)readAttributeNullableInt64uWithResponseHandler:(ResponseHandler)responseHandler +{ + new CHIPInt64uAttributeCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.ReadAttributeNullableInt64u(success, failure); + }); +} + +- (void)writeAttributeNullableInt64uWithValue:(uint64_t)value responseHandler:(ResponseHandler)responseHandler +{ + new CHIPDefaultSuccessCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.WriteAttributeNullableInt64u(success, failure, value); + }); +} + +- (void)readAttributeNullableInt8sWithResponseHandler:(ResponseHandler)responseHandler +{ + new CHIPInt8sAttributeCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.ReadAttributeNullableInt8s(success, failure); + }); +} + +- (void)writeAttributeNullableInt8sWithValue:(int8_t)value responseHandler:(ResponseHandler)responseHandler +{ + new CHIPDefaultSuccessCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.WriteAttributeNullableInt8s(success, failure, value); + }); +} + +- (void)readAttributeNullableInt16sWithResponseHandler:(ResponseHandler)responseHandler +{ + new CHIPInt16sAttributeCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.ReadAttributeNullableInt16s(success, failure); + }); +} + +- (void)writeAttributeNullableInt16sWithValue:(int16_t)value responseHandler:(ResponseHandler)responseHandler +{ + new CHIPDefaultSuccessCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.WriteAttributeNullableInt16s(success, failure, value); + }); +} + +- (void)readAttributeNullableInt32sWithResponseHandler:(ResponseHandler)responseHandler +{ + new CHIPInt32sAttributeCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.ReadAttributeNullableInt32s(success, failure); + }); +} + +- (void)writeAttributeNullableInt32sWithValue:(int32_t)value responseHandler:(ResponseHandler)responseHandler +{ + new CHIPDefaultSuccessCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.WriteAttributeNullableInt32s(success, failure, value); + }); +} + +- (void)readAttributeNullableInt64sWithResponseHandler:(ResponseHandler)responseHandler +{ + new CHIPInt64sAttributeCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.ReadAttributeNullableInt64s(success, failure); + }); +} + +- (void)writeAttributeNullableInt64sWithValue:(int64_t)value responseHandler:(ResponseHandler)responseHandler +{ + new CHIPDefaultSuccessCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.WriteAttributeNullableInt64s(success, failure, value); + }); +} + +- (void)readAttributeNullableEnum8WithResponseHandler:(ResponseHandler)responseHandler +{ + new CHIPInt8uAttributeCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.ReadAttributeNullableEnum8(success, failure); + }); +} + +- (void)writeAttributeNullableEnum8WithValue:(uint8_t)value responseHandler:(ResponseHandler)responseHandler +{ + new CHIPDefaultSuccessCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.WriteAttributeNullableEnum8(success, failure, static_cast(value)); + }); +} + +- (void)readAttributeNullableEnum16WithResponseHandler:(ResponseHandler)responseHandler +{ + new CHIPInt16uAttributeCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.ReadAttributeNullableEnum16(success, failure); + }); +} + +- (void)writeAttributeNullableEnum16WithValue:(uint16_t)value responseHandler:(ResponseHandler)responseHandler +{ + new CHIPDefaultSuccessCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.WriteAttributeNullableEnum16(success, failure, static_cast(value)); + }); +} + +- (void)readAttributeNullableOctetStringWithResponseHandler:(ResponseHandler)responseHandler +{ + new CHIPOctetStringAttributeCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.ReadAttributeNullableOctetString(success, failure); + }); +} + +- (void)writeAttributeNullableOctetStringWithValue:(NSData *)value responseHandler:(ResponseHandler)responseHandler +{ + new CHIPDefaultSuccessCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.WriteAttributeNullableOctetString(success, failure, [self asByteSpan:value]); + }); +} + +- (void)readAttributeNullableCharStringWithResponseHandler:(ResponseHandler)responseHandler +{ + new CHIPCharStringAttributeCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.ReadAttributeNullableCharString(success, failure); + }); +} + +- (void)writeAttributeNullableCharStringWithValue:(NSString *)value responseHandler:(ResponseHandler)responseHandler +{ + new CHIPDefaultSuccessCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.WriteAttributeNullableCharString(success, failure, [self asCharSpan:value]); + }); +} + - (void)readAttributeClusterRevisionWithResponseHandler:(ResponseHandler)responseHandler { new CHIPInt16uAttributeCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { 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 ecb85791eb497f..e006df498b3872 100644 --- a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h +++ b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h @@ -918,17 +918,41 @@ /* 8444 - epoch_s, */ \ 0x00, 0x00, 0x00, 0x00, \ \ + /* 8448 - nullable_bitmap32, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* 8452 - nullable_bitmap64, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 8460 - nullable_int32u, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* 8464 - nullable_int64u, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 8472 - nullable_int32s, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* 8476 - nullable_int64s, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 8484 - nullable_octet_string, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 8495 - nullable_char_string, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ /* Endpoint: 1, Cluster: Electrical Measurement (server), big-endian */ \ \ - /* 8448 - measurement type, */ \ + /* 8506 - measurement type, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 8452 - total active power, */ \ + /* 8510 - total active power, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 2, Cluster: On/Off (server), big-endian */ \ \ - /* 8456 - FeatureMap, */ \ + /* 8514 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ } @@ -1827,23 +1851,47 @@ /* 8444 - epoch_s, */ \ 0x00, 0x00, 0x00, 0x00, \ \ + /* 8448 - nullable_bitmap32, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* 8452 - nullable_bitmap64, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 8460 - nullable_int32u, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* 8464 - nullable_int64u, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 8472 - nullable_int32s, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* 8476 - nullable_int64s, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 8484 - nullable_octet_string, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 8495 - nullable_char_string, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ /* Endpoint: 1, Cluster: Electrical Measurement (server), little-endian */ \ \ - /* 8448 - measurement type, */ \ + /* 8506 - measurement type, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 8452 - total active power, */ \ + /* 8510 - total active power, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 2, Cluster: On/Off (server), little-endian */ \ \ - /* 8456 - FeatureMap, */ \ + /* 8514 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ } #endif // BIGENDIAN_CPU -#define GENERATED_DEFAULTS_COUNT (150) +#define GENERATED_DEFAULTS_COUNT (158) #define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE #define ZAP_LONG_DEFAULTS_INDEX(index) \ @@ -1871,7 +1919,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 500 +#define GENERATED_ATTRIBUTE_COUNT 517 #define GENERATED_ATTRIBUTES \ { \ \ @@ -2492,12 +2540,46 @@ { 0x0021, ZAP_TYPE(EPOCH_S), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(8444) }, /* epoch_s */ \ { 0x0022, ZAP_TYPE(VENDOR_ID), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_EMPTY_DEFAULT() }, /* vendor_id */ \ { 0x0023, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ - ZAP_EMPTY_DEFAULT() }, /* list_nullables_and_optionals_struct */ \ + ZAP_EMPTY_DEFAULT() }, /* list_nullables_and_optionals_struct */ \ + { 0x8000, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_SIMPLE_DEFAULT(false) }, /* nullable_boolean */ \ + { 0x8001, ZAP_TYPE(BITMAP8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_SIMPLE_DEFAULT(0) }, /* nullable_bitmap8 */ \ + { 0x8002, ZAP_TYPE(BITMAP16), 2, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_SIMPLE_DEFAULT(0) }, /* nullable_bitmap16 */ \ + { 0x8003, ZAP_TYPE(BITMAP32), 4, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_LONG_DEFAULTS_INDEX(8448) }, /* nullable_bitmap32 */ \ + { 0x8004, ZAP_TYPE(BITMAP64), 8, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_LONG_DEFAULTS_INDEX(8452) }, /* nullable_bitmap64 */ \ + { 0x8005, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_SIMPLE_DEFAULT(0) }, /* nullable_int8u */ \ + { 0x8006, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_SIMPLE_DEFAULT(0) }, /* nullable_int16u */ \ + { 0x8008, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_LONG_DEFAULTS_INDEX(8460) }, /* nullable_int32u */ \ + { 0x800C, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_LONG_DEFAULTS_INDEX(8464) }, /* nullable_int64u */ \ + { 0x800D, ZAP_TYPE(INT8S), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_SIMPLE_DEFAULT(0) }, /* nullable_int8s */ \ + { 0x800E, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_SIMPLE_DEFAULT(0) }, /* nullable_int16s */ \ + { 0x8010, ZAP_TYPE(INT32S), 4, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_LONG_DEFAULTS_INDEX(8472) }, /* nullable_int32s */ \ + { 0x8014, ZAP_TYPE(INT64S), 8, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_LONG_DEFAULTS_INDEX(8476) }, /* nullable_int64s */ \ + { 0x8015, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_SIMPLE_DEFAULT(0) }, /* nullable_enum8 */ \ + { 0x8016, ZAP_TYPE(ENUM16), 2, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_SIMPLE_DEFAULT(0) }, /* nullable_enum16 */ \ + { 0x8019, ZAP_TYPE(OCTET_STRING), 11, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_LONG_DEFAULTS_INDEX(8484) }, /* nullable_octet_string */ \ + { 0x801E, ZAP_TYPE(CHAR_STRING), 11, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_LONG_DEFAULTS_INDEX(8495) }, /* nullable_char_string */ \ { 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(8448) }, /* measurement type */ \ - { 0x0304, ZAP_TYPE(INT32S), 4, 0, ZAP_LONG_DEFAULTS_INDEX(8452) }, /* total active power */ \ + { 0x0000, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(8506) }, /* measurement type */ \ + { 0x0304, ZAP_TYPE(INT32S), 4, 0, ZAP_LONG_DEFAULTS_INDEX(8510) }, /* 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 */ \ @@ -2518,7 +2600,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(8456) }, /* FeatureMap */ \ + { 0xFFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(8514) }, /* FeatureMap */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(4) }, /* ClusterRevision */ \ \ /* Endpoint: 2, Cluster: Descriptor (server) */ \ @@ -2807,25 +2889,25 @@ 0x050E, ZAP_ATTRIBUTE_INDEX(443), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Account Login (server) */ \ { \ - 0x050F, ZAP_ATTRIBUTE_INDEX(444), 27, 2609, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050F, ZAP_ATTRIBUTE_INDEX(444), 44, 2680, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Test Cluster (server) */ \ { \ - 0x0B04, ZAP_ATTRIBUTE_INDEX(471), 12, 28, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0B04, ZAP_ATTRIBUTE_INDEX(488), 12, 28, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Electrical Measurement (server) */ \ { \ - 0xF000, ZAP_ATTRIBUTE_INDEX(483), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0xF000, ZAP_ATTRIBUTE_INDEX(500), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Binding (server) */ \ { 0x0006, \ - ZAP_ATTRIBUTE_INDEX(484), \ + ZAP_ATTRIBUTE_INDEX(501), \ 7, \ 13, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayOnOffServer }, /* Endpoint: 2, Cluster: On/Off (server) */ \ { \ - 0x001D, ZAP_ATTRIBUTE_INDEX(491), 5, 0, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x001D, ZAP_ATTRIBUTE_INDEX(508), 5, 0, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 2, Cluster: Descriptor (server) */ \ { 0x0406, \ - ZAP_ATTRIBUTE_INDEX(496), \ + ZAP_ATTRIBUTE_INDEX(513), \ 4, \ 5, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -2837,7 +2919,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 18, 2400 }, { ZAP_CLUSTER_INDEX(18), 44, 6572 }, { ZAP_CLUSTER_INDEX(62), 3, 18 }, \ + { ZAP_CLUSTER_INDEX(0), 18, 2400 }, { ZAP_CLUSTER_INDEX(18), 44, 6643 }, { ZAP_CLUSTER_INDEX(62), 3, 18 }, \ } // Largest attribute size is needed for various buffers @@ -2847,7 +2929,7 @@ #define ATTRIBUTE_SINGLETONS_SIZE (1518) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (8990) +#define ATTRIBUTE_MAX_SIZE (9061) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (3) diff --git a/zzz_generated/app-common/app-common/zap-generated/att-storage.h b/zzz_generated/app-common/app-common/zap-generated/att-storage.h index ca7c9d07c8d080..91185bfe893995 100644 --- a/zzz_generated/app-common/app-common/zap-generated/att-storage.h +++ b/zzz_generated/app-common/app-common/zap-generated/att-storage.h @@ -20,25 +20,6 @@ // Prevent multiple inclusion #pragma once -// Attribute masks modify how attributes are used by the framework -// -// Attribute that has this mask is NOT read-only -#define ATTRIBUTE_MASK_WRITABLE (0x01) -// Attribute that has this mask is saved to a token -#define ATTRIBUTE_MASK_TOKENIZE (0x02) -// Attribute that has this mask has a min/max values -#define ATTRIBUTE_MASK_MIN_MAX (0x04) -// Manufacturer specific attribute -#define ATTRIBUTE_MASK_MANUFACTURER_SPECIFIC (0x08) -// Attribute deferred to external storage -#define ATTRIBUTE_MASK_EXTERNAL_STORAGE (0x10) -// Attribute is singleton -#define ATTRIBUTE_MASK_SINGLETON (0x20) -// Attribute is a client attribute -#define ATTRIBUTE_MASK_CLIENT (0x40) -// Attribute is nullable -#define ATTRIBUTE_MASK_NULLABLE (0x80) - // Cluster masks modify how clusters are used by the framework // // Does this cluster have init function? 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 7be477f2de5fd8..d8ba86510663b6 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 @@ -1392,6 +1392,23 @@ #define ZCL_TEST_VENDOR_ID_ATTRIBUTE_ID (0x0022) #define ZCL_LIST_OF_STRUCTS_WITH_OPTIONALS_ATTRIBUTE_ID (0x0023) #define ZCL_UNSUPPORTED_ATTRIBUTE_ID (0x00FF) +#define ZCL_NULLABLE_BOOLEAN_ATTRIBUTE_ID (0x8000) +#define ZCL_NULLABLE_BITMAP8_ATTRIBUTE_ID (0x8001) +#define ZCL_NULLABLE_BITMAP16_ATTRIBUTE_ID (0x8002) +#define ZCL_NULLABLE_BITMAP32_ATTRIBUTE_ID (0x8003) +#define ZCL_NULLABLE_BITMAP64_ATTRIBUTE_ID (0x8004) +#define ZCL_NULLABLE_INT8_U_ATTRIBUTE_ID (0x8005) +#define ZCL_NULLABLE_INT16_U_ATTRIBUTE_ID (0x8006) +#define ZCL_NULLABLE_INT32_U_ATTRIBUTE_ID (0x8008) +#define ZCL_NULLABLE_INT64_U_ATTRIBUTE_ID (0x800C) +#define ZCL_NULLABLE_INT8_S_ATTRIBUTE_ID (0x800D) +#define ZCL_NULLABLE_INT16_S_ATTRIBUTE_ID (0x800E) +#define ZCL_NULLABLE_INT32_S_ATTRIBUTE_ID (0x8010) +#define ZCL_NULLABLE_INT64_S_ATTRIBUTE_ID (0x8014) +#define ZCL_NULLABLE_ENUM8_ATTRIBUTE_ID (0x8015) +#define ZCL_NULLABLE_ENUM16_ATTRIBUTE_ID (0x8016) +#define ZCL_NULLABLE_OCTET_STRING_ATTRIBUTE_ID (0x8019) +#define ZCL_NULLABLE_CHAR_STRING_ATTRIBUTE_ID (0x801E) // Attribute ids for cluster: Messaging 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 0a3f9b19433c62..74bb28bbf77297 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 @@ -28,6 +28,7 @@ #include #include #include +#include namespace chip { namespace app { @@ -40,10 +41,23 @@ namespace MainsVoltage { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -54,10 +68,23 @@ namespace MainsFrequency { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -68,10 +95,23 @@ namespace MainsAlarmMask { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_BITMAP8_ATTRIBUTE_TYPE); } @@ -82,10 +122,23 @@ namespace MainsVoltageMinThreshold { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -96,10 +149,23 @@ namespace MainsVoltageMaxThreshold { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -110,10 +176,23 @@ namespace MainsVoltageDwellTrip { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -124,10 +203,23 @@ namespace BatteryVoltage { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -138,10 +230,23 @@ namespace BatteryPercentageRemaining { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -152,16 +257,23 @@ namespace BatteryManufacturer { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 16); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(16 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -175,10 +287,23 @@ namespace BatterySize { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -189,10 +314,23 @@ namespace BatteryAhrRating { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -203,10 +341,23 @@ namespace BatteryQuantity { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -217,10 +368,23 @@ namespace BatteryRatedVoltage { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -231,10 +395,23 @@ namespace BatteryAlarmMask { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_BITMAP8_ATTRIBUTE_TYPE); } @@ -245,10 +422,23 @@ namespace BatteryVoltageMinThreshold { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -259,10 +449,23 @@ namespace BatteryVoltageThreshold1 { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -273,10 +476,23 @@ namespace BatteryVoltageThreshold2 { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -287,10 +503,23 @@ namespace BatteryVoltageThreshold3 { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -301,10 +530,23 @@ namespace BatteryPercentageMinThreshold { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -315,10 +557,23 @@ namespace BatteryPercentageThreshold1 { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -329,10 +584,23 @@ namespace BatteryPercentageThreshold2 { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -343,10 +611,23 @@ namespace BatteryPercentageThreshold3 { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -357,10 +638,23 @@ namespace BatteryAlarmState { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_BITMAP32_ATTRIBUTE_TYPE); } @@ -371,10 +665,23 @@ namespace Battery2Voltage { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -385,10 +692,23 @@ namespace Battery2PercentageRemaining { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -399,16 +719,23 @@ namespace Battery2Manufacturer { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 16); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(16 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -422,10 +749,23 @@ namespace Battery2Size { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -436,10 +776,23 @@ namespace Battery2AhrRating { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -450,10 +803,23 @@ namespace Battery2Quantity { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -464,10 +830,23 @@ namespace Battery2RatedVoltage { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -478,10 +857,23 @@ namespace Battery2AlarmMask { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_BITMAP8_ATTRIBUTE_TYPE); } @@ -492,10 +884,23 @@ namespace Battery2VoltageMinThreshold { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -506,10 +911,23 @@ namespace Battery2VoltageThreshold1 { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -520,10 +938,23 @@ namespace Battery2VoltageThreshold2 { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -534,10 +965,23 @@ namespace Battery2VoltageThreshold3 { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -548,10 +992,23 @@ namespace Battery2PercentageMinThreshold { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -562,10 +1019,23 @@ namespace Battery2PercentageThreshold1 { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -576,10 +1046,23 @@ namespace Battery2PercentageThreshold2 { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -590,10 +1073,23 @@ namespace Battery2PercentageThreshold3 { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -604,10 +1100,23 @@ namespace Battery2AlarmState { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_BITMAP32_ATTRIBUTE_TYPE); } @@ -618,10 +1127,23 @@ namespace Battery3Voltage { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -632,10 +1154,23 @@ namespace Battery3PercentageRemaining { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -646,16 +1181,23 @@ namespace Battery3Manufacturer { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 16); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(16 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -669,10 +1211,23 @@ namespace Battery3Size { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -683,10 +1238,23 @@ namespace Battery3AhrRating { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -697,10 +1265,23 @@ namespace Battery3Quantity { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -711,10 +1292,23 @@ namespace Battery3RatedVoltage { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -725,10 +1319,23 @@ namespace Battery3AlarmMask { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_BITMAP8_ATTRIBUTE_TYPE); } @@ -739,10 +1346,23 @@ namespace Battery3VoltageMinThreshold { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -753,10 +1373,23 @@ namespace Battery3VoltageThreshold1 { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -767,10 +1400,23 @@ namespace Battery3VoltageThreshold2 { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -781,10 +1427,23 @@ namespace Battery3VoltageThreshold3 { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -795,10 +1454,23 @@ namespace Battery3PercentageMinThreshold { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -809,10 +1481,23 @@ namespace Battery3PercentageThreshold1 { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -823,10 +1508,23 @@ namespace Battery3PercentageThreshold2 { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -837,10 +1535,23 @@ namespace Battery3PercentageThreshold3 { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -851,10 +1562,23 @@ namespace Battery3AlarmState { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerConfiguration::Id, Id, (uint8_t *) &value, ZCL_BITMAP32_ATTRIBUTE_TYPE); } @@ -871,11 +1595,23 @@ namespace CurrentTemperature { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DeviceTemperatureConfiguration::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DeviceTemperatureConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DeviceTemperatureConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -886,11 +1622,23 @@ namespace MinTempExperienced { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DeviceTemperatureConfiguration::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DeviceTemperatureConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DeviceTemperatureConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -901,11 +1649,23 @@ namespace MaxTempExperienced { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DeviceTemperatureConfiguration::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DeviceTemperatureConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DeviceTemperatureConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -916,11 +1676,23 @@ namespace OverTempTotalDwell { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DeviceTemperatureConfiguration::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DeviceTemperatureConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DeviceTemperatureConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -931,11 +1703,23 @@ namespace DeviceTempAlarmMask { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DeviceTemperatureConfiguration::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DeviceTemperatureConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DeviceTemperatureConfiguration::Id, Id, (uint8_t *) &value, ZCL_BITMAP8_ATTRIBUTE_TYPE); } @@ -946,11 +1730,23 @@ namespace LowTempThreshold { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DeviceTemperatureConfiguration::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DeviceTemperatureConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DeviceTemperatureConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -961,11 +1757,23 @@ namespace HighTempThreshold { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DeviceTemperatureConfiguration::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DeviceTemperatureConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DeviceTemperatureConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -982,10 +1790,23 @@ namespace IdentifyTime { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Identify::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Identify::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Identify::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -995,10 +1816,23 @@ namespace IdentifyType { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Identify::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Identify::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Identify::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -1014,10 +1848,23 @@ namespace NameSupport { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Groups::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Groups::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Groups::Id, Id, (uint8_t *) &value, ZCL_BITMAP8_ATTRIBUTE_TYPE); } @@ -1033,10 +1880,23 @@ namespace SceneCount { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Scenes::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Scenes::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Scenes::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -1046,10 +1906,23 @@ namespace CurrentScene { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Scenes::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Scenes::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Scenes::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -1059,10 +1932,23 @@ namespace CurrentGroup { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Scenes::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Scenes::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Scenes::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -1072,10 +1958,23 @@ namespace SceneValid { EmberAfStatus Get(chip::EndpointId endpoint, bool * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Scenes::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Scenes::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, bool value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Scenes::Id, Id, (uint8_t *) &value, ZCL_BOOLEAN_ATTRIBUTE_TYPE); } @@ -1085,10 +1984,23 @@ namespace NameSupport { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Scenes::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Scenes::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Scenes::Id, Id, (uint8_t *) &value, ZCL_BITMAP8_ATTRIBUTE_TYPE); } @@ -1098,10 +2010,23 @@ namespace LastConfiguredBy { EmberAfStatus Get(chip::EndpointId endpoint, chip::NodeId * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Scenes::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Scenes::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::NodeId value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Scenes::Id, Id, (uint8_t *) &value, ZCL_NODE_ID_ATTRIBUTE_TYPE); } @@ -1117,10 +2042,23 @@ namespace OnOff { EmberAfStatus Get(chip::EndpointId endpoint, bool * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OnOff::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::OnOff::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, bool value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OnOff::Id, Id, (uint8_t *) &value, ZCL_BOOLEAN_ATTRIBUTE_TYPE); } @@ -1130,10 +2068,23 @@ namespace SampleMfgSpecificAttribute0x00000x1002 { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OnOff::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::OnOff::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OnOff::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -1143,10 +2094,23 @@ namespace SampleMfgSpecificAttribute0x00000x1049 { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OnOff::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::OnOff::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OnOff::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -1156,10 +2120,23 @@ namespace SampleMfgSpecificAttribute0x00010x1002 { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OnOff::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::OnOff::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OnOff::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -1169,10 +2146,23 @@ namespace SampleMfgSpecificAttribute0x00010x1040 { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OnOff::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::OnOff::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OnOff::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -1182,10 +2172,23 @@ namespace GlobalSceneControl { EmberAfStatus Get(chip::EndpointId endpoint, bool * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OnOff::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::OnOff::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, bool value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OnOff::Id, Id, (uint8_t *) &value, ZCL_BOOLEAN_ATTRIBUTE_TYPE); } @@ -1195,10 +2198,23 @@ namespace OnTime { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OnOff::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::OnOff::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OnOff::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -1208,10 +2224,23 @@ namespace OffWaitTime { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OnOff::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::OnOff::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OnOff::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -1221,10 +2250,23 @@ namespace StartUpOnOff { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OnOff::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::OnOff::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OnOff::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -1240,10 +2282,23 @@ namespace SwitchType { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OnOffSwitchConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::OnOffSwitchConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OnOffSwitchConfiguration::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -1254,10 +2309,23 @@ namespace SwitchActions { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OnOffSwitchConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::OnOffSwitchConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OnOffSwitchConfiguration::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -1274,10 +2342,23 @@ namespace CurrentLevel { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::LevelControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::LevelControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::LevelControl::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -1287,10 +2368,23 @@ namespace RemainingTime { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::LevelControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::LevelControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::LevelControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -1300,10 +2394,23 @@ namespace MinLevel { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::LevelControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::LevelControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::LevelControl::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -1313,10 +2420,23 @@ namespace MaxLevel { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::LevelControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::LevelControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::LevelControl::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -1326,10 +2446,23 @@ namespace CurrentFrequency { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::LevelControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::LevelControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::LevelControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -1339,10 +2472,23 @@ namespace MinFrequency { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::LevelControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::LevelControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::LevelControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -1352,10 +2498,23 @@ namespace MaxFrequency { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::LevelControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::LevelControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::LevelControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -1365,10 +2524,23 @@ namespace Options { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::LevelControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::LevelControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::LevelControl::Id, Id, (uint8_t *) &value, ZCL_BITMAP8_ATTRIBUTE_TYPE); } @@ -1378,10 +2550,23 @@ namespace OnOffTransitionTime { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::LevelControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::LevelControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::LevelControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -1391,10 +2576,23 @@ namespace OnLevel { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::LevelControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::LevelControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::LevelControl::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -1404,10 +2602,23 @@ namespace OnTransitionTime { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::LevelControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::LevelControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::LevelControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -1417,10 +2628,23 @@ namespace OffTransitionTime { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::LevelControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::LevelControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::LevelControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -1430,10 +2654,23 @@ namespace DefaultMoveRate { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::LevelControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::LevelControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::LevelControl::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -1443,10 +2680,23 @@ namespace StartUpCurrentLevel { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::LevelControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::LevelControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::LevelControl::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -1462,10 +2712,23 @@ namespace AlarmCount { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Alarms::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Alarms::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Alarms::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -1481,10 +2744,23 @@ namespace Time { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Time::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Time::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Time::Id, Id, (uint8_t *) &value, ZCL_EPOCH_S_ATTRIBUTE_TYPE); } @@ -1494,10 +2770,23 @@ namespace TimeStatus { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Time::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Time::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Time::Id, Id, (uint8_t *) &value, ZCL_BITMAP8_ATTRIBUTE_TYPE); } @@ -1507,10 +2796,23 @@ namespace TimeZone { EmberAfStatus Get(chip::EndpointId endpoint, int32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Time::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Time::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Time::Id, Id, (uint8_t *) &value, ZCL_INT32S_ATTRIBUTE_TYPE); } @@ -1520,10 +2822,23 @@ namespace DstStart { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Time::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Time::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Time::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -1533,10 +2848,23 @@ namespace DstEnd { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Time::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Time::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Time::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -1546,10 +2874,23 @@ namespace DstShift { EmberAfStatus Get(chip::EndpointId endpoint, int32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Time::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Time::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Time::Id, Id, (uint8_t *) &value, ZCL_INT32S_ATTRIBUTE_TYPE); } @@ -1559,10 +2900,23 @@ namespace StandardTime { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Time::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Time::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Time::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -1572,10 +2926,23 @@ namespace LocalTime { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Time::Id, Id, (uint8_t *) value, sizeof(*value)); -} + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Time::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; +} EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Time::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -1585,10 +2952,23 @@ namespace LastSetTime { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Time::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Time::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Time::Id, Id, (uint8_t *) &value, ZCL_EPOCH_S_ATTRIBUTE_TYPE); } @@ -1598,10 +2978,23 @@ namespace ValidUntilTime { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Time::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Time::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Time::Id, Id, (uint8_t *) &value, ZCL_EPOCH_S_ATTRIBUTE_TYPE); } @@ -1617,16 +3010,23 @@ namespace ActiveText { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BinaryInputBasic::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 16); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(16 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -1640,16 +3040,23 @@ namespace Description { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BinaryInputBasic::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 16); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(16 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -1663,16 +3070,23 @@ namespace InactiveText { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BinaryInputBasic::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 16); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(16 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -1686,10 +3100,23 @@ namespace OutOfService { EmberAfStatus Get(chip::EndpointId endpoint, bool * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BinaryInputBasic::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::BinaryInputBasic::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, bool value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BinaryInputBasic::Id, Id, (uint8_t *) &value, ZCL_BOOLEAN_ATTRIBUTE_TYPE); } @@ -1700,10 +3127,23 @@ namespace Polarity { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BinaryInputBasic::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::BinaryInputBasic::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BinaryInputBasic::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -1713,10 +3153,23 @@ namespace PresentValue { EmberAfStatus Get(chip::EndpointId endpoint, bool * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BinaryInputBasic::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::BinaryInputBasic::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, bool value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BinaryInputBasic::Id, Id, (uint8_t *) &value, ZCL_BOOLEAN_ATTRIBUTE_TYPE); } @@ -1727,10 +3180,23 @@ namespace Reliability { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BinaryInputBasic::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::BinaryInputBasic::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BinaryInputBasic::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -1740,10 +3206,23 @@ namespace StatusFlags { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BinaryInputBasic::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::BinaryInputBasic::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BinaryInputBasic::Id, Id, (uint8_t *) &value, ZCL_BITMAP8_ATTRIBUTE_TYPE); } @@ -1754,10 +3233,23 @@ namespace ApplicationType { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BinaryInputBasic::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::BinaryInputBasic::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BinaryInputBasic::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -1773,10 +3265,23 @@ namespace TotalProfileNum { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerProfile::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PowerProfile::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerProfile::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -1786,10 +3291,23 @@ namespace MultipleScheduling { EmberAfStatus Get(chip::EndpointId endpoint, bool * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerProfile::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PowerProfile::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, bool value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerProfile::Id, Id, (uint8_t *) &value, ZCL_BOOLEAN_ATTRIBUTE_TYPE); } @@ -1799,10 +3317,23 @@ namespace EnergyFormatting { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerProfile::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PowerProfile::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerProfile::Id, Id, (uint8_t *) &value, ZCL_BITMAP8_ATTRIBUTE_TYPE); } @@ -1812,10 +3343,23 @@ namespace EnergyRemote { EmberAfStatus Get(chip::EndpointId endpoint, bool * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerProfile::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PowerProfile::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, bool value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerProfile::Id, Id, (uint8_t *) &value, ZCL_BOOLEAN_ATTRIBUTE_TYPE); } @@ -1825,10 +3369,23 @@ namespace ScheduleMode { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerProfile::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PowerProfile::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerProfile::Id, Id, (uint8_t *) &value, ZCL_BITMAP8_ATTRIBUTE_TYPE); } @@ -1844,10 +3401,23 @@ namespace StartTime { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ApplianceControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ApplianceControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ApplianceControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -1857,10 +3427,23 @@ namespace FinishTime { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ApplianceControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ApplianceControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ApplianceControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -1870,10 +3453,23 @@ namespace RemainingTime { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ApplianceControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ApplianceControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ApplianceControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -1895,10 +3491,23 @@ namespace CheckInInterval { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PollControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PollControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PollControl::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -1908,10 +3517,23 @@ namespace LongPollInterval { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PollControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PollControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PollControl::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -1921,10 +3543,23 @@ namespace ShortPollInterval { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PollControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PollControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PollControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -1934,10 +3569,23 @@ namespace FastPollTimeout { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PollControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PollControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PollControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -1947,10 +3595,23 @@ namespace CheckInIntervalMin { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PollControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PollControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PollControl::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -1960,10 +3621,23 @@ namespace LongPollIntervalMin { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PollControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PollControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PollControl::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -1973,10 +3647,23 @@ namespace FastPollTimeoutMax { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PollControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PollControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PollControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -1992,16 +3679,23 @@ namespace SetupUrl { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 512, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[512 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BridgedActions::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 512, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 512); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(512 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 512, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[512 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -2021,10 +3715,23 @@ namespace InteractionModelVersion { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Basic::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Basic::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Basic::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -2034,16 +3741,23 @@ namespace VendorName { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::Basic::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 32); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(32 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -2057,10 +3771,23 @@ namespace VendorID { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Basic::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Basic::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Basic::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -2070,16 +3797,23 @@ namespace ProductName { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::Basic::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 32); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(32 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -2093,10 +3827,23 @@ namespace ProductID { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Basic::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Basic::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Basic::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -2106,16 +3853,23 @@ namespace UserLabel { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::Basic::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 32); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(32 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -2129,16 +3883,23 @@ namespace Location { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 2, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[2 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::Basic::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 2, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 2); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(2 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 2, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[2 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -2152,10 +3913,23 @@ namespace HardwareVersion { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Basic::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Basic::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Basic::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -2165,16 +3939,23 @@ namespace HardwareVersionString { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 64, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[64 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::Basic::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 64, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 64); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(64 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 64, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[64 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -2188,10 +3969,23 @@ namespace SoftwareVersion { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Basic::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Basic::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Basic::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -2201,16 +3995,23 @@ namespace SoftwareVersionString { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 64, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[64 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::Basic::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 64, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 64); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(64 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 64, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[64 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -2224,16 +4025,23 @@ namespace ManufacturingDate { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::Basic::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 16); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(16 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -2247,16 +4055,23 @@ namespace PartNumber { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::Basic::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 32); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(32 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -2270,16 +4085,23 @@ namespace ProductURL { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 256, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[256 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::Basic::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 256, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 256); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(256 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 256, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[256 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -2293,16 +4115,23 @@ namespace ProductLabel { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 64, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[64 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::Basic::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 64, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 64); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(64 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 64, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[64 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -2316,16 +4145,23 @@ namespace SerialNumber { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::Basic::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 32); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(32 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -2339,10 +4175,23 @@ namespace LocalConfigDisabled { EmberAfStatus Get(chip::EndpointId endpoint, bool * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Basic::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Basic::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, bool value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Basic::Id, Id, (uint8_t *) &value, ZCL_BOOLEAN_ATTRIBUTE_TYPE); } @@ -2352,10 +4201,23 @@ namespace Reachable { EmberAfStatus Get(chip::EndpointId endpoint, bool * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Basic::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Basic::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, bool value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Basic::Id, Id, (uint8_t *) &value, ZCL_BOOLEAN_ATTRIBUTE_TYPE); } @@ -2371,17 +4233,24 @@ namespace DefaultOtaProvider { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableByteSpan value) { - VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::OtaSoftwareUpdateRequestor::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 16); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::ByteSpan value) { + static_assert(16 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -2396,10 +4265,23 @@ namespace UpdatePossible { EmberAfStatus Get(chip::EndpointId endpoint, bool * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OtaSoftwareUpdateRequestor::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::OtaSoftwareUpdateRequestor::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, bool value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OtaSoftwareUpdateRequestor::Id, Id, (uint8_t *) &value, ZCL_BOOLEAN_ATTRIBUTE_TYPE); } @@ -2416,10 +4298,23 @@ namespace Status { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -2429,10 +4324,23 @@ namespace Order { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -2442,16 +4350,23 @@ namespace Description { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 60, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[60 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 60, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 60); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(60 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 60, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[60 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -2465,10 +4380,23 @@ namespace WiredAssessedInputVoltage { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -2478,10 +4406,23 @@ namespace WiredAssessedInputFrequency { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -2491,10 +4432,23 @@ namespace WiredCurrentType { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -2504,10 +4458,23 @@ namespace WiredAssessedCurrent { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -2517,10 +4484,23 @@ namespace WiredNominalVoltage { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -2530,10 +4510,23 @@ namespace WiredMaximumCurrent { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -2543,10 +4536,23 @@ namespace WiredPresent { EmberAfStatus Get(chip::EndpointId endpoint, bool * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, bool value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) &value, ZCL_BOOLEAN_ATTRIBUTE_TYPE); } @@ -2556,10 +4562,23 @@ namespace BatteryVoltage { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -2569,10 +4588,23 @@ namespace BatteryPercentRemaining { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -2582,10 +4614,23 @@ namespace BatteryTimeRemaining { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -2595,10 +4640,23 @@ namespace BatteryChargeLevel { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -2608,10 +4666,23 @@ namespace BatteryReplacementNeeded { EmberAfStatus Get(chip::EndpointId endpoint, bool * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, bool value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) &value, ZCL_BOOLEAN_ATTRIBUTE_TYPE); } @@ -2621,10 +4692,23 @@ namespace BatteryReplaceability { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -2634,10 +4718,23 @@ namespace BatteryPresent { EmberAfStatus Get(chip::EndpointId endpoint, bool * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, bool value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) &value, ZCL_BOOLEAN_ATTRIBUTE_TYPE); } @@ -2647,16 +4744,23 @@ namespace BatteryReplacementDescription { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 60, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[60 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 60, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 60); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(60 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 60, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[60 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -2670,10 +4774,23 @@ namespace BatteryCommonDesignation { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -2683,16 +4800,23 @@ namespace BatteryANSIDesignation { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 20, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[20 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 20, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 20); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(20 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 20, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[20 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -2706,16 +4830,23 @@ namespace BatteryIECDesignation { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 20, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[20 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 20, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 20); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(20 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 20, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[20 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -2729,10 +4860,23 @@ namespace BatteryApprovedChemistry { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -2742,10 +4886,23 @@ namespace BatteryCapacity { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -2755,10 +4912,23 @@ namespace BatteryQuantity { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -2768,10 +4938,23 @@ namespace BatteryChargeState { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -2781,10 +4964,23 @@ namespace BatteryTimeToFullCharge { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -2794,10 +4990,23 @@ namespace BatteryFunctionalWhileCharging { EmberAfStatus Get(chip::EndpointId endpoint, bool * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, bool value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) &value, ZCL_BOOLEAN_ATTRIBUTE_TYPE); } @@ -2807,10 +5016,23 @@ namespace BatteryChargingCurrent { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::PowerSource::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PowerSource::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -2826,10 +5048,23 @@ namespace Breadcrumb { EmberAfStatus Get(chip::EndpointId endpoint, uint64_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::GeneralCommissioning::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::GeneralCommissioning::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::GeneralCommissioning::Id, Id, (uint8_t *) &value, ZCL_INT64U_ATTRIBUTE_TYPE); } @@ -2846,10 +5081,23 @@ namespace RebootCount { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::GeneralDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::GeneralDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::GeneralDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -2860,10 +5108,23 @@ namespace UpTime { EmberAfStatus Get(chip::EndpointId endpoint, uint64_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::GeneralDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::GeneralDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::GeneralDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT64U_ATTRIBUTE_TYPE); } @@ -2874,10 +5135,23 @@ namespace TotalOperationalHours { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::GeneralDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::GeneralDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::GeneralDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -2888,10 +5162,23 @@ namespace BootReasons { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::GeneralDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::GeneralDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::GeneralDiagnostics::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -2908,10 +5195,23 @@ namespace CurrentHeapFree { EmberAfStatus Get(chip::EndpointId endpoint, uint64_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::SoftwareDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::SoftwareDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::SoftwareDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT64U_ATTRIBUTE_TYPE); } @@ -2922,10 +5222,23 @@ namespace CurrentHeapUsed { EmberAfStatus Get(chip::EndpointId endpoint, uint64_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::SoftwareDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::SoftwareDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::SoftwareDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT64U_ATTRIBUTE_TYPE); } @@ -2936,10 +5249,23 @@ namespace CurrentHeapHighWatermark { EmberAfStatus Get(chip::EndpointId endpoint, uint64_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::SoftwareDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::SoftwareDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::SoftwareDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT64U_ATTRIBUTE_TYPE); } @@ -2956,10 +5282,23 @@ namespace Channel { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -2970,10 +5309,23 @@ namespace RoutingRole { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -2984,17 +5336,24 @@ namespace NetworkName { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableByteSpan value) { - VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 16); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::ByteSpan value) { + static_assert(16 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -3009,10 +5368,23 @@ namespace PanId { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -3023,10 +5395,23 @@ namespace ExtendedPanId { EmberAfStatus Get(chip::EndpointId endpoint, uint64_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT64U_ATTRIBUTE_TYPE); } @@ -3037,17 +5422,24 @@ namespace MeshLocalPrefix { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableByteSpan value) { - VerifyOrReturnError(value.size() == 17, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[17 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 17, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 17); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::ByteSpan value) { + static_assert(17 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 17, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[17 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -3062,10 +5454,23 @@ namespace OverrunCount { EmberAfStatus Get(chip::EndpointId endpoint, uint64_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT64U_ATTRIBUTE_TYPE); } @@ -3076,10 +5481,23 @@ namespace PartitionId { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3090,10 +5508,23 @@ namespace Weighting { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -3104,10 +5535,23 @@ namespace DataVersion { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -3118,10 +5562,23 @@ namespace StableDataVersion { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -3132,10 +5589,23 @@ namespace LeaderRouterId { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -3146,10 +5616,23 @@ namespace DetachedRoleCount { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -3160,10 +5643,23 @@ namespace ChildRoleCount { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -3174,10 +5670,23 @@ namespace RouterRoleCount { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -3188,10 +5697,23 @@ namespace LeaderRoleCount { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -3202,10 +5724,23 @@ namespace AttachAttemptCount { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -3216,10 +5751,23 @@ namespace PartitionIdChangeCount { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -3230,10 +5778,23 @@ namespace BetterPartitionAttachAttemptCount { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -3244,10 +5805,23 @@ namespace ParentChangeCount { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -3258,10 +5832,23 @@ namespace TxTotalCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3272,10 +5859,23 @@ namespace TxUnicastCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3286,10 +5886,23 @@ namespace TxBroadcastCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3300,10 +5913,23 @@ namespace TxAckRequestedCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3314,10 +5940,23 @@ namespace TxAckedCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3328,10 +5967,23 @@ namespace TxNoAckRequestedCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3342,10 +5994,23 @@ namespace TxDataCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3356,10 +6021,23 @@ namespace TxDataPollCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3370,10 +6048,23 @@ namespace TxBeaconCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3384,10 +6075,23 @@ namespace TxBeaconRequestCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3398,10 +6102,23 @@ namespace TxOtherCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3412,10 +6129,23 @@ namespace TxRetryCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3426,10 +6156,23 @@ namespace TxDirectMaxRetryExpiryCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3440,10 +6183,23 @@ namespace TxIndirectMaxRetryExpiryCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3454,10 +6210,23 @@ namespace TxErrCcaCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3468,10 +6237,23 @@ namespace TxErrAbortCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3482,10 +6264,23 @@ namespace TxErrBusyChannelCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3496,10 +6291,23 @@ namespace RxTotalCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3510,10 +6318,23 @@ namespace RxUnicastCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3524,10 +6345,23 @@ namespace RxBroadcastCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3538,10 +6372,23 @@ namespace RxDataCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3552,10 +6399,23 @@ namespace RxDataPollCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3566,10 +6426,23 @@ namespace RxBeaconCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3580,10 +6453,23 @@ namespace RxBeaconRequestCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3594,10 +6480,23 @@ namespace RxOtherCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3608,10 +6507,23 @@ namespace RxAddressFilteredCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3622,10 +6534,23 @@ namespace RxDestAddrFilteredCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3636,10 +6561,23 @@ namespace RxDuplicatedCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3650,10 +6588,23 @@ namespace RxErrNoFrameCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3664,10 +6615,23 @@ namespace RxErrUnknownNeighborCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3678,10 +6642,23 @@ namespace RxErrInvalidSrcAddrCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3692,10 +6669,23 @@ namespace RxErrSecCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3706,10 +6696,23 @@ namespace RxErrFcsCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3720,10 +6723,23 @@ namespace RxErrOtherCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3734,10 +6750,23 @@ namespace ActiveTimestamp { EmberAfStatus Get(chip::EndpointId endpoint, uint64_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT64U_ATTRIBUTE_TYPE); } @@ -3748,10 +6777,23 @@ namespace PendingTimestamp { EmberAfStatus Get(chip::EndpointId endpoint, uint64_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT64U_ATTRIBUTE_TYPE); } @@ -3762,10 +6804,23 @@ namespace Delay { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3776,17 +6831,24 @@ namespace ChannelMask { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableByteSpan value) { - VerifyOrReturnError(value.size() == 4, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[4 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThreadNetworkDiagnostics::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 4, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 4); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::ByteSpan value) { + static_assert(4 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 4, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[4 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -3807,17 +6869,24 @@ namespace Bssid { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableByteSpan value) { - VerifyOrReturnError(value.size() == 6, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[6 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 6, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 6); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::ByteSpan value) { + static_assert(6 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 6, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[6 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -3832,10 +6901,23 @@ namespace SecurityType { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -3846,10 +6928,23 @@ namespace WiFiVersion { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -3860,10 +6955,23 @@ namespace ChannelNumber { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -3874,10 +6982,23 @@ namespace Rssi { EmberAfStatus Get(chip::EndpointId endpoint, int8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT8S_ATTRIBUTE_TYPE); } @@ -3888,10 +7009,23 @@ namespace BeaconLostCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3902,10 +7036,23 @@ namespace BeaconRxCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3916,10 +7063,23 @@ namespace PacketMulticastRxCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3930,10 +7090,23 @@ namespace PacketMulticastTxCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3944,10 +7117,23 @@ namespace PacketUnicastRxCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3958,10 +7144,23 @@ namespace PacketUnicastTxCount { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -3972,10 +7171,23 @@ namespace CurrentMaxRate { EmberAfStatus Get(chip::EndpointId endpoint, uint64_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT64U_ATTRIBUTE_TYPE); } @@ -3986,10 +7198,23 @@ namespace OverrunCount { EmberAfStatus Get(chip::EndpointId endpoint, uint64_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WiFiNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT64U_ATTRIBUTE_TYPE); } @@ -4006,10 +7231,23 @@ namespace PHYRate { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::EthernetNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::EthernetNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::EthernetNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -4020,10 +7258,23 @@ namespace FullDuplex { EmberAfStatus Get(chip::EndpointId endpoint, bool * value) { - return emberAfReadServerAttribute(endpoint, Clusters::EthernetNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::EthernetNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, bool value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::EthernetNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_BOOLEAN_ATTRIBUTE_TYPE); } @@ -4034,10 +7285,23 @@ namespace PacketRxCount { EmberAfStatus Get(chip::EndpointId endpoint, uint64_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::EthernetNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::EthernetNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::EthernetNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT64U_ATTRIBUTE_TYPE); } @@ -4048,10 +7312,23 @@ namespace PacketTxCount { EmberAfStatus Get(chip::EndpointId endpoint, uint64_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::EthernetNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::EthernetNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::EthernetNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT64U_ATTRIBUTE_TYPE); } @@ -4062,10 +7339,23 @@ namespace TxErrCount { EmberAfStatus Get(chip::EndpointId endpoint, uint64_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::EthernetNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::EthernetNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::EthernetNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT64U_ATTRIBUTE_TYPE); } @@ -4076,10 +7366,23 @@ namespace CollisionCount { EmberAfStatus Get(chip::EndpointId endpoint, uint64_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::EthernetNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::EthernetNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::EthernetNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT64U_ATTRIBUTE_TYPE); } @@ -4090,10 +7393,23 @@ namespace OverrunCount { EmberAfStatus Get(chip::EndpointId endpoint, uint64_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::EthernetNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::EthernetNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::EthernetNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT64U_ATTRIBUTE_TYPE); } @@ -4104,10 +7420,23 @@ namespace CarrierDetect { EmberAfStatus Get(chip::EndpointId endpoint, bool * value) { - return emberAfReadServerAttribute(endpoint, Clusters::EthernetNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::EthernetNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, bool value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::EthernetNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_BOOLEAN_ATTRIBUTE_TYPE); } @@ -4118,10 +7447,23 @@ namespace TimeSinceReset { EmberAfStatus Get(chip::EndpointId endpoint, uint64_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::EthernetNetworkDiagnostics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::EthernetNetworkDiagnostics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::EthernetNetworkDiagnostics::Id, Id, (uint8_t *) &value, ZCL_INT64U_ATTRIBUTE_TYPE); } @@ -4138,16 +7480,23 @@ namespace VendorName { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BridgedDeviceBasic::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 32); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(32 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -4161,10 +7510,23 @@ namespace VendorID { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BridgedDeviceBasic::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BridgedDeviceBasic::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BridgedDeviceBasic::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -4175,16 +7537,23 @@ namespace ProductName { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BridgedDeviceBasic::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 32); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(32 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -4198,16 +7567,23 @@ namespace UserLabel { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BridgedDeviceBasic::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 32); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(32 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -4221,10 +7597,23 @@ namespace HardwareVersion { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BridgedDeviceBasic::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BridgedDeviceBasic::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BridgedDeviceBasic::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -4235,16 +7624,23 @@ namespace HardwareVersionString { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 64, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[64 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BridgedDeviceBasic::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 64, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 64); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(64 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 64, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[64 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -4258,10 +7654,23 @@ namespace SoftwareVersion { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BridgedDeviceBasic::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BridgedDeviceBasic::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BridgedDeviceBasic::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -4272,16 +7681,23 @@ namespace SoftwareVersionString { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 64, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[64 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BridgedDeviceBasic::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 64, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 64); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(64 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 64, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[64 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -4295,16 +7711,23 @@ namespace ManufacturingDate { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BridgedDeviceBasic::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 16); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(16 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -4318,16 +7741,23 @@ namespace PartNumber { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 254, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[254 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BridgedDeviceBasic::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 254, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 254); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(254 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 254, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[254 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -4341,16 +7771,23 @@ namespace ProductURL { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 254, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[254 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BridgedDeviceBasic::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 254, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 254); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(254 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 254, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[254 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -4364,16 +7801,23 @@ namespace ProductLabel { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 64, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[64 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BridgedDeviceBasic::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 64, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 64); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(64 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 64, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[64 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -4387,16 +7831,23 @@ namespace SerialNumber { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BridgedDeviceBasic::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 32); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(32 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -4410,10 +7861,23 @@ namespace Reachable { EmberAfStatus Get(chip::EndpointId endpoint, bool * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BridgedDeviceBasic::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BridgedDeviceBasic::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, bool value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BridgedDeviceBasic::Id, Id, (uint8_t *) &value, ZCL_BOOLEAN_ATTRIBUTE_TYPE); } @@ -4430,10 +7894,23 @@ namespace NumberOfPositions { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Switch::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Switch::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Switch::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -4443,10 +7920,23 @@ namespace CurrentPosition { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Switch::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Switch::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Switch::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -4456,10 +7946,23 @@ namespace MultiPressMax { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Switch::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Switch::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Switch::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -4475,10 +7978,23 @@ namespace SupportedFabrics { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OperationalCredentials::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::OperationalCredentials::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OperationalCredentials::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -4489,10 +8005,23 @@ namespace CommissionedFabrics { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OperationalCredentials::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::OperationalCredentials::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OperationalCredentials::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -4503,10 +8032,23 @@ namespace CurrentFabricIndex { EmberAfStatus Get(chip::EndpointId endpoint, chip::FabricIndex * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OperationalCredentials::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::OperationalCredentials::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::FabricIndex value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OperationalCredentials::Id, Id, (uint8_t *) &value, ZCL_FABRIC_IDX_ATTRIBUTE_TYPE); } @@ -4529,10 +8071,23 @@ namespace StateValue { EmberAfStatus Get(chip::EndpointId endpoint, bool * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BooleanState::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::BooleanState::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, bool value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BooleanState::Id, Id, (uint8_t *) &value, ZCL_BOOLEAN_ATTRIBUTE_TYPE); } @@ -4548,10 +8103,23 @@ namespace CurrentMode { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ModeSelect::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ModeSelect::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ModeSelect::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -4561,10 +8129,23 @@ namespace OnMode { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ModeSelect::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ModeSelect::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ModeSelect::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -4574,10 +8155,23 @@ namespace StartUpMode { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ModeSelect::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ModeSelect::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ModeSelect::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -4587,16 +8181,23 @@ namespace Description { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ModeSelect::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 32); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(32 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -4616,10 +8217,23 @@ namespace PhysicalClosedLimit { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ShadeConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ShadeConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ShadeConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -4630,10 +8244,23 @@ namespace MotorStepSize { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ShadeConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ShadeConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ShadeConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -4644,10 +8271,23 @@ namespace Status { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ShadeConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ShadeConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ShadeConfiguration::Id, Id, (uint8_t *) &value, ZCL_BITMAP8_ATTRIBUTE_TYPE); } @@ -4658,10 +8298,23 @@ namespace ClosedLimit { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ShadeConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ShadeConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ShadeConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -4672,10 +8325,23 @@ namespace Mode { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ShadeConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ShadeConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ShadeConfiguration::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -4692,10 +8358,23 @@ namespace LockState { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -4705,10 +8384,23 @@ namespace LockType { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -4718,10 +8410,23 @@ namespace ActuatorEnabled { EmberAfStatus Get(chip::EndpointId endpoint, bool * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, bool value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_BOOLEAN_ATTRIBUTE_TYPE); } @@ -4731,10 +8436,23 @@ namespace DoorState { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -4744,10 +8462,23 @@ namespace DoorOpenEvents { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -4757,10 +8488,23 @@ namespace DoorClosedEvents { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -4770,10 +8514,23 @@ namespace OpenPeriod { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -4783,10 +8540,23 @@ namespace NumLockRecordsSupported { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -4796,10 +8566,23 @@ namespace NumTotalUsersSupported { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); -} -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -4809,10 +8592,23 @@ namespace NumPinUsersSupported { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -4822,10 +8618,23 @@ namespace NumRfidUsersSupported { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -4835,10 +8644,23 @@ namespace NumWeekdaySchedulesSupportedPerUser { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -4848,10 +8670,23 @@ namespace NumYeardaySchedulesSupportedPerUser { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -4861,10 +8696,23 @@ namespace NumHolidaySchedulesSupportedPerUser { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -4874,10 +8722,23 @@ namespace MaxPinLength { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -4887,10 +8748,23 @@ namespace MinPinLength { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -4900,10 +8774,23 @@ namespace MaxRfidCodeLength { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -4913,10 +8800,23 @@ namespace MinRfidCodeLength { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -4926,10 +8826,23 @@ namespace EnableLogging { EmberAfStatus Get(chip::EndpointId endpoint, bool * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, bool value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_BOOLEAN_ATTRIBUTE_TYPE); } @@ -4939,16 +8852,23 @@ namespace Language { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 2, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[2 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 2, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 2); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(2 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 2, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[2 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -4962,10 +8882,23 @@ namespace LedSettings { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -4975,10 +8908,23 @@ namespace AutoRelockTime { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -4988,10 +8934,23 @@ namespace SoundVolume { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -5001,10 +8960,23 @@ namespace OperatingMode { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -5014,10 +8986,23 @@ namespace SupportedOperatingModes { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_BITMAP16_ATTRIBUTE_TYPE); } @@ -5027,10 +9012,23 @@ namespace DefaultConfigurationRegister { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_BITMAP16_ATTRIBUTE_TYPE); } @@ -5040,10 +9038,23 @@ namespace EnableLocalProgramming { EmberAfStatus Get(chip::EndpointId endpoint, bool * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, bool value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_BOOLEAN_ATTRIBUTE_TYPE); } @@ -5053,10 +9064,23 @@ namespace EnableOneTouchLocking { EmberAfStatus Get(chip::EndpointId endpoint, bool * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, bool value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_BOOLEAN_ATTRIBUTE_TYPE); } @@ -5066,10 +9090,23 @@ namespace EnableInsideStatusLed { EmberAfStatus Get(chip::EndpointId endpoint, bool * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, bool value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_BOOLEAN_ATTRIBUTE_TYPE); } @@ -5079,10 +9116,23 @@ namespace EnablePrivacyModeButton { EmberAfStatus Get(chip::EndpointId endpoint, bool * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, bool value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_BOOLEAN_ATTRIBUTE_TYPE); } @@ -5092,10 +9142,23 @@ namespace WrongCodeEntryLimit { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -5105,10 +9168,23 @@ namespace UserCodeTemporaryDisableTime { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -5118,10 +9194,23 @@ namespace SendPinOverTheAir { EmberAfStatus Get(chip::EndpointId endpoint, bool * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, bool value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_BOOLEAN_ATTRIBUTE_TYPE); } @@ -5131,10 +9220,23 @@ namespace RequirePinForRfOperation { EmberAfStatus Get(chip::EndpointId endpoint, bool * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, bool value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_BOOLEAN_ATTRIBUTE_TYPE); } @@ -5144,10 +9246,23 @@ namespace ZigbeeSecurityLevel { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -5157,10 +9272,23 @@ namespace AlarmMask { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_BITMAP16_ATTRIBUTE_TYPE); } @@ -5170,10 +9298,23 @@ namespace KeypadOperationEventMask { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_BITMAP16_ATTRIBUTE_TYPE); } @@ -5183,10 +9324,23 @@ namespace RfOperationEventMask { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_BITMAP16_ATTRIBUTE_TYPE); } @@ -5196,10 +9350,23 @@ namespace ManualOperationEventMask { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_BITMAP16_ATTRIBUTE_TYPE); } @@ -5209,10 +9376,23 @@ namespace RfidOperationEventMask { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_BITMAP16_ATTRIBUTE_TYPE); } @@ -5222,10 +9402,23 @@ namespace KeypadProgrammingEventMask { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_BITMAP16_ATTRIBUTE_TYPE); } @@ -5235,10 +9428,23 @@ namespace RfProgrammingEventMask { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_BITMAP16_ATTRIBUTE_TYPE); } @@ -5248,10 +9454,23 @@ namespace RfidProgrammingEventMask { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, (uint8_t *) &value, ZCL_BITMAP16_ATTRIBUTE_TYPE); } @@ -5267,10 +9486,23 @@ namespace Type { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -5280,10 +9512,23 @@ namespace PhysicalClosedLimitLift { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -5293,10 +9538,23 @@ namespace PhysicalClosedLimitTilt { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -5306,10 +9564,23 @@ namespace CurrentPositionLift { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -5319,10 +9590,23 @@ namespace CurrentPositionTilt { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -5332,10 +9616,23 @@ namespace NumberOfActuationsLift { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -5345,10 +9642,23 @@ namespace NumberOfActuationsTilt { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -5358,10 +9668,23 @@ namespace ConfigStatus { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) &value, ZCL_BITMAP8_ATTRIBUTE_TYPE); } @@ -5371,10 +9694,23 @@ namespace CurrentPositionLiftPercentage { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -5384,10 +9720,23 @@ namespace CurrentPositionTiltPercentage { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -5397,10 +9746,23 @@ namespace OperationalStatus { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) &value, ZCL_BITMAP8_ATTRIBUTE_TYPE); } @@ -5410,10 +9772,23 @@ namespace TargetPositionLiftPercent100ths { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -5423,10 +9798,23 @@ namespace TargetPositionTiltPercent100ths { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -5436,10 +9824,23 @@ namespace EndProductType { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -5449,10 +9850,23 @@ namespace CurrentPositionLiftPercent100ths { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -5462,10 +9876,23 @@ namespace CurrentPositionTiltPercent100ths { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -5475,10 +9902,23 @@ namespace InstalledOpenLimitLift { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -5488,10 +9928,23 @@ namespace InstalledClosedLimitLift { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -5501,10 +9954,23 @@ namespace InstalledOpenLimitTilt { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -5514,10 +9980,23 @@ namespace InstalledClosedLimitTilt { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -5527,10 +10006,23 @@ namespace VelocityLift { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -5540,10 +10032,23 @@ namespace AccelerationTimeLift { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -5553,10 +10058,23 @@ namespace DecelerationTimeLift { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -5566,10 +10084,23 @@ namespace Mode { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) &value, ZCL_BITMAP8_ATTRIBUTE_TYPE); } @@ -5579,16 +10110,23 @@ namespace IntermediateSetpointsLift { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableByteSpan value) { - VerifyOrReturnError(value.size() == 254, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[254 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 254, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 254); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::ByteSpan value) { + static_assert(254 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 254, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[254 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -5602,16 +10140,23 @@ namespace IntermediateSetpointsTilt { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableByteSpan value) { - VerifyOrReturnError(value.size() == 254, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[254 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 254, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 254); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::ByteSpan value) { + static_assert(254 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 254, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[254 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -5625,10 +10170,23 @@ namespace SafetyStatus { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, (uint8_t *) &value, ZCL_BITMAP16_ATTRIBUTE_TYPE); } @@ -5644,10 +10202,23 @@ namespace BarrierMovingState { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BarrierControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::BarrierControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BarrierControl::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -5657,10 +10228,23 @@ namespace BarrierSafetyStatus { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BarrierControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::BarrierControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BarrierControl::Id, Id, (uint8_t *) &value, ZCL_BITMAP16_ATTRIBUTE_TYPE); } @@ -5670,10 +10254,23 @@ namespace BarrierCapabilities { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BarrierControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::BarrierControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BarrierControl::Id, Id, (uint8_t *) &value, ZCL_BITMAP8_ATTRIBUTE_TYPE); } @@ -5683,10 +10280,23 @@ namespace BarrierOpenEvents { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BarrierControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::BarrierControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BarrierControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -5696,10 +10306,23 @@ namespace BarrierCloseEvents { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BarrierControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::BarrierControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BarrierControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -5709,10 +10332,23 @@ namespace BarrierCommandOpenEvents { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BarrierControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::BarrierControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BarrierControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -5722,10 +10358,23 @@ namespace BarrierCommandCloseEvents { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BarrierControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::BarrierControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BarrierControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -5735,10 +10384,23 @@ namespace BarrierOpenPeriod { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BarrierControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::BarrierControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BarrierControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -5748,10 +10410,23 @@ namespace BarrierClosePeriod { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BarrierControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::BarrierControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BarrierControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -5761,10 +10436,23 @@ namespace BarrierPosition { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BarrierControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::BarrierControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BarrierControl::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -5780,10 +10468,23 @@ namespace MaxPressure { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -5794,10 +10495,23 @@ namespace MaxSpeed { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -5808,10 +10522,23 @@ namespace MaxFlow { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -5822,10 +10549,23 @@ namespace MinConstPressure { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -5836,10 +10576,23 @@ namespace MaxConstPressure { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -5850,10 +10603,23 @@ namespace MinCompPressure { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -5864,10 +10630,23 @@ namespace MaxCompPressure { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -5878,10 +10657,23 @@ namespace MinConstSpeed { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -5892,10 +10684,23 @@ namespace MaxConstSpeed { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -5906,10 +10711,23 @@ namespace MinConstFlow { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -5920,10 +10738,23 @@ namespace MaxConstFlow { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -5934,10 +10765,23 @@ namespace MinConstTemp { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -5948,10 +10792,23 @@ namespace MaxConstTemp { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -5962,10 +10819,23 @@ namespace PumpStatus { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) &value, ZCL_BITMAP16_ATTRIBUTE_TYPE); } @@ -5976,10 +10846,23 @@ namespace EffectiveOperationMode { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -5990,10 +10873,23 @@ namespace EffectiveControlMode { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -6004,10 +10900,23 @@ namespace Capacity { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -6018,10 +10927,23 @@ namespace Speed { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -6032,10 +10954,23 @@ namespace LifetimeEnergyConsumed { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -6046,10 +10981,23 @@ namespace OperationMode { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -6060,10 +11008,23 @@ namespace ControlMode { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -6074,10 +11035,23 @@ namespace AlarmMask { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PumpConfigurationAndControl::Id, Id, (uint8_t *) &value, ZCL_BITMAP16_ATTRIBUTE_TYPE); } @@ -6094,10 +11068,23 @@ namespace LocalTemperature { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -6107,10 +11094,23 @@ namespace OutdoorTemperature { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -6120,10 +11120,23 @@ namespace Occupancy { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_BITMAP8_ATTRIBUTE_TYPE); } @@ -6133,10 +11146,23 @@ namespace AbsMinHeatSetpointLimit { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -6146,10 +11172,23 @@ namespace AbsMaxHeatSetpointLimit { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -6159,10 +11198,23 @@ namespace AbsMinCoolSetpointLimit { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -6172,10 +11224,23 @@ namespace AbsMaxCoolSetpointLimit { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -6185,10 +11250,23 @@ namespace PiCoolingDemand { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -6198,10 +11276,23 @@ namespace PiHeatingDemand { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -6211,10 +11302,23 @@ namespace HvacSystemTypeConfiguration { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_BITMAP8_ATTRIBUTE_TYPE); } @@ -6224,10 +11328,23 @@ namespace LocalTemperatureCalibration { EmberAfStatus Get(chip::EndpointId endpoint, int8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_INT8S_ATTRIBUTE_TYPE); } @@ -6237,10 +11354,23 @@ namespace OccupiedCoolingSetpoint { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -6250,10 +11380,23 @@ namespace OccupiedHeatingSetpoint { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -6263,10 +11406,23 @@ namespace UnoccupiedCoolingSetpoint { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -6276,10 +11432,23 @@ namespace UnoccupiedHeatingSetpoint { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -6289,10 +11458,23 @@ namespace MinHeatSetpointLimit { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -6302,10 +11484,23 @@ namespace MaxHeatSetpointLimit { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -6315,10 +11510,23 @@ namespace MinCoolSetpointLimit { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -6328,10 +11536,23 @@ namespace MaxCoolSetpointLimit { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -6341,10 +11562,23 @@ namespace MinSetpointDeadBand { EmberAfStatus Get(chip::EndpointId endpoint, int8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_INT8S_ATTRIBUTE_TYPE); } @@ -6354,10 +11588,23 @@ namespace RemoteSensing { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_BITMAP8_ATTRIBUTE_TYPE); } @@ -6367,10 +11614,23 @@ namespace ControlSequenceOfOperation { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -6380,10 +11640,23 @@ namespace SystemMode { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -6393,10 +11666,23 @@ namespace AlarmMask { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_BITMAP8_ATTRIBUTE_TYPE); } @@ -6406,10 +11692,23 @@ namespace ThermostatRunningMode { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -6419,10 +11718,23 @@ namespace StartOfWeek { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -6432,10 +11744,23 @@ namespace NumberOfWeeklyTransitions { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -6445,10 +11770,23 @@ namespace NumberOfDailyTransitions { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -6458,10 +11796,23 @@ namespace TemperatureSetpointHold { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -6471,10 +11822,23 @@ namespace TemperatureSetpointHoldDuration { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -6484,10 +11848,23 @@ namespace ThermostatProgrammingOperationMode { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_BITMAP8_ATTRIBUTE_TYPE); } @@ -6497,10 +11874,23 @@ namespace HvacRelayState { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_BITMAP16_ATTRIBUTE_TYPE); } @@ -6510,10 +11900,23 @@ namespace SetpointChangeSource { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -6523,10 +11926,23 @@ namespace SetpointChangeAmount { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -6536,10 +11952,23 @@ namespace SetpointChangeSourceTimestamp { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_EPOCH_S_ATTRIBUTE_TYPE); } @@ -6549,10 +11978,23 @@ namespace AcType { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -6562,10 +12004,23 @@ namespace AcCapacity { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -6575,10 +12030,23 @@ namespace AcRefrigerantType { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -6588,10 +12056,23 @@ namespace AcCompressor { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -6601,10 +12082,23 @@ namespace AcErrorCode { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_BITMAP32_ATTRIBUTE_TYPE); } @@ -6614,10 +12108,23 @@ namespace AcLouverPosition { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -6627,10 +12134,23 @@ namespace AcCoilTemperature { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -6640,10 +12160,23 @@ namespace AcCapacityFormat { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::Thermostat::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::Thermostat::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -6659,10 +12192,23 @@ namespace FanMode { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::FanControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::FanControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::FanControl::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -6672,10 +12218,23 @@ namespace FanModeSequence { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::FanControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::FanControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::FanControl::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -6691,10 +12250,23 @@ namespace RelativeHumidity { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DehumidificationControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DehumidificationControl::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DehumidificationControl::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -6705,10 +12277,23 @@ namespace DehumidificationCooling { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DehumidificationControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DehumidificationControl::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DehumidificationControl::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -6719,10 +12304,23 @@ namespace RhDehumidificationSetpoint { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DehumidificationControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DehumidificationControl::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DehumidificationControl::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -6733,10 +12331,23 @@ namespace RelativeHumidityMode { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DehumidificationControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DehumidificationControl::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DehumidificationControl::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -6747,10 +12358,23 @@ namespace DehumidificationLockout { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DehumidificationControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DehumidificationControl::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DehumidificationControl::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -6761,10 +12385,23 @@ namespace DehumidificationHysteresis { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DehumidificationControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DehumidificationControl::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DehumidificationControl::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -6775,10 +12412,23 @@ namespace DehumidificationMaxCool { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DehumidificationControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DehumidificationControl::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DehumidificationControl::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -6789,10 +12439,23 @@ namespace RelativeHumidityDisplay { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DehumidificationControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DehumidificationControl::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DehumidificationControl::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -6809,11 +12472,23 @@ namespace TemperatureDisplayMode { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThermostatUserInterfaceConfiguration::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThermostatUserInterfaceConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThermostatUserInterfaceConfiguration::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -6824,11 +12499,23 @@ namespace KeypadLockout { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThermostatUserInterfaceConfiguration::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThermostatUserInterfaceConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThermostatUserInterfaceConfiguration::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -6839,11 +12526,23 @@ namespace ScheduleProgrammingVisibility { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ThermostatUserInterfaceConfiguration::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ThermostatUserInterfaceConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ThermostatUserInterfaceConfiguration::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -6860,10 +12559,23 @@ namespace CurrentHue { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -6873,10 +12585,23 @@ namespace CurrentSaturation { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -6886,10 +12611,23 @@ namespace RemainingTime { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -6899,10 +12637,23 @@ namespace CurrentX { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -6912,10 +12663,23 @@ namespace CurrentY { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -6925,10 +12689,23 @@ namespace DriftCompensation { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -6938,16 +12715,23 @@ namespace CompensationText { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 254, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[254 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 254, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 254); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(254 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 254, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[254 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -6961,10 +12745,23 @@ namespace ColorTemperature { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -6974,10 +12771,23 @@ namespace ColorMode { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -6987,10 +12797,23 @@ namespace ColorControlOptions { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_BITMAP8_ATTRIBUTE_TYPE); } @@ -7000,10 +12823,23 @@ namespace NumberOfPrimaries { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -7013,10 +12849,23 @@ namespace Primary1X { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7026,10 +12875,23 @@ namespace Primary1Y { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7039,10 +12901,23 @@ namespace Primary1Intensity { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -7052,10 +12927,23 @@ namespace Primary2X { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7065,10 +12953,23 @@ namespace Primary2Y { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7078,10 +12979,23 @@ namespace Primary2Intensity { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -7091,10 +13005,23 @@ namespace Primary3X { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7104,10 +13031,23 @@ namespace Primary3Y { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7117,10 +13057,23 @@ namespace Primary3Intensity { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -7130,10 +13083,23 @@ namespace Primary4X { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7143,10 +13109,23 @@ namespace Primary4Y { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7156,10 +13135,23 @@ namespace Primary4Intensity { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -7169,10 +13161,23 @@ namespace Primary5X { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7182,10 +13187,23 @@ namespace Primary5Y { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7195,10 +13213,23 @@ namespace Primary5Intensity { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -7208,10 +13239,23 @@ namespace Primary6X { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7221,10 +13265,23 @@ namespace Primary6Y { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7234,10 +13291,23 @@ namespace Primary6Intensity { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -7247,10 +13317,23 @@ namespace WhitePointX { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7260,10 +13343,23 @@ namespace WhitePointY { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7273,10 +13369,23 @@ namespace ColorPointRX { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7286,10 +13395,23 @@ namespace ColorPointRY { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7299,10 +13421,23 @@ namespace ColorPointRIntensity { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -7312,10 +13447,23 @@ namespace ColorPointGX { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7325,10 +13473,23 @@ namespace ColorPointGY { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7338,10 +13499,23 @@ namespace ColorPointGIntensity { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -7351,10 +13525,23 @@ namespace ColorPointBX { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7364,10 +13551,23 @@ namespace ColorPointBY { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7377,10 +13577,23 @@ namespace ColorPointBIntensity { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -7390,10 +13603,23 @@ namespace EnhancedCurrentHue { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7403,10 +13629,23 @@ namespace EnhancedColorMode { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -7416,10 +13655,23 @@ namespace ColorLoopActive { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -7429,10 +13681,23 @@ namespace ColorLoopDirection { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -7442,10 +13707,23 @@ namespace ColorLoopTime { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7455,10 +13733,23 @@ namespace ColorLoopStartEnhancedHue { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7468,10 +13759,23 @@ namespace ColorLoopStoredEnhancedHue { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7481,10 +13785,23 @@ namespace ColorCapabilities { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_BITMAP16_ATTRIBUTE_TYPE); } @@ -7494,10 +13811,23 @@ namespace ColorTempPhysicalMin { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7507,10 +13837,23 @@ namespace ColorTempPhysicalMax { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7520,10 +13863,23 @@ namespace CoupleColorTempToLevelMinMireds { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7533,10 +13889,23 @@ namespace StartUpColorTemperatureMireds { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ColorControl::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ColorControl::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7552,10 +13921,23 @@ namespace PhysicalMinLevel { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -7566,10 +13948,23 @@ namespace PhysicalMaxLevel { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -7580,10 +13975,23 @@ namespace BallastStatus { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, (uint8_t *) &value, ZCL_BITMAP8_ATTRIBUTE_TYPE); } @@ -7594,10 +14002,23 @@ namespace MinLevel { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -7608,10 +14029,23 @@ namespace MaxLevel { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -7622,10 +14056,23 @@ namespace PowerOnLevel { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -7636,10 +14083,23 @@ namespace PowerOnFadeTime { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7650,10 +14110,23 @@ namespace IntrinsicBallastFactor { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -7664,10 +14137,23 @@ namespace BallastFactorAdjustment { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -7678,10 +14164,23 @@ namespace LampQuality { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -7692,17 +14191,24 @@ namespace LampType { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 16); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(16 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -7716,17 +14222,24 @@ namespace LampManufacturer { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 16); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(16 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -7740,10 +14253,23 @@ namespace LampAlarmMode { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BallastConfiguration::Id, Id, (uint8_t *) &value, ZCL_BITMAP8_ATTRIBUTE_TYPE); } @@ -7758,54 +14284,166 @@ namespace Attributes { namespace MeasuredValue { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) { - return emberAfReadServerAttribute(endpoint, Clusters::IlluminanceMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::IlluminanceMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (NumericAttributeTraits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = temp; + } + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ true, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::IlluminanceMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + auto value = NumericAttributeTraits::kNullValue; + return emberAfWriteServerAttribute(endpoint, Clusters::IlluminanceMeasurement::Id, Id, reinterpret_cast(&value), + ZCL_INT16U_ATTRIBUTE_TYPE); +} + +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + } // namespace MeasuredValue namespace MinMeasuredValue { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) { - return emberAfReadServerAttribute(endpoint, Clusters::IlluminanceMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::IlluminanceMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (NumericAttributeTraits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = temp; + } + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ true, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::IlluminanceMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + auto value = NumericAttributeTraits::kNullValue; + return emberAfWriteServerAttribute(endpoint, Clusters::IlluminanceMeasurement::Id, Id, reinterpret_cast(&value), + ZCL_INT16U_ATTRIBUTE_TYPE); +} + +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + } // namespace MinMeasuredValue namespace MaxMeasuredValue { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) { - return emberAfReadServerAttribute(endpoint, Clusters::IlluminanceMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::IlluminanceMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (NumericAttributeTraits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = temp; + } + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ true, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::IlluminanceMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + auto value = NumericAttributeTraits::kNullValue; + return emberAfWriteServerAttribute(endpoint, Clusters::IlluminanceMeasurement::Id, Id, reinterpret_cast(&value), + ZCL_INT16U_ATTRIBUTE_TYPE); +} + +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + } // namespace MaxMeasuredValue namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::IlluminanceMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::IlluminanceMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::IlluminanceMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7814,16 +14452,49 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace LightSensorType { -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) { - return emberAfReadServerAttribute(endpoint, Clusters::IlluminanceMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::IlluminanceMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (NumericAttributeTraits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = temp; + } + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ true, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::IlluminanceMeasurement::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + auto value = NumericAttributeTraits::kNullValue; + return emberAfWriteServerAttribute(endpoint, Clusters::IlluminanceMeasurement::Id, Id, reinterpret_cast(&value), + ZCL_ENUM8_ATTRIBUTE_TYPE); +} + +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + } // namespace LightSensorType } // namespace Attributes @@ -7836,10 +14507,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::TemperatureMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TemperatureMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TemperatureMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -7850,10 +14534,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::TemperatureMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TemperatureMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TemperatureMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -7864,10 +14561,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::TemperatureMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TemperatureMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TemperatureMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -7878,10 +14588,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::TemperatureMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TemperatureMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TemperatureMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7898,10 +14621,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PressureMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PressureMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PressureMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -7912,10 +14648,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PressureMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PressureMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PressureMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -7926,10 +14675,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PressureMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PressureMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PressureMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -7940,10 +14702,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PressureMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PressureMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PressureMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -7954,10 +14729,23 @@ namespace ScaledValue { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PressureMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PressureMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PressureMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -7968,10 +14756,23 @@ namespace MinScaledValue { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PressureMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PressureMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PressureMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -7982,10 +14783,23 @@ namespace MaxScaledValue { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PressureMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PressureMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PressureMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -7996,10 +14810,23 @@ namespace ScaledTolerance { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PressureMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PressureMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PressureMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -8010,10 +14837,23 @@ namespace Scale { EmberAfStatus Get(chip::EndpointId endpoint, int8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::PressureMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::PressureMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::PressureMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT8S_ATTRIBUTE_TYPE); } @@ -8030,10 +14870,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::FlowMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::FlowMeasurement::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::FlowMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -8043,10 +14896,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::FlowMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::FlowMeasurement::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::FlowMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -8056,10 +14922,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::FlowMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::FlowMeasurement::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::FlowMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -8069,10 +14948,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::FlowMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::FlowMeasurement::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::FlowMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -8088,10 +14980,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::RelativeHumidityMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::RelativeHumidityMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::RelativeHumidityMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -8102,10 +15007,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::RelativeHumidityMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::RelativeHumidityMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::RelativeHumidityMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -8116,10 +15034,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::RelativeHumidityMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::RelativeHumidityMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::RelativeHumidityMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -8130,10 +15061,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::RelativeHumidityMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::RelativeHumidityMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::RelativeHumidityMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -8150,10 +15094,23 @@ namespace Occupancy { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, (uint8_t *) &value, ZCL_BITMAP8_ATTRIBUTE_TYPE); } @@ -8164,10 +15121,23 @@ namespace OccupancySensorType { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -8177,10 +15147,23 @@ namespace OccupancySensorTypeBitmap { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, (uint8_t *) &value, ZCL_BITMAP8_ATTRIBUTE_TYPE); } @@ -8191,10 +15174,23 @@ namespace PirOccupiedToUnoccupiedDelay { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -8204,10 +15200,23 @@ namespace PirUnoccupiedToOccupiedDelay { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -8217,10 +15226,23 @@ namespace PirUnoccupiedToOccupiedThreshold { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -8230,10 +15252,23 @@ namespace UltrasonicOccupiedToUnoccupiedDelay { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -8243,10 +15278,23 @@ namespace UltrasonicUnoccupiedToOccupiedDelay { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -8256,10 +15304,23 @@ namespace UltrasonicUnoccupiedToOccupiedThreshold { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -8269,10 +15330,23 @@ namespace PhysicalContactOccupiedToUnoccupiedDelay { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -8282,10 +15356,23 @@ namespace PhysicalContactUnoccupiedToOccupiedDelay { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -8295,10 +15382,23 @@ namespace PhysicalContactUnoccupiedToOccupiedThreshold { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OccupancySensing::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -8314,11 +15414,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::CarbonMonoxideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::CarbonMonoxideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::CarbonMonoxideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8329,11 +15441,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::CarbonMonoxideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::CarbonMonoxideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::CarbonMonoxideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8344,11 +15468,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::CarbonMonoxideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::CarbonMonoxideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::CarbonMonoxideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8359,11 +15495,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::CarbonMonoxideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::CarbonMonoxideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::CarbonMonoxideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8380,11 +15528,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::CarbonDioxideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::CarbonDioxideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::CarbonDioxideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8395,11 +15555,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::CarbonDioxideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::CarbonDioxideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::CarbonDioxideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8410,11 +15582,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::CarbonDioxideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::CarbonDioxideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::CarbonDioxideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8425,11 +15609,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::CarbonDioxideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::CarbonDioxideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::CarbonDioxideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8446,11 +15642,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::EthyleneConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::EthyleneConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::EthyleneConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8461,11 +15669,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::EthyleneConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::EthyleneConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::EthyleneConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8476,11 +15696,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::EthyleneConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::EthyleneConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::EthyleneConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8491,11 +15723,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::EthyleneConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::EthyleneConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::EthyleneConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8512,11 +15756,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::EthyleneOxideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::EthyleneOxideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::EthyleneOxideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8527,11 +15783,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::EthyleneOxideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::EthyleneOxideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::EthyleneOxideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8542,11 +15810,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::EthyleneOxideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::EthyleneOxideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::EthyleneOxideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8557,11 +15837,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::EthyleneOxideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::EthyleneOxideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::EthyleneOxideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8578,11 +15870,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::HydrogenConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::HydrogenConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::HydrogenConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8593,11 +15897,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::HydrogenConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::HydrogenConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::HydrogenConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8608,11 +15924,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::HydrogenConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); -} + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::HydrogenConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; +} EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::HydrogenConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8623,11 +15951,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::HydrogenConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::HydrogenConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::HydrogenConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8644,11 +15984,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::HydrogenSulphideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::HydrogenSulphideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::HydrogenSulphideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8659,11 +16011,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::HydrogenSulphideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::HydrogenSulphideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::HydrogenSulphideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8674,11 +16038,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::HydrogenSulphideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::HydrogenSulphideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::HydrogenSulphideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8689,11 +16065,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::HydrogenSulphideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::HydrogenSulphideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::HydrogenSulphideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8710,11 +16098,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::NitricOxideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::NitricOxideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::NitricOxideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8725,11 +16125,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::NitricOxideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::NitricOxideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::NitricOxideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8740,11 +16152,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::NitricOxideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::NitricOxideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::NitricOxideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8755,11 +16179,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::NitricOxideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::NitricOxideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::NitricOxideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8776,11 +16212,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::NitrogenDioxideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::NitrogenDioxideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::NitrogenDioxideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8791,11 +16239,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::NitrogenDioxideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::NitrogenDioxideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::NitrogenDioxideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8806,11 +16266,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::NitrogenDioxideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::NitrogenDioxideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::NitrogenDioxideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8821,11 +16293,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::NitrogenDioxideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::NitrogenDioxideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::NitrogenDioxideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8842,11 +16326,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OxygenConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::OxygenConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OxygenConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8857,11 +16353,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OxygenConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::OxygenConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OxygenConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8872,11 +16380,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OxygenConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::OxygenConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OxygenConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8887,11 +16407,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OxygenConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::OxygenConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OxygenConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8908,10 +16440,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OzoneConcentrationMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::OzoneConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OzoneConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8922,10 +16467,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OzoneConcentrationMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::OzoneConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OzoneConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8936,10 +16494,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OzoneConcentrationMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::OzoneConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OzoneConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8950,10 +16521,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::OzoneConcentrationMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::OzoneConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::OzoneConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8970,11 +16554,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::SulfurDioxideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::SulfurDioxideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::SulfurDioxideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -8985,11 +16581,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::SulfurDioxideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::SulfurDioxideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::SulfurDioxideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9000,11 +16608,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::SulfurDioxideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::SulfurDioxideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::SulfurDioxideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9015,11 +16635,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::SulfurDioxideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::SulfurDioxideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::SulfurDioxideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9036,11 +16668,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DissolvedOxygenConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DissolvedOxygenConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DissolvedOxygenConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9051,11 +16695,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DissolvedOxygenConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DissolvedOxygenConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DissolvedOxygenConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9066,11 +16722,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DissolvedOxygenConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DissolvedOxygenConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DissolvedOxygenConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9081,11 +16749,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::DissolvedOxygenConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DissolvedOxygenConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::DissolvedOxygenConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9102,11 +16782,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BromateConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BromateConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BromateConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9117,11 +16809,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BromateConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BromateConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BromateConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9132,11 +16836,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BromateConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BromateConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BromateConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9147,11 +16863,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BromateConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BromateConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BromateConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9168,11 +16896,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ChloraminesConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ChloraminesConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ChloraminesConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9183,11 +16923,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ChloraminesConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ChloraminesConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ChloraminesConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9198,11 +16950,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ChloraminesConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ChloraminesConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ChloraminesConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9213,11 +16977,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ChloraminesConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ChloraminesConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ChloraminesConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9234,11 +17010,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ChlorineConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ChlorineConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ChlorineConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9249,11 +17037,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ChlorineConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ChlorineConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ChlorineConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9264,11 +17064,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ChlorineConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ChlorineConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ChlorineConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9279,11 +17091,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ChlorineConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ChlorineConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ChlorineConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9300,11 +17124,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::FecalColiformAndEColiConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::FecalColiformAndEColiConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::FecalColiformAndEColiConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9315,11 +17151,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::FecalColiformAndEColiConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::FecalColiformAndEColiConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::FecalColiformAndEColiConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9330,11 +17178,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::FecalColiformAndEColiConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::FecalColiformAndEColiConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::FecalColiformAndEColiConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9345,11 +17205,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::FecalColiformAndEColiConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::FecalColiformAndEColiConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::FecalColiformAndEColiConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9366,11 +17238,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::FluorideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::FluorideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::FluorideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9381,11 +17265,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::FluorideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::FluorideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::FluorideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9396,11 +17292,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::FluorideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::FluorideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::FluorideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9411,11 +17319,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::FluorideConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::FluorideConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::FluorideConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9432,11 +17352,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::HaloaceticAcidsConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::HaloaceticAcidsConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::HaloaceticAcidsConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9447,11 +17379,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::HaloaceticAcidsConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::HaloaceticAcidsConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::HaloaceticAcidsConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9462,11 +17406,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::HaloaceticAcidsConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::HaloaceticAcidsConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::HaloaceticAcidsConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9477,11 +17433,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::HaloaceticAcidsConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::HaloaceticAcidsConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::HaloaceticAcidsConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9498,11 +17466,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::TotalTrihalomethanesConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TotalTrihalomethanesConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TotalTrihalomethanesConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9513,11 +17493,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::TotalTrihalomethanesConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TotalTrihalomethanesConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TotalTrihalomethanesConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9528,11 +17520,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::TotalTrihalomethanesConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TotalTrihalomethanesConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TotalTrihalomethanesConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9543,11 +17547,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::TotalTrihalomethanesConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TotalTrihalomethanesConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TotalTrihalomethanesConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9564,11 +17580,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::TotalColiformBacteriaConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TotalColiformBacteriaConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TotalColiformBacteriaConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9579,11 +17607,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::TotalColiformBacteriaConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TotalColiformBacteriaConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TotalColiformBacteriaConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9594,11 +17634,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::TotalColiformBacteriaConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TotalColiformBacteriaConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TotalColiformBacteriaConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9609,11 +17661,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::TotalColiformBacteriaConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TotalColiformBacteriaConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TotalColiformBacteriaConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9630,11 +17694,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::TurbidityConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TurbidityConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TurbidityConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9645,11 +17721,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::TurbidityConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TurbidityConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TurbidityConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9660,11 +17748,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::TurbidityConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TurbidityConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TurbidityConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9675,11 +17775,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::TurbidityConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TurbidityConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TurbidityConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9696,11 +17808,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::CopperConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::CopperConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::CopperConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9711,11 +17835,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::CopperConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::CopperConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::CopperConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9726,11 +17862,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::CopperConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::CopperConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::CopperConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9741,11 +17889,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::CopperConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::CopperConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::CopperConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9762,10 +17922,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::LeadConcentrationMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::LeadConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::LeadConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9776,10 +17949,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::LeadConcentrationMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::LeadConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::LeadConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9790,10 +17976,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::LeadConcentrationMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::LeadConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::LeadConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9804,10 +18003,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::LeadConcentrationMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::LeadConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::LeadConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9824,11 +18036,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ManganeseConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ManganeseConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ManganeseConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9839,11 +18063,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ManganeseConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ManganeseConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ManganeseConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9854,11 +18090,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ManganeseConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ManganeseConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ManganeseConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9869,11 +18117,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ManganeseConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ManganeseConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ManganeseConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9890,11 +18150,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::SulfateConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::SulfateConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::SulfateConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9905,11 +18177,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::SulfateConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::SulfateConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::SulfateConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9920,11 +18204,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::SulfateConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::SulfateConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::SulfateConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9935,11 +18231,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::SulfateConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::SulfateConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::SulfateConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9956,11 +18264,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BromodichloromethaneConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BromodichloromethaneConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BromodichloromethaneConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9971,11 +18291,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BromodichloromethaneConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BromodichloromethaneConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BromodichloromethaneConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -9986,11 +18318,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BromodichloromethaneConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BromodichloromethaneConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BromodichloromethaneConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -10001,11 +18345,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BromodichloromethaneConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BromodichloromethaneConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BromodichloromethaneConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -10022,11 +18378,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BromoformConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BromoformConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BromoformConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -10037,11 +18405,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BromoformConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BromoformConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BromoformConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -10052,11 +18432,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BromoformConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BromoformConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BromoformConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -10067,11 +18459,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::BromoformConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::BromoformConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::BromoformConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -10088,11 +18492,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ChlorodibromomethaneConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ChlorodibromomethaneConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ChlorodibromomethaneConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -10103,11 +18519,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ChlorodibromomethaneConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ChlorodibromomethaneConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ChlorodibromomethaneConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -10118,11 +18546,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ChlorodibromomethaneConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ChlorodibromomethaneConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ChlorodibromomethaneConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -10133,11 +18573,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ChlorodibromomethaneConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ChlorodibromomethaneConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ChlorodibromomethaneConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -10154,11 +18606,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ChloroformConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ChloroformConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ChloroformConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -10169,11 +18633,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ChloroformConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ChloroformConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ChloroformConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -10184,11 +18660,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ChloroformConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ChloroformConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ChloroformConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -10199,11 +18687,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ChloroformConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ChloroformConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ChloroformConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -10220,11 +18720,23 @@ namespace MeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::SodiumConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::SodiumConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::SodiumConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -10235,11 +18747,23 @@ namespace MinMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::SodiumConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::SodiumConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::SodiumConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -10250,11 +18774,23 @@ namespace MaxMeasuredValue { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::SodiumConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::SodiumConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::SodiumConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -10265,11 +18801,23 @@ namespace Tolerance { EmberAfStatus Get(chip::EndpointId endpoint, float * value) { - return emberAfReadServerAttribute(endpoint, Clusters::SodiumConcentrationMeasurement::Id, Id, (uint8_t *) value, - sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::SodiumConcentrationMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, float value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::SodiumConcentrationMeasurement::Id, Id, (uint8_t *) &value, ZCL_SINGLE_ATTRIBUTE_TYPE); } @@ -10286,10 +18834,23 @@ namespace ZoneState { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::IasZone::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::IasZone::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::IasZone::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -10299,10 +18860,23 @@ namespace ZoneType { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::IasZone::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::IasZone::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::IasZone::Id, Id, (uint8_t *) &value, ZCL_ENUM16_ATTRIBUTE_TYPE); } @@ -10312,10 +18886,23 @@ namespace ZoneStatus { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::IasZone::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::IasZone::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::IasZone::Id, Id, (uint8_t *) &value, ZCL_BITMAP16_ATTRIBUTE_TYPE); } @@ -10325,10 +18912,23 @@ namespace IasCieAddress { EmberAfStatus Get(chip::EndpointId endpoint, chip::NodeId * value) { - return emberAfReadServerAttribute(endpoint, Clusters::IasZone::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::IasZone::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::NodeId value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::IasZone::Id, Id, (uint8_t *) &value, ZCL_NODE_ID_ATTRIBUTE_TYPE); } @@ -10338,10 +18938,23 @@ namespace ZoneId { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::IasZone::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::IasZone::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::IasZone::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -10351,10 +18964,23 @@ namespace NumberOfZoneSensitivityLevelsSupported { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::IasZone::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::IasZone::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::IasZone::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -10364,10 +18990,23 @@ namespace CurrentZoneSensitivityLevel { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::IasZone::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::IasZone::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::IasZone::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -10383,10 +19022,23 @@ namespace MaxDuration { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::IasWd::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::IasWd::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::IasWd::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -10402,16 +19054,23 @@ namespace WakeOnLanMacAddress { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::WakeOnLan::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 32); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(32 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -10431,16 +19090,23 @@ namespace TvChannelLineup { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableByteSpan value) { - VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TvChannel::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 32); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::ByteSpan value) { + static_assert(32 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -10454,16 +19120,23 @@ namespace CurrentTvChannel { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableByteSpan value) { - VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TvChannel::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 32); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::ByteSpan value) { + static_assert(32 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -10483,10 +19156,23 @@ namespace CurrentNavigatorTarget { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::TargetNavigator::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TargetNavigator::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TargetNavigator::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -10502,10 +19188,23 @@ namespace PlaybackState { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::MediaPlayback::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::MediaPlayback::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::MediaPlayback::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -10515,10 +19214,23 @@ namespace StartTime { EmberAfStatus Get(chip::EndpointId endpoint, uint64_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::MediaPlayback::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::MediaPlayback::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::MediaPlayback::Id, Id, (uint8_t *) &value, ZCL_INT64U_ATTRIBUTE_TYPE); } @@ -10528,10 +19240,23 @@ namespace Duration { EmberAfStatus Get(chip::EndpointId endpoint, uint64_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::MediaPlayback::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::MediaPlayback::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::MediaPlayback::Id, Id, (uint8_t *) &value, ZCL_INT64U_ATTRIBUTE_TYPE); } @@ -10541,10 +19266,23 @@ namespace PositionUpdatedAt { EmberAfStatus Get(chip::EndpointId endpoint, uint64_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::MediaPlayback::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::MediaPlayback::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::MediaPlayback::Id, Id, (uint8_t *) &value, ZCL_INT64U_ATTRIBUTE_TYPE); } @@ -10554,10 +19292,23 @@ namespace Position { EmberAfStatus Get(chip::EndpointId endpoint, uint64_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::MediaPlayback::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::MediaPlayback::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::MediaPlayback::Id, Id, (uint8_t *) &value, ZCL_INT64U_ATTRIBUTE_TYPE); } @@ -10567,10 +19318,23 @@ namespace PlaybackSpeed { EmberAfStatus Get(chip::EndpointId endpoint, uint64_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::MediaPlayback::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::MediaPlayback::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::MediaPlayback::Id, Id, (uint8_t *) &value, ZCL_INT64U_ATTRIBUTE_TYPE); } @@ -10580,10 +19344,23 @@ namespace SeekRangeEnd { EmberAfStatus Get(chip::EndpointId endpoint, uint64_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::MediaPlayback::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::MediaPlayback::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::MediaPlayback::Id, Id, (uint8_t *) &value, ZCL_INT64U_ATTRIBUTE_TYPE); } @@ -10593,10 +19370,23 @@ namespace SeekRangeStart { EmberAfStatus Get(chip::EndpointId endpoint, uint64_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::MediaPlayback::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::MediaPlayback::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::MediaPlayback::Id, Id, (uint8_t *) &value, ZCL_INT64U_ATTRIBUTE_TYPE); } @@ -10612,10 +19402,23 @@ namespace CurrentMediaInput { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::MediaInput::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::MediaInput::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::MediaInput::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -10637,10 +19440,23 @@ namespace CurrentAudioOutput { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::AudioOutput::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::AudioOutput::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::AudioOutput::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -10656,10 +19472,23 @@ namespace CatalogVendorId { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ApplicationLauncher::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ApplicationLauncher::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ApplicationLauncher::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -10670,10 +19499,23 @@ namespace ApplicationId { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ApplicationLauncher::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ApplicationLauncher::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ApplicationLauncher::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -10690,16 +19532,23 @@ namespace VendorName { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ApplicationBasic::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 32); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(32 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -10713,10 +19562,23 @@ namespace VendorId { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ApplicationBasic::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ApplicationBasic::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ApplicationBasic::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -10726,16 +19588,23 @@ namespace ApplicationName { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ApplicationBasic::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 32); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(32 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -10749,10 +19618,23 @@ namespace ProductId { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ApplicationBasic::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ApplicationBasic::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ApplicationBasic::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -10762,16 +19644,23 @@ namespace ApplicationId { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ApplicationBasic::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 32); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(32 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 32, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[32 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -10785,10 +19674,23 @@ namespace CatalogVendorId { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ApplicationBasic::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ApplicationBasic::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ApplicationBasic::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -10798,10 +19700,23 @@ namespace ApplicationStatus { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ApplicationBasic::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::ApplicationBasic::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ApplicationBasic::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } @@ -10817,10 +19732,23 @@ namespace Boolean { EmberAfStatus Get(chip::EndpointId endpoint, bool * value) { - return emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, bool value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_BOOLEAN_ATTRIBUTE_TYPE); } @@ -10830,10 +19758,23 @@ namespace Bitmap8 { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_BITMAP8_ATTRIBUTE_TYPE); } @@ -10843,10 +19784,23 @@ namespace Bitmap16 { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_BITMAP16_ATTRIBUTE_TYPE); } @@ -10856,10 +19810,23 @@ namespace Bitmap32 { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_BITMAP32_ATTRIBUTE_TYPE); } @@ -10869,10 +19836,23 @@ namespace Bitmap64 { EmberAfStatus Get(chip::EndpointId endpoint, uint64_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_BITMAP64_ATTRIBUTE_TYPE); } @@ -10882,10 +19862,23 @@ namespace Int8u { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -10895,10 +19888,23 @@ namespace Int16u { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -10908,120 +19914,1147 @@ namespace Int32u { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } -} // namespace Int32u - -namespace Int64u { - -EmberAfStatus Get(chip::EndpointId endpoint, uint64_t * value) +} // namespace Int32u + +namespace Int64u { + +EmberAfStatus Get(chip::EndpointId endpoint, uint64_t * value) +{ + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) +{ + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_INT64U_ATTRIBUTE_TYPE); +} + +} // namespace Int64u + +namespace Int8s { + +EmberAfStatus Get(chip::EndpointId endpoint, int8_t * value) +{ + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, int8_t value) +{ + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_INT8S_ATTRIBUTE_TYPE); +} + +} // namespace Int8s + +namespace Int16s { + +EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) +{ + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) +{ + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); +} + +} // namespace Int16s + +namespace Int32s { + +EmberAfStatus Get(chip::EndpointId endpoint, int32_t * value) +{ + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, int32_t value) +{ + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_INT32S_ATTRIBUTE_TYPE); +} + +} // namespace Int32s + +namespace Int64s { + +EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value) +{ + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) +{ + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_INT64S_ATTRIBUTE_TYPE); +} + +} // namespace Int64s + +namespace Enum8 { + +EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) +{ + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) +{ + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); +} + +} // namespace Enum8 + +namespace Enum16 { + +EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) +{ + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) +{ + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_ENUM16_ATTRIBUTE_TYPE); +} + +} // namespace Enum16 + +namespace OctetString { + +EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableByteSpan value) +{ + uint8_t zclString[10 + 1]; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, zclString, sizeof(zclString)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 10, EMBER_ZCL_STATUS_INVALID_ARGUMENT); + memcpy(value.data(), &zclString[1], 10); + value.reduce_size(length); + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, chip::ByteSpan value) +{ + static_assert(10 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); + VerifyOrReturnError(value.size() <= 10, EMBER_ZCL_STATUS_INVALID_ARGUMENT); + uint8_t zclString[10 + 1]; + emberAfCopyInt8u(zclString, 0, static_cast(value.size())); + memcpy(&zclString[1], value.data(), value.size()); + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, zclString, ZCL_OCTET_STRING_ATTRIBUTE_TYPE); +} + +} // namespace OctetString + +namespace LongOctetString { + +EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableByteSpan value) +{ + uint8_t zclString[1000 + 2]; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, zclString, sizeof(zclString)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfLongStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 1000, EMBER_ZCL_STATUS_INVALID_ARGUMENT); + memcpy(value.data(), &zclString[2], 1000); + value.reduce_size(length); + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, chip::ByteSpan value) +{ + static_assert(1000 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); + VerifyOrReturnError(value.size() <= 1000, EMBER_ZCL_STATUS_INVALID_ARGUMENT); + uint8_t zclString[1000 + 2]; + emberAfCopyInt16u(zclString, 0, static_cast(value.size())); + memcpy(&zclString[2], value.data(), value.size()); + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, zclString, ZCL_LONG_OCTET_STRING_ATTRIBUTE_TYPE); +} + +} // namespace LongOctetString + +namespace CharString { + +EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) +{ + uint8_t zclString[10 + 1]; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, zclString, sizeof(zclString)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 10, EMBER_ZCL_STATUS_INVALID_ARGUMENT); + memcpy(value.data(), &zclString[1], 10); + value.reduce_size(length); + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) +{ + static_assert(10 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); + VerifyOrReturnError(value.size() <= 10, EMBER_ZCL_STATUS_INVALID_ARGUMENT); + uint8_t zclString[10 + 1]; + emberAfCopyInt8u(zclString, 0, static_cast(value.size())); + memcpy(&zclString[1], value.data(), value.size()); + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE); +} + +} // namespace CharString + +namespace LongCharString { + +EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) +{ + uint8_t zclString[1000 + 2]; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, zclString, sizeof(zclString)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfLongStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 1000, EMBER_ZCL_STATUS_INVALID_ARGUMENT); + memcpy(value.data(), &zclString[2], 1000); + value.reduce_size(length); + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) +{ + static_assert(1000 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); + VerifyOrReturnError(value.size() <= 1000, EMBER_ZCL_STATUS_INVALID_ARGUMENT); + uint8_t zclString[1000 + 2]; + emberAfCopyInt16u(zclString, 0, static_cast(value.size())); + memcpy(&zclString[2], value.data(), value.size()); + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, zclString, ZCL_LONG_CHAR_STRING_ATTRIBUTE_TYPE); +} + +} // namespace LongCharString + +namespace EpochUs { + +EmberAfStatus Get(chip::EndpointId endpoint, uint64_t * value) +{ + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) +{ + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_EPOCH_US_ATTRIBUTE_TYPE); +} + +} // namespace EpochUs + +namespace EpochS { + +EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) +{ + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) +{ + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_EPOCH_S_ATTRIBUTE_TYPE); +} + +} // namespace EpochS + +namespace VendorId { + +EmberAfStatus Get(chip::EndpointId endpoint, chip::VendorId * value) +{ + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, chip::VendorId value) +{ + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_VENDOR_ID_ATTRIBUTE_TYPE); +} + +} // namespace VendorId + +namespace Unsupported { + +EmberAfStatus Get(chip::EndpointId endpoint, bool * value) +{ + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, bool value) +{ + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_BOOLEAN_ATTRIBUTE_TYPE); +} + +} // namespace Unsupported + +namespace NullableBoolean { + +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) +{ + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (NumericAttributeTraits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = temp; + } + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, bool value) +{ + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ true, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_BOOLEAN_ATTRIBUTE_TYPE); +} + +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + auto value = NumericAttributeTraits::kNullValue; + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&value), + ZCL_BOOLEAN_ATTRIBUTE_TYPE); +} + +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace NullableBoolean + +namespace NullableBitmap8 { + +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) +{ + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (NumericAttributeTraits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = temp; + } + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) +{ + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ true, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_BITMAP8_ATTRIBUTE_TYPE); +} + +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + auto value = NumericAttributeTraits::kNullValue; + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&value), + ZCL_BITMAP8_ATTRIBUTE_TYPE); +} + +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace NullableBitmap8 + +namespace NullableBitmap16 { + +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) +{ + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (NumericAttributeTraits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = temp; + } + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) +{ + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ true, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_BITMAP16_ATTRIBUTE_TYPE); +} + +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + auto value = NumericAttributeTraits::kNullValue; + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&value), + ZCL_BITMAP16_ATTRIBUTE_TYPE); +} + +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace NullableBitmap16 + +namespace NullableBitmap32 { + +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) +{ + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (NumericAttributeTraits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = temp; + } + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) +{ + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ true, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_BITMAP32_ATTRIBUTE_TYPE); +} + +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + auto value = NumericAttributeTraits::kNullValue; + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&value), + ZCL_BITMAP32_ATTRIBUTE_TYPE); +} + +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace NullableBitmap32 + +namespace NullableBitmap64 { + +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) +{ + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (NumericAttributeTraits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = temp; + } + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) +{ + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ true, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_BITMAP64_ATTRIBUTE_TYPE); +} + +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + auto value = NumericAttributeTraits::kNullValue; + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&value), + ZCL_BITMAP64_ATTRIBUTE_TYPE); +} + +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace NullableBitmap64 + +namespace NullableInt8u { + +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) +{ + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (NumericAttributeTraits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = temp; + } + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) +{ + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ true, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); +} + +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + auto value = NumericAttributeTraits::kNullValue; + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&value), + ZCL_INT8U_ATTRIBUTE_TYPE); +} + +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace NullableInt8u + +namespace NullableInt16u { + +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) +{ + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (NumericAttributeTraits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = temp; + } + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) +{ + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ true, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); +} + +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + auto value = NumericAttributeTraits::kNullValue; + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&value), + ZCL_INT16U_ATTRIBUTE_TYPE); +} + +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace NullableInt16u + +namespace NullableInt32u { + +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) +{ + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (NumericAttributeTraits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = temp; + } + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) +{ + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ true, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); +} + +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + auto value = NumericAttributeTraits::kNullValue; + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&value), + ZCL_INT32U_ATTRIBUTE_TYPE); +} + +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace NullableInt32u + +namespace NullableInt64u { + +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) +{ + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (NumericAttributeTraits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = temp; + } + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) +{ + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ true, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_INT64U_ATTRIBUTE_TYPE); +} + +EmberAfStatus SetNull(chip::EndpointId endpoint) { - return emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) value, sizeof(*value)); + auto value = NumericAttributeTraits::kNullValue; + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&value), + ZCL_INT64U_ATTRIBUTE_TYPE); } -EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) + +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value) { - return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_INT64U_ATTRIBUTE_TYPE); + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); } -} // namespace Int64u +} // namespace NullableInt64u -namespace Int8s { +namespace NullableInt8s { -EmberAfStatus Get(chip::EndpointId endpoint, int8_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) { - return emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (NumericAttributeTraits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = temp; + } + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ true, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_INT8S_ATTRIBUTE_TYPE); } -} // namespace Int8s +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + auto value = NumericAttributeTraits::kNullValue; + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&value), + ZCL_INT8S_ATTRIBUTE_TYPE); +} -namespace Int16s { +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } -EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) + return Set(endpoint, value.Value()); +} + +} // namespace NullableInt8s + +namespace NullableInt16s { + +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) { - return emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (NumericAttributeTraits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = temp; + } + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ true, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } -} // namespace Int16s +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + auto value = NumericAttributeTraits::kNullValue; + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&value), + ZCL_INT16S_ATTRIBUTE_TYPE); +} -namespace Int32s { +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } -EmberAfStatus Get(chip::EndpointId endpoint, int32_t * value) + return Set(endpoint, value.Value()); +} + +} // namespace NullableInt16s + +namespace NullableInt32s { + +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) { - return emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (NumericAttributeTraits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = temp; + } + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ true, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_INT32S_ATTRIBUTE_TYPE); } -} // namespace Int32s +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + auto value = NumericAttributeTraits::kNullValue; + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&value), + ZCL_INT32S_ATTRIBUTE_TYPE); +} -namespace Int64s { +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value) + return Set(endpoint, value.Value()); +} + +} // namespace NullableInt32s + +namespace NullableInt64s { + +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) { - return emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (NumericAttributeTraits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = temp; + } + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ true, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_INT64S_ATTRIBUTE_TYPE); } -} // namespace Int64s +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + auto value = NumericAttributeTraits::kNullValue; + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&value), + ZCL_INT64S_ATTRIBUTE_TYPE); +} -namespace Enum8 { +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) + return Set(endpoint, value.Value()); +} + +} // namespace NullableInt64s + +namespace NullableEnum8 { + +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) { - return emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (NumericAttributeTraits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = temp; + } + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ true, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_ENUM8_ATTRIBUTE_TYPE); } -} // namespace Enum8 +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + auto value = NumericAttributeTraits::kNullValue; + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&value), + ZCL_ENUM8_ATTRIBUTE_TYPE); +} -namespace Enum16 { +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) + return Set(endpoint, value.Value()); +} + +} // namespace NullableEnum8 + +namespace NullableEnum16 { + +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) { - return emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = + emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (NumericAttributeTraits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = temp; + } + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ true, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_ENUM16_ATTRIBUTE_TYPE); } -} // namespace Enum16 +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + auto value = NumericAttributeTraits::kNullValue; + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, reinterpret_cast(&value), + ZCL_ENUM16_ATTRIBUTE_TYPE); +} -namespace OctetString { +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } -EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableByteSpan value) + return Set(endpoint, value.Value()); +} + +} // namespace NullableEnum16 + +namespace NullableOctetString { + +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) { - VerifyOrReturnError(value.size() == 10, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[10 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - memcpy(value.data(), &zclString[1], 10); - value.reduce_size(emberAfStringLength(zclString)); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + value.SetNull(); + return EMBER_ZCL_STATUS_SUCCESS; + } + auto & span = value.SetNonNull(); + + VerifyOrReturnError(span.size() == 10, EMBER_ZCL_STATUS_INVALID_ARGUMENT); + memcpy(span.data(), &zclString[1], 10); + span.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::ByteSpan value) { + static_assert(10 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 10, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[10 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -11029,45 +21062,47 @@ EmberAfStatus Set(chip::EndpointId endpoint, chip::ByteSpan value) return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, zclString, ZCL_OCTET_STRING_ATTRIBUTE_TYPE); } -} // namespace OctetString - -namespace LongOctetString { - -EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableByteSpan value) +EmberAfStatus SetNull(chip::EndpointId endpoint) { - VerifyOrReturnError(value.size() == 1000, EMBER_ZCL_STATUS_INVALID_ARGUMENT); - uint8_t zclString[1000 + 2]; - EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, zclString, sizeof(zclString)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - memcpy(value.data(), &zclString[2], 1000); - value.reduce_size(emberAfLongStringLength(zclString)); - return status; + uint8_t zclString[1] = { 0xFF }; + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, zclString, ZCL_OCTET_STRING_ATTRIBUTE_TYPE); } -EmberAfStatus Set(chip::EndpointId endpoint, chip::ByteSpan value) + +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value) { - VerifyOrReturnError(value.size() <= 1000, EMBER_ZCL_STATUS_INVALID_ARGUMENT); - uint8_t zclString[1000 + 2]; - emberAfCopyInt16u(zclString, 0, static_cast(value.size())); - memcpy(&zclString[2], value.data(), value.size()); - return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, zclString, ZCL_LONG_OCTET_STRING_ATTRIBUTE_TYPE); + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); } -} // namespace LongOctetString +} // namespace NullableOctetString -namespace CharString { +namespace NullableCharString { -EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) { - VerifyOrReturnError(value.size() == 10, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[10 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - memcpy(value.data(), &zclString[1], 10); - value.reduce_size(emberAfStringLength(zclString)); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + value.SetNull(); + return EMBER_ZCL_STATUS_SUCCESS; + } + auto & span = value.SetNonNull(); + + VerifyOrReturnError(span.size() == 10, EMBER_ZCL_STATUS_INVALID_ARGUMENT); + memcpy(span.data(), &zclString[1], 10); + span.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(10 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 10, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[10 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -11075,82 +21110,23 @@ EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE); } -} // namespace CharString - -namespace LongCharString { - -EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) -{ - VerifyOrReturnError(value.size() == 1000, EMBER_ZCL_STATUS_INVALID_ARGUMENT); - uint8_t zclString[1000 + 2]; - EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, zclString, sizeof(zclString)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - memcpy(value.data(), &zclString[2], 1000); - value.reduce_size(emberAfLongStringLength(zclString)); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) -{ - VerifyOrReturnError(value.size() <= 1000, EMBER_ZCL_STATUS_INVALID_ARGUMENT); - uint8_t zclString[1000 + 2]; - emberAfCopyInt16u(zclString, 0, static_cast(value.size())); - memcpy(&zclString[2], value.data(), value.size()); - return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, zclString, ZCL_LONG_CHAR_STRING_ATTRIBUTE_TYPE); -} - -} // namespace LongCharString - -namespace EpochUs { - -EmberAfStatus Get(chip::EndpointId endpoint, uint64_t * value) -{ - return emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) value, sizeof(*value)); -} -EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) -{ - return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_EPOCH_US_ATTRIBUTE_TYPE); -} - -} // namespace EpochUs - -namespace EpochS { - -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) -{ - return emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) value, sizeof(*value)); -} -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) +EmberAfStatus SetNull(chip::EndpointId endpoint) { - return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_EPOCH_S_ATTRIBUTE_TYPE); + uint8_t zclString[1] = { 0xFF }; + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE); } -} // namespace EpochS - -namespace VendorId { - -EmberAfStatus Get(chip::EndpointId endpoint, chip::VendorId * value) -{ - return emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) value, sizeof(*value)); -} -EmberAfStatus Set(chip::EndpointId endpoint, chip::VendorId value) +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value) { - return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_VENDOR_ID_ATTRIBUTE_TYPE); -} + if (value.IsNull()) + { + return SetNull(endpoint); + } -} // namespace VendorId - -namespace Unsupported { - -EmberAfStatus Get(chip::EndpointId endpoint, bool * value) -{ - return emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) value, sizeof(*value)); -} -EmberAfStatus Set(chip::EndpointId endpoint, bool value) -{ - return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, (uint8_t *) &value, ZCL_BOOLEAN_ATTRIBUTE_TYPE); + return Set(endpoint, value.Value()); } -} // namespace Unsupported +} // namespace NullableCharString } // namespace Attributes } // namespace TestCluster @@ -11162,17 +21138,24 @@ namespace CompanyName { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ApplianceIdentification::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 16); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(16 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -11187,10 +21170,23 @@ namespace CompanyId { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ApplianceIdentification::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ApplianceIdentification::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ApplianceIdentification::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -11201,17 +21197,24 @@ namespace BrandName { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ApplianceIdentification::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 16); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(16 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -11226,10 +21229,23 @@ namespace BrandId { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ApplianceIdentification::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ApplianceIdentification::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ApplianceIdentification::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -11240,17 +21256,24 @@ namespace Model { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableByteSpan value) { - VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ApplianceIdentification::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 16); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::ByteSpan value) { + static_assert(16 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -11265,17 +21288,24 @@ namespace PartNumber { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableByteSpan value) { - VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ApplianceIdentification::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 16); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::ByteSpan value) { + static_assert(16 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -11290,17 +21320,24 @@ namespace ProductRevision { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableByteSpan value) { - VerifyOrReturnError(value.size() == 6, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[6 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ApplianceIdentification::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 6, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 6); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::ByteSpan value) { + static_assert(6 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 6, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[6 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -11315,17 +21352,24 @@ namespace SoftwareRevision { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableByteSpan value) { - VerifyOrReturnError(value.size() == 6, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[6 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ApplianceIdentification::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 6, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 6); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::ByteSpan value) { + static_assert(6 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 6, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[6 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -11340,17 +21384,24 @@ namespace ProductTypeName { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableByteSpan value) { - VerifyOrReturnError(value.size() == 2, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[2 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ApplianceIdentification::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 2, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 2); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::ByteSpan value) { + static_assert(2 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 2, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[2 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -11365,10 +21416,23 @@ namespace ProductTypeId { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ApplianceIdentification::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ApplianceIdentification::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ApplianceIdentification::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -11379,10 +21443,23 @@ namespace CecedSpecificationVersion { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ApplianceIdentification::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ApplianceIdentification::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ApplianceIdentification::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -11399,17 +21476,24 @@ namespace CompanyName { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::MeterIdentification::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 16); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(16 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -11423,10 +21507,23 @@ namespace MeterTypeId { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::MeterIdentification::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::MeterIdentification::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::MeterIdentification::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -11437,10 +21534,23 @@ namespace DataQualityId { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::MeterIdentification::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::MeterIdentification::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::MeterIdentification::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -11451,17 +21561,24 @@ namespace CustomerName { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::MeterIdentification::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 16); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(16 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -11475,17 +21592,24 @@ namespace Model { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableByteSpan value) { - VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::MeterIdentification::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 16); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::ByteSpan value) { + static_assert(16 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -11499,17 +21623,24 @@ namespace PartNumber { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableByteSpan value) { - VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::MeterIdentification::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 16); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::ByteSpan value) { + static_assert(16 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -11523,17 +21654,24 @@ namespace ProductRevision { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableByteSpan value) { - VerifyOrReturnError(value.size() == 6, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[6 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::MeterIdentification::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 6, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 6); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::ByteSpan value) { + static_assert(6 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 6, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[6 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -11547,17 +21685,24 @@ namespace SoftwareRevision { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableByteSpan value) { - VerifyOrReturnError(value.size() == 6, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[6 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::MeterIdentification::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 6, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 6); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::ByteSpan value) { + static_assert(6 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 6, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[6 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -11571,17 +21716,24 @@ namespace UtilityName { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::MeterIdentification::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 16); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(16 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -11595,17 +21747,24 @@ namespace Pod { EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::MeterIdentification::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + + VerifyOrReturnError(value.size() == 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); memcpy(value.data(), &zclString[1], 16); - value.reduce_size(emberAfStringLength(zclString)); + value.reduce_size(length); return status; } EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) { + static_assert(16 != NumericAttributeTraits::kNullValue, "value.size() might be too big"); VerifyOrReturnError(value.size() <= 16, EMBER_ZCL_STATUS_INVALID_ARGUMENT); uint8_t zclString[16 + 1]; emberAfCopyInt8u(zclString, 0, static_cast(value.size())); @@ -11625,10 +21784,23 @@ namespace LogMaxSize { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ApplianceStatistics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ApplianceStatistics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ApplianceStatistics::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -11639,10 +21811,23 @@ namespace LogQueueMaxSize { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ApplianceStatistics::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ApplianceStatistics::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ApplianceStatistics::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -11659,10 +21844,23 @@ namespace MeasurementType { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_BITMAP32_ATTRIBUTE_TYPE); } @@ -11673,10 +21871,23 @@ namespace DcVoltage { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -11687,10 +21898,23 @@ namespace DcVoltageMin { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -11701,10 +21925,23 @@ namespace DcVoltageMax { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -11715,10 +21952,23 @@ namespace DcCurrent { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -11729,10 +21979,23 @@ namespace DcCurrentMin { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -11743,10 +22006,23 @@ namespace DcCurrentMax { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -11757,10 +22033,23 @@ namespace DcPower { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -11771,10 +22060,23 @@ namespace DcPowerMin { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -11785,10 +22087,23 @@ namespace DcPowerMax { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -11799,10 +22114,23 @@ namespace DcVoltageMultiplier { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -11813,10 +22141,23 @@ namespace DcVoltageDivisor { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -11827,10 +22168,23 @@ namespace DcCurrentMultiplier { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -11841,10 +22195,23 @@ namespace DcCurrentDivisor { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -11855,10 +22222,23 @@ namespace DcPowerMultiplier { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -11869,10 +22249,23 @@ namespace DcPowerDivisor { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -11883,10 +22276,23 @@ namespace AcFrequency { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -11897,10 +22303,23 @@ namespace AcFrequencyMin { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -11911,10 +22330,23 @@ namespace AcFrequencyMax { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -11925,10 +22357,23 @@ namespace NeutralCurrent { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -11939,10 +22384,23 @@ namespace TotalActivePower { EmberAfStatus Get(chip::EndpointId endpoint, int32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT32S_ATTRIBUTE_TYPE); } @@ -11953,10 +22411,23 @@ namespace TotalReactivePower { EmberAfStatus Get(chip::EndpointId endpoint, int32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT32S_ATTRIBUTE_TYPE); } @@ -11967,10 +22438,23 @@ namespace TotalApparentPower { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -11981,10 +22465,23 @@ namespace Measured1stHarmonicCurrent { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -11995,10 +22492,23 @@ namespace Measured3rdHarmonicCurrent { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12009,10 +22519,23 @@ namespace Measured5thHarmonicCurrent { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12023,10 +22546,23 @@ namespace Measured7thHarmonicCurrent { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12037,10 +22573,23 @@ namespace Measured9thHarmonicCurrent { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12051,10 +22600,23 @@ namespace Measured11thHarmonicCurrent { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12065,10 +22627,23 @@ namespace MeasuredPhase1stHarmonicCurrent { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12079,10 +22654,23 @@ namespace MeasuredPhase3rdHarmonicCurrent { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12093,10 +22681,23 @@ namespace MeasuredPhase5thHarmonicCurrent { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12107,10 +22708,23 @@ namespace MeasuredPhase7thHarmonicCurrent { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12121,10 +22735,23 @@ namespace MeasuredPhase9thHarmonicCurrent { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12135,10 +22762,23 @@ namespace MeasuredPhase11thHarmonicCurrent { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12149,10 +22789,23 @@ namespace AcFrequencyMultiplier { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -12163,10 +22816,23 @@ namespace AcFrequencyDivisor { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -12177,10 +22843,23 @@ namespace PowerMultiplier { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -12191,10 +22870,23 @@ namespace PowerDivisor { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT32U_ATTRIBUTE_TYPE); } @@ -12205,10 +22897,23 @@ namespace HarmonicCurrentMultiplier { EmberAfStatus Get(chip::EndpointId endpoint, int8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT8S_ATTRIBUTE_TYPE); } @@ -12219,10 +22924,23 @@ namespace PhaseHarmonicCurrentMultiplier { EmberAfStatus Get(chip::EndpointId endpoint, int8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT8S_ATTRIBUTE_TYPE); } @@ -12233,10 +22951,23 @@ namespace InstantaneousVoltage { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12247,10 +22978,23 @@ namespace InstantaneousLineCurrent { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -12261,10 +23005,23 @@ namespace InstantaneousActiveCurrent { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12275,10 +23032,23 @@ namespace InstantaneousReactiveCurrent { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12289,10 +23059,23 @@ namespace InstantaneousPower { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12303,10 +23086,23 @@ namespace RmsVoltage { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -12317,10 +23113,23 @@ namespace RmsVoltageMin { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -12331,10 +23140,23 @@ namespace RmsVoltageMax { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -12345,10 +23167,23 @@ namespace RmsCurrent { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -12359,10 +23194,23 @@ namespace RmsCurrentMin { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -12373,10 +23221,23 @@ namespace RmsCurrentMax { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -12387,10 +23248,23 @@ namespace ActivePower { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12401,10 +23275,23 @@ namespace ActivePowerMin { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12415,10 +23302,23 @@ namespace ActivePowerMax { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12429,10 +23329,23 @@ namespace ReactivePower { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12443,10 +23356,23 @@ namespace ApparentPower { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -12457,10 +23383,23 @@ namespace PowerFactor { EmberAfStatus Get(chip::EndpointId endpoint, int8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT8S_ATTRIBUTE_TYPE); } @@ -12471,10 +23410,23 @@ namespace AverageRmsVoltageMeasurementPeriod { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -12485,10 +23437,23 @@ namespace AverageRmsUnderVoltageCounter { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -12499,10 +23464,23 @@ namespace RmsExtremeOverVoltagePeriod { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -12513,10 +23491,23 @@ namespace RmsExtremeUnderVoltagePeriod { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -12527,10 +23518,23 @@ namespace RmsVoltageSagPeriod { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -12541,10 +23545,23 @@ namespace RmsVoltageSwellPeriod { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -12555,10 +23572,23 @@ namespace AcVoltageMultiplier { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -12569,10 +23599,23 @@ namespace AcVoltageDivisor { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -12583,10 +23626,23 @@ namespace AcCurrentMultiplier { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -12597,10 +23653,23 @@ namespace AcCurrentDivisor { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -12611,10 +23680,23 @@ namespace AcPowerMultiplier { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -12625,10 +23707,23 @@ namespace AcPowerDivisor { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -12639,10 +23734,23 @@ namespace OverloadAlarmsMask { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_BITMAP8_ATTRIBUTE_TYPE); } @@ -12653,10 +23761,23 @@ namespace VoltageOverload { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12667,10 +23788,23 @@ namespace CurrentOverload { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12681,10 +23815,23 @@ namespace AcOverloadAlarmsMask { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_BITMAP16_ATTRIBUTE_TYPE); } @@ -12695,10 +23842,23 @@ namespace AcVoltageOverload { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12709,10 +23869,23 @@ namespace AcCurrentOverload { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12723,10 +23896,23 @@ namespace AcActivePowerOverload { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12737,10 +23923,23 @@ namespace AcReactivePowerOverload { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12751,10 +23950,23 @@ namespace AverageRmsOverVoltage { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12765,10 +23977,23 @@ namespace AverageRmsUnderVoltage { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12779,10 +24004,23 @@ namespace RmsExtremeOverVoltage { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12793,10 +24031,23 @@ namespace RmsExtremeUnderVoltage { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12807,10 +24058,23 @@ namespace RmsVoltageSag { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12821,10 +24085,23 @@ namespace RmsVoltageSwell { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12835,10 +24112,23 @@ namespace LineCurrentPhaseB { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -12849,10 +24139,23 @@ namespace ActiveCurrentPhaseB { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12863,10 +24166,23 @@ namespace ReactiveCurrentPhaseB { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12877,10 +24193,23 @@ namespace RmsVoltagePhaseB { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -12891,10 +24220,23 @@ namespace RmsVoltageMinPhaseB { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -12905,10 +24247,23 @@ namespace RmsVoltageMaxPhaseB { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -12919,10 +24274,23 @@ namespace RmsCurrentPhaseB { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -12933,10 +24301,23 @@ namespace RmsCurrentMinPhaseB { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -12947,10 +24328,23 @@ namespace RmsCurrentMaxPhaseB { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -12961,10 +24355,23 @@ namespace ActivePowerPhaseB { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12975,10 +24382,23 @@ namespace ActivePowerMinPhaseB { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -12989,10 +24409,23 @@ namespace ActivePowerMaxPhaseB { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -13003,10 +24436,23 @@ namespace ReactivePowerPhaseB { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -13017,10 +24463,23 @@ namespace ApparentPowerPhaseB { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -13031,10 +24490,23 @@ namespace PowerFactorPhaseB { EmberAfStatus Get(chip::EndpointId endpoint, int8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT8S_ATTRIBUTE_TYPE); } @@ -13045,10 +24517,23 @@ namespace AverageRmsVoltageMeasurementPeriodPhaseB { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -13059,10 +24544,23 @@ namespace AverageRmsOverVoltageCounterPhaseB { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -13073,10 +24571,23 @@ namespace AverageRmsUnderVoltageCounterPhaseB { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -13087,10 +24598,23 @@ namespace RmsExtremeOverVoltagePeriodPhaseB { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -13101,10 +24625,23 @@ namespace RmsExtremeUnderVoltagePeriodPhaseB { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -13115,10 +24652,23 @@ namespace RmsVoltageSagPeriodPhaseB { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -13129,10 +24679,23 @@ namespace RmsVoltageSwellPeriodPhaseB { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -13143,10 +24706,23 @@ namespace LineCurrentPhaseC { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -13157,10 +24733,23 @@ namespace ActiveCurrentPhaseC { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -13171,10 +24760,23 @@ namespace ReactiveCurrentPhaseC { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -13185,10 +24787,23 @@ namespace RmsVoltagePhaseC { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -13199,10 +24814,23 @@ namespace RmsVoltageMinPhaseC { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -13213,10 +24841,23 @@ namespace RmsVoltageMaxPhaseC { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -13227,10 +24868,23 @@ namespace RmsCurrentPhaseC { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -13241,10 +24895,23 @@ namespace RmsCurrentMinPhaseC { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -13255,10 +24922,23 @@ namespace RmsCurrentMaxPhaseC { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -13269,10 +24949,23 @@ namespace ActivePowerPhaseC { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -13283,10 +24976,23 @@ namespace ActivePowerMinPhaseC { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -13297,10 +25003,23 @@ namespace ActivePowerMaxPhaseC { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -13311,10 +25030,23 @@ namespace ReactivePowerPhaseC { EmberAfStatus Get(chip::EndpointId endpoint, int16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16S_ATTRIBUTE_TYPE); } @@ -13325,10 +25057,23 @@ namespace ApparentPowerPhaseC { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -13339,10 +25084,23 @@ namespace PowerFactorPhaseC { EmberAfStatus Get(chip::EndpointId endpoint, int8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, int8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT8S_ATTRIBUTE_TYPE); } @@ -13353,10 +25111,23 @@ namespace AverageRmsVoltageMeasurementPeriodPhaseC { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -13367,10 +25138,23 @@ namespace AverageRmsOverVoltageCounterPhaseC { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -13381,10 +25165,23 @@ namespace AverageRmsUnderVoltageCounterPhaseC { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -13395,10 +25192,23 @@ namespace RmsExtremeOverVoltagePeriodPhaseC { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -13409,10 +25219,23 @@ namespace RmsExtremeUnderVoltagePeriodPhaseC { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -13423,10 +25246,23 @@ namespace RmsVoltageSagPeriodPhaseC { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -13437,10 +25273,23 @@ namespace RmsVoltageSwellPeriodPhaseC { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::ElectricalMeasurement::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -13463,10 +25312,23 @@ namespace EmberSampleAttribute { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::SampleMfgSpecificCluster::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::SampleMfgSpecificCluster::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::SampleMfgSpecificCluster::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -13477,10 +25339,23 @@ namespace EmberSampleAttribute2 { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::SampleMfgSpecificCluster::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::SampleMfgSpecificCluster::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::SampleMfgSpecificCluster::Id, Id, (uint8_t *) &value, ZCL_INT8U_ATTRIBUTE_TYPE); } @@ -13497,10 +25372,23 @@ namespace EmberSampleAttribute3 { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::SampleMfgSpecificCluster2::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::SampleMfgSpecificCluster2::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::SampleMfgSpecificCluster2::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } @@ -13511,10 +25399,23 @@ namespace EmberSampleAttribute4 { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - return emberAfReadServerAttribute(endpoint, Clusters::SampleMfgSpecificCluster2::Id, Id, (uint8_t *) value, sizeof(*value)); + NumericAttributeTraits::StorageType temp; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::SampleMfgSpecificCluster2::Id, Id, + reinterpret_cast(&temp), sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_INVALID_VALUE; + } + *value = temp; + return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; + } return emberAfWriteServerAttribute(endpoint, Clusters::SampleMfgSpecificCluster2::Id, Id, (uint8_t *) &value, ZCL_INT16U_ATTRIBUTE_TYPE); } 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 0130eb536d5adb..b200911b960bb5 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 @@ -24,6 +24,7 @@ #pragma once +#include #include #include @@ -2902,18 +2903,24 @@ namespace IlluminanceMeasurement { namespace Attributes { namespace MeasuredValue { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // int16u EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value); } // namespace MeasuredValue namespace MinMeasuredValue { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // int16u EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value); } // namespace MinMeasuredValue namespace MaxMeasuredValue { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // int16u EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value); } // namespace MaxMeasuredValue namespace Tolerance { @@ -2922,8 +2929,10 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); } // namespace Tolerance namespace LightSensorType { -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // enum8 +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // enum8 EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value); } // namespace LightSensorType } // namespace Attributes @@ -4243,6 +4252,125 @@ EmberAfStatus Get(chip::EndpointId endpoint, bool * value); // boolean EmberAfStatus Set(chip::EndpointId endpoint, bool value); } // namespace Unsupported +namespace NullableBoolean { +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // boolean +EmberAfStatus Set(chip::EndpointId endpoint, bool value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value); +} // namespace NullableBoolean + +namespace NullableBitmap8 { +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // bitmap8 +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value); +} // namespace NullableBitmap8 + +namespace NullableBitmap16 { +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // bitmap16 +EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value); +} // namespace NullableBitmap16 + +namespace NullableBitmap32 { +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // bitmap32 +EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value); +} // namespace NullableBitmap32 + +namespace NullableBitmap64 { +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // bitmap64 +EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value); +} // namespace NullableBitmap64 + +namespace NullableInt8u { +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // int8u +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value); +} // namespace NullableInt8u + +namespace NullableInt16u { +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // int16u +EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value); +} // namespace NullableInt16u + +namespace NullableInt32u { +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // int32u +EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value); +} // namespace NullableInt32u + +namespace NullableInt64u { +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // int64u +EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value); +} // namespace NullableInt64u + +namespace NullableInt8s { +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // int8s +EmberAfStatus Set(chip::EndpointId endpoint, int8_t value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value); +} // namespace NullableInt8s + +namespace NullableInt16s { +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // int16s +EmberAfStatus Set(chip::EndpointId endpoint, int16_t value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value); +} // namespace NullableInt16s + +namespace NullableInt32s { +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // int32s +EmberAfStatus Set(chip::EndpointId endpoint, int32_t value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value); +} // namespace NullableInt32s + +namespace NullableInt64s { +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // int64s +EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value); +} // namespace NullableInt64s + +namespace NullableEnum8 { +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // enum8 +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value); +} // namespace NullableEnum8 + +namespace NullableEnum16 { +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // enum16 +EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value); +} // namespace NullableEnum16 + +namespace NullableOctetString { +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // octet_string +EmberAfStatus Set(chip::EndpointId endpoint, chip::ByteSpan value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value); +} // namespace NullableOctetString + +namespace NullableCharString { +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // char_string +EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable & value); +} // namespace NullableCharString + } // namespace Attributes } // namespace TestCluster diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h index 411fcc4f32e0de..31e0fb58f91e17 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h @@ -25469,6 +25469,193 @@ struct TypeInfo static constexpr AttributeId GetAttributeId() { return Attributes::Unsupported::Id; } }; } // namespace Unsupported +namespace NullableBoolean { +struct TypeInfo +{ + using Type = DataModel::Nullable; + using DecodableType = DataModel::Nullable; + using DecodableArgType = const DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::TestCluster::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::NullableBoolean::Id; } +}; +} // namespace NullableBoolean +namespace NullableBitmap8 { +struct TypeInfo +{ + using Type = DataModel::Nullable; + using DecodableType = DataModel::Nullable; + using DecodableArgType = const DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::TestCluster::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::NullableBitmap8::Id; } +}; +} // namespace NullableBitmap8 +namespace NullableBitmap16 { +struct TypeInfo +{ + using Type = DataModel::Nullable; + using DecodableType = DataModel::Nullable; + using DecodableArgType = const DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::TestCluster::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::NullableBitmap16::Id; } +}; +} // namespace NullableBitmap16 +namespace NullableBitmap32 { +struct TypeInfo +{ + using Type = DataModel::Nullable; + using DecodableType = DataModel::Nullable; + using DecodableArgType = const DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::TestCluster::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::NullableBitmap32::Id; } +}; +} // namespace NullableBitmap32 +namespace NullableBitmap64 { +struct TypeInfo +{ + using Type = DataModel::Nullable; + using DecodableType = DataModel::Nullable; + using DecodableArgType = const DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::TestCluster::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::NullableBitmap64::Id; } +}; +} // namespace NullableBitmap64 +namespace NullableInt8u { +struct TypeInfo +{ + using Type = DataModel::Nullable; + using DecodableType = DataModel::Nullable; + using DecodableArgType = const DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::TestCluster::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::NullableInt8u::Id; } +}; +} // namespace NullableInt8u +namespace NullableInt16u { +struct TypeInfo +{ + using Type = DataModel::Nullable; + using DecodableType = DataModel::Nullable; + using DecodableArgType = const DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::TestCluster::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::NullableInt16u::Id; } +}; +} // namespace NullableInt16u +namespace NullableInt32u { +struct TypeInfo +{ + using Type = DataModel::Nullable; + using DecodableType = DataModel::Nullable; + using DecodableArgType = const DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::TestCluster::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::NullableInt32u::Id; } +}; +} // namespace NullableInt32u +namespace NullableInt64u { +struct TypeInfo +{ + using Type = DataModel::Nullable; + using DecodableType = DataModel::Nullable; + using DecodableArgType = const DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::TestCluster::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::NullableInt64u::Id; } +}; +} // namespace NullableInt64u +namespace NullableInt8s { +struct TypeInfo +{ + using Type = DataModel::Nullable; + using DecodableType = DataModel::Nullable; + using DecodableArgType = const DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::TestCluster::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::NullableInt8s::Id; } +}; +} // namespace NullableInt8s +namespace NullableInt16s { +struct TypeInfo +{ + using Type = DataModel::Nullable; + using DecodableType = DataModel::Nullable; + using DecodableArgType = const DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::TestCluster::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::NullableInt16s::Id; } +}; +} // namespace NullableInt16s +namespace NullableInt32s { +struct TypeInfo +{ + using Type = DataModel::Nullable; + using DecodableType = DataModel::Nullable; + using DecodableArgType = const DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::TestCluster::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::NullableInt32s::Id; } +}; +} // namespace NullableInt32s +namespace NullableInt64s { +struct TypeInfo +{ + using Type = DataModel::Nullable; + using DecodableType = DataModel::Nullable; + using DecodableArgType = const DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::TestCluster::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::NullableInt64s::Id; } +}; +} // namespace NullableInt64s +namespace NullableEnum8 { +struct TypeInfo +{ + using Type = DataModel::Nullable; + using DecodableType = DataModel::Nullable; + using DecodableArgType = const DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::TestCluster::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::NullableEnum8::Id; } +}; +} // namespace NullableEnum8 +namespace NullableEnum16 { +struct TypeInfo +{ + using Type = DataModel::Nullable; + using DecodableType = DataModel::Nullable; + using DecodableArgType = const DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::TestCluster::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::NullableEnum16::Id; } +}; +} // namespace NullableEnum16 +namespace NullableOctetString { +struct TypeInfo +{ + using Type = DataModel::Nullable; + using DecodableType = DataModel::Nullable; + using DecodableArgType = const DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::TestCluster::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::NullableOctetString::Id; } +}; +} // namespace NullableOctetString +namespace NullableCharString { +struct TypeInfo +{ + using Type = DataModel::Nullable; + using DecodableType = DataModel::Nullable; + using DecodableArgType = const DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::TestCluster::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::NullableCharString::Id; } +}; +} // namespace NullableCharString namespace FeatureMap { struct TypeInfo { 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 3c6feef0adebe6..50cc4fd8a2df34 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 @@ -4516,6 +4516,74 @@ namespace Unsupported { static constexpr AttributeId Id = 0x000000FF; } // namespace Unsupported +namespace NullableBoolean { +static constexpr AttributeId Id = 0x00008000; +} // namespace NullableBoolean + +namespace NullableBitmap8 { +static constexpr AttributeId Id = 0x00008001; +} // namespace NullableBitmap8 + +namespace NullableBitmap16 { +static constexpr AttributeId Id = 0x00008002; +} // namespace NullableBitmap16 + +namespace NullableBitmap32 { +static constexpr AttributeId Id = 0x00008003; +} // namespace NullableBitmap32 + +namespace NullableBitmap64 { +static constexpr AttributeId Id = 0x00008004; +} // namespace NullableBitmap64 + +namespace NullableInt8u { +static constexpr AttributeId Id = 0x00008005; +} // namespace NullableInt8u + +namespace NullableInt16u { +static constexpr AttributeId Id = 0x00008006; +} // namespace NullableInt16u + +namespace NullableInt32u { +static constexpr AttributeId Id = 0x00008008; +} // namespace NullableInt32u + +namespace NullableInt64u { +static constexpr AttributeId Id = 0x0000800C; +} // namespace NullableInt64u + +namespace NullableInt8s { +static constexpr AttributeId Id = 0x0000800D; +} // namespace NullableInt8s + +namespace NullableInt16s { +static constexpr AttributeId Id = 0x0000800E; +} // namespace NullableInt16s + +namespace NullableInt32s { +static constexpr AttributeId Id = 0x00008010; +} // namespace NullableInt32s + +namespace NullableInt64s { +static constexpr AttributeId Id = 0x00008014; +} // namespace NullableInt64s + +namespace NullableEnum8 { +static constexpr AttributeId Id = 0x00008015; +} // namespace NullableEnum8 + +namespace NullableEnum16 { +static constexpr AttributeId Id = 0x00008016; +} // namespace NullableEnum16 + +namespace NullableOctetString { +static constexpr AttributeId Id = 0x00008019; +} // namespace NullableOctetString + +namespace NullableCharString { +static constexpr AttributeId Id = 0x0000801E; +} // namespace NullableCharString + namespace FeatureMap { static constexpr AttributeId Id = Globals::Attributes::FeatureMap::Id; } // namespace FeatureMap diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index abe7a2e40c9e99..ba18179efbbc62 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -21818,6 +21818,23 @@ class ReadTemperatureMeasurementClusterRevision : public ModelCommand | * VendorId | 0x0022 | | * ListNullablesAndOptionalsStruct | 0x0023 | | * Unsupported | 0x00FF | +| * NullableBoolean | 0x8000 | +| * NullableBitmap8 | 0x8001 | +| * NullableBitmap16 | 0x8002 | +| * NullableBitmap32 | 0x8003 | +| * NullableBitmap64 | 0x8004 | +| * NullableInt8u | 0x8005 | +| * NullableInt16u | 0x8006 | +| * NullableInt32u | 0x8008 | +| * NullableInt64u | 0x800C | +| * NullableInt8s | 0x800D | +| * NullableInt16s | 0x800E | +| * NullableInt32s | 0x8010 | +| * NullableInt64s | 0x8014 | +| * NullableEnum8 | 0x8015 | +| * NullableEnum16 | 0x8016 | +| * NullableOctetString | 0x8019 | +| * NullableCharString | 0x801E | | * ClusterRevision | 0xFFFD | \*----------------------------------------------------------------------------*/ @@ -23762,6 +23779,1145 @@ class WriteTestClusterUnsupported : public ModelCommand bool mValue; }; +/* + * Attribute NullableBoolean + */ +class ReadTestClusterNullableBoolean : public ModelCommand +{ +public: + ReadTestClusterNullableBoolean() : ModelCommand("read") + { + AddArgument("attr-name", "nullable-boolean"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterNullableBoolean() + { + 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.ReadAttributeNullableBoolean(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnBooleanAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteTestClusterNullableBoolean : public ModelCommand +{ +public: + WriteTestClusterNullableBoolean() : ModelCommand("write") + { + AddArgument("attr-name", "nullable-boolean"); + AddArgument("attr-value", 0, 1, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterNullableBoolean() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x01) on endpoint %" PRIu8, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttributeNullableBoolean(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + bool mValue; +}; + +/* + * Attribute NullableBitmap8 + */ +class ReadTestClusterNullableBitmap8 : public ModelCommand +{ +public: + ReadTestClusterNullableBitmap8() : ModelCommand("read") + { + AddArgument("attr-name", "nullable-bitmap8"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterNullableBitmap8() + { + 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.ReadAttributeNullableBitmap8(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt8uAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteTestClusterNullableBitmap8 : public ModelCommand +{ +public: + WriteTestClusterNullableBitmap8() : ModelCommand("write") + { + AddArgument("attr-name", "nullable-bitmap8"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterNullableBitmap8() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x01) on endpoint %" PRIu8, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttributeNullableBitmap8(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + uint8_t mValue; +}; + +/* + * Attribute NullableBitmap16 + */ +class ReadTestClusterNullableBitmap16 : public ModelCommand +{ +public: + ReadTestClusterNullableBitmap16() : ModelCommand("read") + { + AddArgument("attr-name", "nullable-bitmap16"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterNullableBitmap16() + { + 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.ReadAttributeNullableBitmap16(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt16uAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteTestClusterNullableBitmap16 : public ModelCommand +{ +public: + WriteTestClusterNullableBitmap16() : ModelCommand("write") + { + AddArgument("attr-name", "nullable-bitmap16"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterNullableBitmap16() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x01) on endpoint %" PRIu8, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttributeNullableBitmap16(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + uint16_t mValue; +}; + +/* + * Attribute NullableBitmap32 + */ +class ReadTestClusterNullableBitmap32 : public ModelCommand +{ +public: + ReadTestClusterNullableBitmap32() : ModelCommand("read") + { + AddArgument("attr-name", "nullable-bitmap32"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterNullableBitmap32() + { + 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.ReadAttributeNullableBitmap32(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt32uAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteTestClusterNullableBitmap32 : public ModelCommand +{ +public: + WriteTestClusterNullableBitmap32() : ModelCommand("write") + { + AddArgument("attr-name", "nullable-bitmap32"); + AddArgument("attr-value", 0, UINT32_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterNullableBitmap32() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x01) on endpoint %" PRIu8, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttributeNullableBitmap32(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + uint32_t mValue; +}; + +/* + * Attribute NullableBitmap64 + */ +class ReadTestClusterNullableBitmap64 : public ModelCommand +{ +public: + ReadTestClusterNullableBitmap64() : ModelCommand("read") + { + AddArgument("attr-name", "nullable-bitmap64"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterNullableBitmap64() + { + 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.ReadAttributeNullableBitmap64(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt64uAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteTestClusterNullableBitmap64 : public ModelCommand +{ +public: + WriteTestClusterNullableBitmap64() : ModelCommand("write") + { + AddArgument("attr-name", "nullable-bitmap64"); + AddArgument("attr-value", 0, UINT64_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterNullableBitmap64() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x01) on endpoint %" PRIu8, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttributeNullableBitmap64(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + uint64_t mValue; +}; + +/* + * Attribute NullableInt8u + */ +class ReadTestClusterNullableInt8u : public ModelCommand +{ +public: + ReadTestClusterNullableInt8u() : ModelCommand("read") + { + AddArgument("attr-name", "nullable-int8u"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterNullableInt8u() + { + 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.ReadAttributeNullableInt8u(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt8uAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteTestClusterNullableInt8u : public ModelCommand +{ +public: + WriteTestClusterNullableInt8u() : ModelCommand("write") + { + AddArgument("attr-name", "nullable-int8u"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterNullableInt8u() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x01) on endpoint %" PRIu8, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttributeNullableInt8u(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + uint8_t mValue; +}; + +/* + * Attribute NullableInt16u + */ +class ReadTestClusterNullableInt16u : public ModelCommand +{ +public: + ReadTestClusterNullableInt16u() : ModelCommand("read") + { + AddArgument("attr-name", "nullable-int16u"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterNullableInt16u() + { + 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.ReadAttributeNullableInt16u(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt16uAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteTestClusterNullableInt16u : public ModelCommand +{ +public: + WriteTestClusterNullableInt16u() : ModelCommand("write") + { + AddArgument("attr-name", "nullable-int16u"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterNullableInt16u() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x01) on endpoint %" PRIu8, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttributeNullableInt16u(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + uint16_t mValue; +}; + +/* + * Attribute NullableInt32u + */ +class ReadTestClusterNullableInt32u : public ModelCommand +{ +public: + ReadTestClusterNullableInt32u() : ModelCommand("read") + { + AddArgument("attr-name", "nullable-int32u"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterNullableInt32u() + { + 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.ReadAttributeNullableInt32u(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt32uAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteTestClusterNullableInt32u : public ModelCommand +{ +public: + WriteTestClusterNullableInt32u() : ModelCommand("write") + { + AddArgument("attr-name", "nullable-int32u"); + AddArgument("attr-value", 0, UINT32_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterNullableInt32u() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x01) on endpoint %" PRIu8, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttributeNullableInt32u(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + uint32_t mValue; +}; + +/* + * Attribute NullableInt64u + */ +class ReadTestClusterNullableInt64u : public ModelCommand +{ +public: + ReadTestClusterNullableInt64u() : ModelCommand("read") + { + AddArgument("attr-name", "nullable-int64u"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterNullableInt64u() + { + 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.ReadAttributeNullableInt64u(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt64uAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteTestClusterNullableInt64u : public ModelCommand +{ +public: + WriteTestClusterNullableInt64u() : ModelCommand("write") + { + AddArgument("attr-name", "nullable-int64u"); + AddArgument("attr-value", 0, UINT64_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterNullableInt64u() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x01) on endpoint %" PRIu8, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttributeNullableInt64u(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + uint64_t mValue; +}; + +/* + * Attribute NullableInt8s + */ +class ReadTestClusterNullableInt8s : public ModelCommand +{ +public: + ReadTestClusterNullableInt8s() : ModelCommand("read") + { + AddArgument("attr-name", "nullable-int8s"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterNullableInt8s() + { + 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.ReadAttributeNullableInt8s(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt8sAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteTestClusterNullableInt8s : public ModelCommand +{ +public: + WriteTestClusterNullableInt8s() : ModelCommand("write") + { + AddArgument("attr-name", "nullable-int8s"); + AddArgument("attr-value", INT8_MIN, INT8_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterNullableInt8s() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x01) on endpoint %" PRIu8, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttributeNullableInt8s(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + int8_t mValue; +}; + +/* + * Attribute NullableInt16s + */ +class ReadTestClusterNullableInt16s : public ModelCommand +{ +public: + ReadTestClusterNullableInt16s() : ModelCommand("read") + { + AddArgument("attr-name", "nullable-int16s"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterNullableInt16s() + { + 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.ReadAttributeNullableInt16s(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt16sAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteTestClusterNullableInt16s : public ModelCommand +{ +public: + WriteTestClusterNullableInt16s() : ModelCommand("write") + { + AddArgument("attr-name", "nullable-int16s"); + AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterNullableInt16s() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x01) on endpoint %" PRIu8, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttributeNullableInt16s(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + int16_t mValue; +}; + +/* + * Attribute NullableInt32s + */ +class ReadTestClusterNullableInt32s : public ModelCommand +{ +public: + ReadTestClusterNullableInt32s() : ModelCommand("read") + { + AddArgument("attr-name", "nullable-int32s"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterNullableInt32s() + { + 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.ReadAttributeNullableInt32s(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt32sAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteTestClusterNullableInt32s : public ModelCommand +{ +public: + WriteTestClusterNullableInt32s() : ModelCommand("write") + { + AddArgument("attr-name", "nullable-int32s"); + AddArgument("attr-value", INT32_MIN, INT32_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterNullableInt32s() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x01) on endpoint %" PRIu8, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttributeNullableInt32s(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + int32_t mValue; +}; + +/* + * Attribute NullableInt64s + */ +class ReadTestClusterNullableInt64s : public ModelCommand +{ +public: + ReadTestClusterNullableInt64s() : ModelCommand("read") + { + AddArgument("attr-name", "nullable-int64s"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterNullableInt64s() + { + 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.ReadAttributeNullableInt64s(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt64sAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteTestClusterNullableInt64s : public ModelCommand +{ +public: + WriteTestClusterNullableInt64s() : ModelCommand("write") + { + AddArgument("attr-name", "nullable-int64s"); + AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterNullableInt64s() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x01) on endpoint %" PRIu8, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttributeNullableInt64s(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + int64_t mValue; +}; + +/* + * Attribute NullableEnum8 + */ +class ReadTestClusterNullableEnum8 : public ModelCommand +{ +public: + ReadTestClusterNullableEnum8() : ModelCommand("read") + { + AddArgument("attr-name", "nullable-enum8"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterNullableEnum8() + { + 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.ReadAttributeNullableEnum8(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt8uAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteTestClusterNullableEnum8 : public ModelCommand +{ +public: + WriteTestClusterNullableEnum8() : ModelCommand("write") + { + AddArgument("attr-name", "nullable-enum8"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterNullableEnum8() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x01) on endpoint %" PRIu8, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttributeNullableEnum8(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + uint8_t mValue; +}; + +/* + * Attribute NullableEnum16 + */ +class ReadTestClusterNullableEnum16 : public ModelCommand +{ +public: + ReadTestClusterNullableEnum16() : ModelCommand("read") + { + AddArgument("attr-name", "nullable-enum16"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterNullableEnum16() + { + 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.ReadAttributeNullableEnum16(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt16uAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteTestClusterNullableEnum16 : public ModelCommand +{ +public: + WriteTestClusterNullableEnum16() : ModelCommand("write") + { + AddArgument("attr-name", "nullable-enum16"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterNullableEnum16() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x01) on endpoint %" PRIu8, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttributeNullableEnum16(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + uint16_t mValue; +}; + +/* + * Attribute NullableOctetString + */ +class ReadTestClusterNullableOctetString : public ModelCommand +{ +public: + ReadTestClusterNullableOctetString() : ModelCommand("read") + { + AddArgument("attr-name", "nullable-octet-string"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterNullableOctetString() + { + 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.ReadAttributeNullableOctetString(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnOctetStringAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteTestClusterNullableOctetString : public ModelCommand +{ +public: + WriteTestClusterNullableOctetString() : ModelCommand("write") + { + AddArgument("attr-name", "nullable-octet-string"); + AddArgument("attr-value", &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterNullableOctetString() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x01) on endpoint %" PRIu8, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttributeNullableOctetString(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + chip::ByteSpan mValue; +}; + +/* + * Attribute NullableCharString + */ +class ReadTestClusterNullableCharString : public ModelCommand +{ +public: + ReadTestClusterNullableCharString() : ModelCommand("read") + { + AddArgument("attr-name", "nullable-char-string"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterNullableCharString() + { + 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.ReadAttributeNullableCharString(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnCharStringAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class WriteTestClusterNullableCharString : public ModelCommand +{ +public: + WriteTestClusterNullableCharString() : ModelCommand("write") + { + AddArgument("attr-name", "nullable-char-string"); + AddArgument("attr-value", &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterNullableCharString() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x01) on endpoint %" PRIu8, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttributeNullableCharString(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + chip::CharSpan mValue; +}; + /* * Attribute ClusterRevision */ @@ -30450,6 +31606,40 @@ void registerClusterTestCluster(Commands & commands) make_unique(), // make_unique(), // make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // make_unique(), // }; diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index b5ba0cacf25f5e..8ea6d31a658f64 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -615,26 +615,9 @@ class Test_TC_BI_2_2 : public TestCommand std::atomic_uint16_t mTestIndex; const uint16_t mTestCount = 8; - chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; - chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; - chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; - chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; - chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; - chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; - chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; - chip::Callback::Callback mOnFailureCallback_4{ OnFailureCallback_4, this }; - chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, this }; - chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; - chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; - chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; - chip::Callback::Callback mOnSuccessCallback_6{ OnSuccessCallback_6, this }; - chip::Callback::Callback mOnFailureCallback_7{ OnFailureCallback_7, this }; - chip::Callback::Callback mOnSuccessCallback_7{ OnSuccessCallback_7, this }; - - static void OnFailureCallback_0(void * context, uint8_t status) + static void OnFailureCallback_0(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_0(chip::to_underlying(status)); } static void OnSuccessCallback_0(void * context, bool presentValue) @@ -642,9 +625,9 @@ class Test_TC_BI_2_2 : public TestCommand (static_cast(context))->OnSuccessResponse_0(presentValue); } - static void OnFailureCallback_1(void * context, uint8_t status) + static void OnFailureCallback_1(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_1(status); + (static_cast(context))->OnFailureResponse_1(chip::to_underlying(status)); } static void OnSuccessCallback_1(void * context, bool outOfService) @@ -652,9 +635,9 @@ class Test_TC_BI_2_2 : public TestCommand (static_cast(context))->OnSuccessResponse_1(outOfService); } - static void OnFailureCallback_2(void * context, uint8_t status) + static void OnFailureCallback_2(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_2(status); + (static_cast(context))->OnFailureResponse_2(chip::to_underlying(status)); } static void OnSuccessCallback_2(void * context, uint8_t statusFlags) @@ -662,9 +645,9 @@ class Test_TC_BI_2_2 : public TestCommand (static_cast(context))->OnSuccessResponse_2(statusFlags); } - static void OnFailureCallback_3(void * context, uint8_t status) + static void OnFailureCallback_3(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_3(status); + (static_cast(context))->OnFailureResponse_3(chip::to_underlying(status)); } static void OnSuccessCallback_3(void * context, bool presentValue) @@ -672,9 +655,9 @@ class Test_TC_BI_2_2 : public TestCommand (static_cast(context))->OnSuccessResponse_3(presentValue); } - static void OnFailureCallback_4(void * context, uint8_t status) + static void OnFailureCallback_4(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_4(status); + (static_cast(context))->OnFailureResponse_4(chip::to_underlying(status)); } static void OnSuccessCallback_4(void * context, bool outOfService) @@ -682,9 +665,9 @@ class Test_TC_BI_2_2 : public TestCommand (static_cast(context))->OnSuccessResponse_4(outOfService); } - static void OnFailureCallback_5(void * context, uint8_t status) + static void OnFailureCallback_5(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_5(status); + (static_cast(context))->OnFailureResponse_5(chip::to_underlying(status)); } static void OnSuccessCallback_5(void * context, uint8_t statusFlags) @@ -692,9 +675,9 @@ class Test_TC_BI_2_2 : public TestCommand (static_cast(context))->OnSuccessResponse_5(statusFlags); } - static void OnFailureCallback_6(void * context, uint8_t status) + static void OnFailureCallback_6(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_6(status); + (static_cast(context))->OnFailureResponse_6(chip::to_underlying(status)); } static void OnSuccessCallback_6(void * context, uint8_t statusFlags) @@ -702,9 +685,9 @@ class Test_TC_BI_2_2 : public TestCommand (static_cast(context))->OnSuccessResponse_6(statusFlags); } - static void OnFailureCallback_7(void * context, uint8_t status) + static void OnFailureCallback_7(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_7(status); + (static_cast(context))->OnFailureResponse_7(chip::to_underlying(status)); } static void OnSuccessCallback_7(void * context, uint8_t statusFlags) @@ -721,7 +704,8 @@ class Test_TC_BI_2_2 : public TestCommand chip::Controller::BinaryInputBasicClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributePresentValue(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_0, OnFailureCallback_0); } void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } @@ -737,7 +721,8 @@ class Test_TC_BI_2_2 : public TestCommand chip::Controller::BinaryInputBasicClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOutOfService(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_1, OnFailureCallback_1); } void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } @@ -753,7 +738,8 @@ class Test_TC_BI_2_2 : public TestCommand chip::Controller::BinaryInputBasicClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeStatusFlags(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_2, OnFailureCallback_2); } void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } @@ -769,7 +755,8 @@ class Test_TC_BI_2_2 : public TestCommand chip::Controller::BinaryInputBasicClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributePresentValue(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_3, OnFailureCallback_3); } void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } @@ -785,7 +772,8 @@ class Test_TC_BI_2_2 : public TestCommand chip::Controller::BinaryInputBasicClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOutOfService(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_4, OnFailureCallback_4); } void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } @@ -801,7 +789,8 @@ class Test_TC_BI_2_2 : public TestCommand chip::Controller::BinaryInputBasicClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeStatusFlags(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_5, OnFailureCallback_5); } void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } @@ -817,7 +806,8 @@ class Test_TC_BI_2_2 : public TestCommand chip::Controller::BinaryInputBasicClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeStatusFlags(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_6, OnFailureCallback_6); } void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } @@ -833,7 +823,8 @@ class Test_TC_BI_2_2 : public TestCommand chip::Controller::BinaryInputBasicClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeStatusFlags(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_7, OnFailureCallback_7); } void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } @@ -21012,141 +21003,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand std::atomic_uint16_t mTestIndex; const uint16_t mTestCount = 60; - chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; - chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; - chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, - this }; - chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; - chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, - this }; - chip::Callback::Callback mOnFailureCallback_4{ OnFailureCallback_4, this }; - chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, - this }; - chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; - chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, - this }; - chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; - chip::Callback::Callback mOnSuccessCallback_6{ OnSuccessCallback_6, - this }; - chip::Callback::Callback mOnFailureCallback_8{ OnFailureCallback_8, this }; - chip::Callback::Callback mOnSuccessCallback_8{ OnSuccessCallback_8, - this }; - chip::Callback::Callback mOnFailureCallback_9{ OnFailureCallback_9, this }; - chip::Callback::Callback mOnSuccessCallback_9{ OnSuccessCallback_9, - this }; - chip::Callback::Callback mOnFailureCallback_10{ OnFailureCallback_10, this }; - chip::Callback::Callback mOnSuccessCallback_10{ OnSuccessCallback_10, - this }; - chip::Callback::Callback mOnFailureCallback_12{ OnFailureCallback_12, this }; - chip::Callback::Callback mOnSuccessCallback_12{ OnSuccessCallback_12, - this }; - chip::Callback::Callback mOnFailureCallback_13{ OnFailureCallback_13, this }; - chip::Callback::Callback mOnSuccessCallback_13{ OnSuccessCallback_13, - this }; - chip::Callback::Callback mOnFailureCallback_14{ OnFailureCallback_14, this }; - chip::Callback::Callback mOnSuccessCallback_14{ OnSuccessCallback_14, - this }; - chip::Callback::Callback mOnFailureCallback_16{ OnFailureCallback_16, this }; - chip::Callback::Callback mOnSuccessCallback_16{ OnSuccessCallback_16, - this }; - chip::Callback::Callback mOnFailureCallback_17{ OnFailureCallback_17, this }; - chip::Callback::Callback mOnSuccessCallback_17{ OnSuccessCallback_17, - this }; - chip::Callback::Callback mOnFailureCallback_18{ OnFailureCallback_18, this }; - chip::Callback::Callback mOnSuccessCallback_18{ OnSuccessCallback_18, - this }; - chip::Callback::Callback mOnFailureCallback_20{ OnFailureCallback_20, this }; - chip::Callback::Callback mOnSuccessCallback_20{ OnSuccessCallback_20, - this }; - chip::Callback::Callback mOnFailureCallback_21{ OnFailureCallback_21, this }; - chip::Callback::Callback mOnSuccessCallback_21{ OnSuccessCallback_21, - this }; - chip::Callback::Callback mOnFailureCallback_22{ OnFailureCallback_22, this }; - chip::Callback::Callback mOnSuccessCallback_22{ OnSuccessCallback_22, - this }; - chip::Callback::Callback mOnFailureCallback_24{ OnFailureCallback_24, this }; - chip::Callback::Callback mOnSuccessCallback_24{ OnSuccessCallback_24, - this }; - chip::Callback::Callback mOnFailureCallback_25{ OnFailureCallback_25, this }; - chip::Callback::Callback mOnSuccessCallback_25{ OnSuccessCallback_25, - this }; - chip::Callback::Callback mOnFailureCallback_26{ OnFailureCallback_26, this }; - chip::Callback::Callback mOnSuccessCallback_26{ OnSuccessCallback_26, - this }; - chip::Callback::Callback mOnFailureCallback_28{ OnFailureCallback_28, this }; - chip::Callback::Callback mOnSuccessCallback_28{ OnSuccessCallback_28, - this }; - chip::Callback::Callback mOnFailureCallback_29{ OnFailureCallback_29, this }; - chip::Callback::Callback mOnSuccessCallback_29{ OnSuccessCallback_29, - this }; - chip::Callback::Callback mOnFailureCallback_30{ OnFailureCallback_30, this }; - chip::Callback::Callback mOnSuccessCallback_30{ OnSuccessCallback_30, - this }; - chip::Callback::Callback mOnFailureCallback_32{ OnFailureCallback_32, this }; - chip::Callback::Callback mOnSuccessCallback_32{ OnSuccessCallback_32, - this }; - chip::Callback::Callback mOnFailureCallback_33{ OnFailureCallback_33, this }; - chip::Callback::Callback mOnSuccessCallback_33{ OnSuccessCallback_33, - this }; - chip::Callback::Callback mOnFailureCallback_34{ OnFailureCallback_34, this }; - chip::Callback::Callback mOnSuccessCallback_34{ OnSuccessCallback_34, - this }; - chip::Callback::Callback mOnFailureCallback_36{ OnFailureCallback_36, this }; - chip::Callback::Callback mOnSuccessCallback_36{ OnSuccessCallback_36, - this }; - chip::Callback::Callback mOnFailureCallback_37{ OnFailureCallback_37, this }; - chip::Callback::Callback mOnSuccessCallback_37{ OnSuccessCallback_37, - this }; - chip::Callback::Callback mOnFailureCallback_38{ OnFailureCallback_38, this }; - chip::Callback::Callback mOnSuccessCallback_38{ OnSuccessCallback_38, - this }; - chip::Callback::Callback mOnFailureCallback_40{ OnFailureCallback_40, this }; - chip::Callback::Callback mOnSuccessCallback_40{ OnSuccessCallback_40, - this }; - chip::Callback::Callback mOnFailureCallback_41{ OnFailureCallback_41, this }; - chip::Callback::Callback mOnSuccessCallback_41{ - OnSuccessCallback_41, this - }; - chip::Callback::Callback mOnFailureCallback_42{ OnFailureCallback_42, this }; - chip::Callback::Callback mOnSuccessCallback_42{ - OnSuccessCallback_42, this - }; - chip::Callback::Callback mOnFailureCallback_44{ OnFailureCallback_44, this }; - chip::Callback::Callback mOnSuccessCallback_44{ - OnSuccessCallback_44, this - }; - chip::Callback::Callback mOnFailureCallback_45{ OnFailureCallback_45, this }; - chip::Callback::Callback mOnSuccessCallback_45{ OnSuccessCallback_45, this }; - chip::Callback::Callback mOnFailureCallback_46{ OnFailureCallback_46, this }; - chip::Callback::Callback mOnSuccessCallback_46{ OnSuccessCallback_46, this }; - chip::Callback::Callback mOnFailureCallback_48{ OnFailureCallback_48, this }; - chip::Callback::Callback mOnSuccessCallback_48{ OnSuccessCallback_48, this }; - chip::Callback::Callback mOnFailureCallback_49{ OnFailureCallback_49, this }; - chip::Callback::Callback mOnSuccessCallback_49{ OnSuccessCallback_49, - this }; - chip::Callback::Callback mOnFailureCallback_50{ OnFailureCallback_50, this }; - chip::Callback::Callback mOnSuccessCallback_50{ OnSuccessCallback_50, - this }; - chip::Callback::Callback mOnFailureCallback_52{ OnFailureCallback_52, this }; - chip::Callback::Callback mOnSuccessCallback_52{ OnSuccessCallback_52, - this }; - chip::Callback::Callback mOnFailureCallback_53{ OnFailureCallback_53, this }; - chip::Callback::Callback mOnSuccessCallback_53{ OnSuccessCallback_53, this }; - chip::Callback::Callback mOnFailureCallback_55{ OnFailureCallback_55, this }; - chip::Callback::Callback mOnSuccessCallback_55{ OnSuccessCallback_55, this }; - chip::Callback::Callback mOnFailureCallback_56{ OnFailureCallback_56, this }; - chip::Callback::Callback mOnSuccessCallback_56{ - OnSuccessCallback_56, this - }; - chip::Callback::Callback mOnFailureCallback_58{ OnFailureCallback_58, this }; - chip::Callback::Callback mOnSuccessCallback_58{ - OnSuccessCallback_58, this - }; - - static void OnFailureCallback_0(void * context, uint8_t status) + static void OnFailureCallback_0(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_0(chip::to_underlying(status)); } static void OnSuccessCallback_0(void * context, int16_t localTemperature) @@ -21154,9 +21013,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand (static_cast(context))->OnSuccessResponse_0(localTemperature); } - static void OnFailureCallback_1(void * context, uint8_t status) + static void OnFailureCallback_1(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_1(status); + (static_cast(context))->OnFailureResponse_1(chip::to_underlying(status)); } static void OnSuccessCallback_1(void * context, int16_t absMinHeatSetpointLimit) @@ -21164,9 +21023,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand (static_cast(context))->OnSuccessResponse_1(absMinHeatSetpointLimit); } - static void OnFailureCallback_2(void * context, uint8_t status) + static void OnFailureCallback_2(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_2(status); + (static_cast(context))->OnFailureResponse_2(chip::to_underlying(status)); } static void OnSuccessCallback_2(void * context, int16_t absMinHeatSetpointLimit) @@ -21181,9 +21040,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } - static void OnFailureCallback_4(void * context, uint8_t status) + static void OnFailureCallback_4(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_4(status); + (static_cast(context))->OnFailureResponse_4(chip::to_underlying(status)); } static void OnSuccessCallback_4(void * context, int16_t absMinHeatSetpointLimit) @@ -21191,9 +21050,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand (static_cast(context))->OnSuccessResponse_4(absMinHeatSetpointLimit); } - static void OnFailureCallback_5(void * context, uint8_t status) + static void OnFailureCallback_5(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_5(status); + (static_cast(context))->OnFailureResponse_5(chip::to_underlying(status)); } static void OnSuccessCallback_5(void * context, int16_t absMaxHeatSetpointLimit) @@ -21201,9 +21060,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand (static_cast(context))->OnSuccessResponse_5(absMaxHeatSetpointLimit); } - static void OnFailureCallback_6(void * context, uint8_t status) + static void OnFailureCallback_6(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_6(status); + (static_cast(context))->OnFailureResponse_6(chip::to_underlying(status)); } static void OnSuccessCallback_6(void * context, int16_t absMaxHeatSetpointLimit) @@ -21218,9 +21077,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand static void OnSuccessCallback_7(void * context) { (static_cast(context))->OnSuccessResponse_7(); } - static void OnFailureCallback_8(void * context, uint8_t status) + static void OnFailureCallback_8(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_8(status); + (static_cast(context))->OnFailureResponse_8(chip::to_underlying(status)); } static void OnSuccessCallback_8(void * context, int16_t absMaxHeatSetpointLimit) @@ -21228,9 +21087,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand (static_cast(context))->OnSuccessResponse_8(absMaxHeatSetpointLimit); } - static void OnFailureCallback_9(void * context, uint8_t status) + static void OnFailureCallback_9(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_9(status); + (static_cast(context))->OnFailureResponse_9(chip::to_underlying(status)); } static void OnSuccessCallback_9(void * context, int16_t absMinCoolSetpointLimit) @@ -21238,9 +21097,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand (static_cast(context))->OnSuccessResponse_9(absMinCoolSetpointLimit); } - static void OnFailureCallback_10(void * context, uint8_t status) + static void OnFailureCallback_10(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_10(status); + (static_cast(context))->OnFailureResponse_10(chip::to_underlying(status)); } static void OnSuccessCallback_10(void * context, int16_t absMinCoolSetpointLimit) @@ -21255,9 +21114,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand static void OnSuccessCallback_11(void * context) { (static_cast(context))->OnSuccessResponse_11(); } - static void OnFailureCallback_12(void * context, uint8_t status) + static void OnFailureCallback_12(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_12(status); + (static_cast(context))->OnFailureResponse_12(chip::to_underlying(status)); } static void OnSuccessCallback_12(void * context, int16_t absMinCoolSetpointLimit) @@ -21265,9 +21124,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand (static_cast(context))->OnSuccessResponse_12(absMinCoolSetpointLimit); } - static void OnFailureCallback_13(void * context, uint8_t status) + static void OnFailureCallback_13(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_13(status); + (static_cast(context))->OnFailureResponse_13(chip::to_underlying(status)); } static void OnSuccessCallback_13(void * context, int16_t absMaxCoolSetpointLimit) @@ -21275,9 +21134,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand (static_cast(context))->OnSuccessResponse_13(absMaxCoolSetpointLimit); } - static void OnFailureCallback_14(void * context, uint8_t status) + static void OnFailureCallback_14(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_14(status); + (static_cast(context))->OnFailureResponse_14(chip::to_underlying(status)); } static void OnSuccessCallback_14(void * context, int16_t absMaxCoolSetpointLimit) @@ -21292,9 +21151,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand static void OnSuccessCallback_15(void * context) { (static_cast(context))->OnSuccessResponse_15(); } - static void OnFailureCallback_16(void * context, uint8_t status) + static void OnFailureCallback_16(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_16(status); + (static_cast(context))->OnFailureResponse_16(chip::to_underlying(status)); } static void OnSuccessCallback_16(void * context, int16_t absMaxCoolSetpointLimit) @@ -21302,9 +21161,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand (static_cast(context))->OnSuccessResponse_16(absMaxCoolSetpointLimit); } - static void OnFailureCallback_17(void * context, uint8_t status) + static void OnFailureCallback_17(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_17(status); + (static_cast(context))->OnFailureResponse_17(chip::to_underlying(status)); } static void OnSuccessCallback_17(void * context, int16_t occupiedCoolingSetpoint) @@ -21312,9 +21171,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand (static_cast(context))->OnSuccessResponse_17(occupiedCoolingSetpoint); } - static void OnFailureCallback_18(void * context, uint8_t status) + static void OnFailureCallback_18(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_18(status); + (static_cast(context))->OnFailureResponse_18(chip::to_underlying(status)); } static void OnSuccessCallback_18(void * context, int16_t occupiedCoolingSetpoint) @@ -21329,9 +21188,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand static void OnSuccessCallback_19(void * context) { (static_cast(context))->OnSuccessResponse_19(); } - static void OnFailureCallback_20(void * context, uint8_t status) + static void OnFailureCallback_20(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_20(status); + (static_cast(context))->OnFailureResponse_20(chip::to_underlying(status)); } static void OnSuccessCallback_20(void * context, int16_t occupiedCoolingSetpoint) @@ -21339,9 +21198,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand (static_cast(context))->OnSuccessResponse_20(occupiedCoolingSetpoint); } - static void OnFailureCallback_21(void * context, uint8_t status) + static void OnFailureCallback_21(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_21(status); + (static_cast(context))->OnFailureResponse_21(chip::to_underlying(status)); } static void OnSuccessCallback_21(void * context, int16_t occupiedHeatingSetpoint) @@ -21349,9 +21208,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand (static_cast(context))->OnSuccessResponse_21(occupiedHeatingSetpoint); } - static void OnFailureCallback_22(void * context, uint8_t status) + static void OnFailureCallback_22(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_22(status); + (static_cast(context))->OnFailureResponse_22(chip::to_underlying(status)); } static void OnSuccessCallback_22(void * context, int16_t occupiedHeatingSetpoint) @@ -21366,9 +21225,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand static void OnSuccessCallback_23(void * context) { (static_cast(context))->OnSuccessResponse_23(); } - static void OnFailureCallback_24(void * context, uint8_t status) + static void OnFailureCallback_24(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_24(status); + (static_cast(context))->OnFailureResponse_24(chip::to_underlying(status)); } static void OnSuccessCallback_24(void * context, int16_t occupiedHeatingSetpoint) @@ -21376,9 +21235,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand (static_cast(context))->OnSuccessResponse_24(occupiedHeatingSetpoint); } - static void OnFailureCallback_25(void * context, uint8_t status) + static void OnFailureCallback_25(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_25(status); + (static_cast(context))->OnFailureResponse_25(chip::to_underlying(status)); } static void OnSuccessCallback_25(void * context, int16_t minHeatSetpointLimit) @@ -21386,9 +21245,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand (static_cast(context))->OnSuccessResponse_25(minHeatSetpointLimit); } - static void OnFailureCallback_26(void * context, uint8_t status) + static void OnFailureCallback_26(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_26(status); + (static_cast(context))->OnFailureResponse_26(chip::to_underlying(status)); } static void OnSuccessCallback_26(void * context, int16_t minHeatSetpointLimit) @@ -21403,9 +21262,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand static void OnSuccessCallback_27(void * context) { (static_cast(context))->OnSuccessResponse_27(); } - static void OnFailureCallback_28(void * context, uint8_t status) + static void OnFailureCallback_28(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_28(status); + (static_cast(context))->OnFailureResponse_28(chip::to_underlying(status)); } static void OnSuccessCallback_28(void * context, int16_t minHeatSetpointLimit) @@ -21413,9 +21272,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand (static_cast(context))->OnSuccessResponse_28(minHeatSetpointLimit); } - static void OnFailureCallback_29(void * context, uint8_t status) + static void OnFailureCallback_29(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_29(status); + (static_cast(context))->OnFailureResponse_29(chip::to_underlying(status)); } static void OnSuccessCallback_29(void * context, int16_t maxHeatSetpointLimit) @@ -21423,9 +21282,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand (static_cast(context))->OnSuccessResponse_29(maxHeatSetpointLimit); } - static void OnFailureCallback_30(void * context, uint8_t status) + static void OnFailureCallback_30(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_30(status); + (static_cast(context))->OnFailureResponse_30(chip::to_underlying(status)); } static void OnSuccessCallback_30(void * context, int16_t maxHeatSetpointLimit) @@ -21440,9 +21299,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand static void OnSuccessCallback_31(void * context) { (static_cast(context))->OnSuccessResponse_31(); } - static void OnFailureCallback_32(void * context, uint8_t status) + static void OnFailureCallback_32(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_32(status); + (static_cast(context))->OnFailureResponse_32(chip::to_underlying(status)); } static void OnSuccessCallback_32(void * context, int16_t maxHeatSetpointLimit) @@ -21450,9 +21309,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand (static_cast(context))->OnSuccessResponse_32(maxHeatSetpointLimit); } - static void OnFailureCallback_33(void * context, uint8_t status) + static void OnFailureCallback_33(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_33(status); + (static_cast(context))->OnFailureResponse_33(chip::to_underlying(status)); } static void OnSuccessCallback_33(void * context, int16_t minCoolSetpointLimit) @@ -21460,9 +21319,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand (static_cast(context))->OnSuccessResponse_33(minCoolSetpointLimit); } - static void OnFailureCallback_34(void * context, uint8_t status) + static void OnFailureCallback_34(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_34(status); + (static_cast(context))->OnFailureResponse_34(chip::to_underlying(status)); } static void OnSuccessCallback_34(void * context, int16_t minCoolSetpointLimit) @@ -21477,9 +21336,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand static void OnSuccessCallback_35(void * context) { (static_cast(context))->OnSuccessResponse_35(); } - static void OnFailureCallback_36(void * context, uint8_t status) + static void OnFailureCallback_36(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_36(status); + (static_cast(context))->OnFailureResponse_36(chip::to_underlying(status)); } static void OnSuccessCallback_36(void * context, int16_t minCoolSetpointLimit) @@ -21487,9 +21346,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand (static_cast(context))->OnSuccessResponse_36(minCoolSetpointLimit); } - static void OnFailureCallback_37(void * context, uint8_t status) + static void OnFailureCallback_37(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_37(status); + (static_cast(context))->OnFailureResponse_37(chip::to_underlying(status)); } static void OnSuccessCallback_37(void * context, int16_t maxCoolSetpointLimit) @@ -21497,9 +21356,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand (static_cast(context))->OnSuccessResponse_37(maxCoolSetpointLimit); } - static void OnFailureCallback_38(void * context, uint8_t status) + static void OnFailureCallback_38(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_38(status); + (static_cast(context))->OnFailureResponse_38(chip::to_underlying(status)); } static void OnSuccessCallback_38(void * context, int16_t maxCoolSetpointLimit) @@ -21514,9 +21373,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand static void OnSuccessCallback_39(void * context) { (static_cast(context))->OnSuccessResponse_39(); } - static void OnFailureCallback_40(void * context, uint8_t status) + static void OnFailureCallback_40(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_40(status); + (static_cast(context))->OnFailureResponse_40(chip::to_underlying(status)); } static void OnSuccessCallback_40(void * context, int16_t maxCoolSetpointLimit) @@ -21524,9 +21383,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand (static_cast(context))->OnSuccessResponse_40(maxCoolSetpointLimit); } - static void OnFailureCallback_41(void * context, uint8_t status) + static void OnFailureCallback_41(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_41(status); + (static_cast(context))->OnFailureResponse_41(chip::to_underlying(status)); } static void OnSuccessCallback_41(void * context, uint8_t controlSequenceOfOperation) @@ -21534,9 +21393,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand (static_cast(context))->OnSuccessResponse_41(controlSequenceOfOperation); } - static void OnFailureCallback_42(void * context, uint8_t status) + static void OnFailureCallback_42(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_42(status); + (static_cast(context))->OnFailureResponse_42(chip::to_underlying(status)); } static void OnSuccessCallback_42(void * context, uint8_t controlSequenceOfOperation) @@ -21551,9 +21410,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand static void OnSuccessCallback_43(void * context) { (static_cast(context))->OnSuccessResponse_43(); } - static void OnFailureCallback_44(void * context, uint8_t status) + static void OnFailureCallback_44(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_44(status); + (static_cast(context))->OnFailureResponse_44(chip::to_underlying(status)); } static void OnSuccessCallback_44(void * context, uint8_t controlSequenceOfOperation) @@ -21561,9 +21420,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand (static_cast(context))->OnSuccessResponse_44(controlSequenceOfOperation); } - static void OnFailureCallback_45(void * context, uint8_t status) + static void OnFailureCallback_45(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_45(status); + (static_cast(context))->OnFailureResponse_45(chip::to_underlying(status)); } static void OnSuccessCallback_45(void * context, uint8_t systemMode) @@ -21571,9 +21430,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand (static_cast(context))->OnSuccessResponse_45(systemMode); } - static void OnFailureCallback_46(void * context, uint8_t status) + static void OnFailureCallback_46(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_46(status); + (static_cast(context))->OnFailureResponse_46(chip::to_underlying(status)); } static void OnSuccessCallback_46(void * context, uint8_t systemMode) @@ -21588,9 +21447,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand static void OnSuccessCallback_47(void * context) { (static_cast(context))->OnSuccessResponse_47(); } - static void OnFailureCallback_48(void * context, uint8_t status) + static void OnFailureCallback_48(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_48(status); + (static_cast(context))->OnFailureResponse_48(chip::to_underlying(status)); } static void OnSuccessCallback_48(void * context, uint8_t systemMode) @@ -21598,9 +21457,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand (static_cast(context))->OnSuccessResponse_48(systemMode); } - static void OnFailureCallback_49(void * context, uint8_t status) + static void OnFailureCallback_49(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_49(status); + (static_cast(context))->OnFailureResponse_49(chip::to_underlying(status)); } static void OnSuccessCallback_49(void * context, int8_t minSetpointDeadBand) @@ -21608,9 +21467,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand (static_cast(context))->OnSuccessResponse_49(minSetpointDeadBand); } - static void OnFailureCallback_50(void * context, uint8_t status) + static void OnFailureCallback_50(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_50(status); + (static_cast(context))->OnFailureResponse_50(chip::to_underlying(status)); } static void OnSuccessCallback_50(void * context, int8_t minSetpointDeadBand) @@ -21625,9 +21484,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand static void OnSuccessCallback_51(void * context) { (static_cast(context))->OnSuccessResponse_51(); } - static void OnFailureCallback_52(void * context, uint8_t status) + static void OnFailureCallback_52(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_52(status); + (static_cast(context))->OnFailureResponse_52(chip::to_underlying(status)); } static void OnSuccessCallback_52(void * context, int8_t minSetpointDeadBand) @@ -21635,9 +21494,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand (static_cast(context))->OnSuccessResponse_52(minSetpointDeadBand); } - static void OnFailureCallback_53(void * context, uint8_t status) + static void OnFailureCallback_53(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_53(status); + (static_cast(context))->OnFailureResponse_53(chip::to_underlying(status)); } static void OnSuccessCallback_53(void * context, uint8_t startOfWeek) @@ -21652,9 +21511,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand static void OnSuccessCallback_54(void * context) { (static_cast(context))->OnSuccessResponse_54(); } - static void OnFailureCallback_55(void * context, uint8_t status) + static void OnFailureCallback_55(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_55(status); + (static_cast(context))->OnFailureResponse_55(chip::to_underlying(status)); } static void OnSuccessCallback_55(void * context, uint8_t startOfWeek) @@ -21662,9 +21521,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand (static_cast(context))->OnSuccessResponse_55(startOfWeek); } - static void OnFailureCallback_56(void * context, uint8_t status) + static void OnFailureCallback_56(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_56(status); + (static_cast(context))->OnFailureResponse_56(chip::to_underlying(status)); } static void OnSuccessCallback_56(void * context, uint8_t numberOfWeeklyTransitions) @@ -21679,9 +21538,9 @@ class Test_TC_TSTAT_2_1 : public TestCommand static void OnSuccessCallback_57(void * context) { (static_cast(context))->OnSuccessResponse_57(); } - static void OnFailureCallback_58(void * context, uint8_t status) + static void OnFailureCallback_58(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_58(status); + (static_cast(context))->OnFailureResponse_58(chip::to_underlying(status)); } static void OnSuccessCallback_58(void * context, uint8_t numberOfDailyTransitions) @@ -21705,7 +21564,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeLocalTemperature(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_0, OnFailureCallback_0); } void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } @@ -21721,7 +21581,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeAbsMinHeatSetpointLimit(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_1, OnFailureCallback_1); } void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } @@ -21737,7 +21598,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeAbsMinHeatSetpointLimit(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_2, OnFailureCallback_2); } void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } @@ -21771,7 +21633,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeAbsMinHeatSetpointLimit(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_4, OnFailureCallback_4); } void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } @@ -21787,7 +21650,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeAbsMaxHeatSetpointLimit(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_5, OnFailureCallback_5); } void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } @@ -21803,7 +21667,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeAbsMaxHeatSetpointLimit(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_6, OnFailureCallback_6); } void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } @@ -21837,7 +21702,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeAbsMaxHeatSetpointLimit(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_8, OnFailureCallback_8); } void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } @@ -21853,7 +21719,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeAbsMinCoolSetpointLimit(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_9, OnFailureCallback_9); } void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } @@ -21869,7 +21736,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeAbsMinCoolSetpointLimit(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_10, OnFailureCallback_10); } void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } @@ -21903,7 +21771,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeAbsMinCoolSetpointLimit(mOnSuccessCallback_12.Cancel(), mOnFailureCallback_12.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_12, OnFailureCallback_12); } void OnFailureResponse_12(uint8_t status) { ThrowFailureResponse(); } @@ -21919,7 +21788,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeAbsMaxCoolSetpointLimit(mOnSuccessCallback_13.Cancel(), mOnFailureCallback_13.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_13, OnFailureCallback_13); } void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } @@ -21935,7 +21805,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeAbsMaxCoolSetpointLimit(mOnSuccessCallback_14.Cancel(), mOnFailureCallback_14.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_14, OnFailureCallback_14); } void OnFailureResponse_14(uint8_t status) { ThrowFailureResponse(); } @@ -21969,7 +21840,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeAbsMaxCoolSetpointLimit(mOnSuccessCallback_16.Cancel(), mOnFailureCallback_16.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_16, OnFailureCallback_16); } void OnFailureResponse_16(uint8_t status) { ThrowFailureResponse(); } @@ -21985,7 +21857,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOccupiedCoolingSetpoint(mOnSuccessCallback_17.Cancel(), mOnFailureCallback_17.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_17, OnFailureCallback_17); } void OnFailureResponse_17(uint8_t status) { ThrowFailureResponse(); } @@ -22001,7 +21874,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOccupiedCoolingSetpoint(mOnSuccessCallback_18.Cancel(), mOnFailureCallback_18.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_18, OnFailureCallback_18); } void OnFailureResponse_18(uint8_t status) { ThrowFailureResponse(); } @@ -22035,7 +21909,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOccupiedCoolingSetpoint(mOnSuccessCallback_20.Cancel(), mOnFailureCallback_20.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_20, OnFailureCallback_20); } void OnFailureResponse_20(uint8_t status) { ThrowFailureResponse(); } @@ -22051,7 +21926,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOccupiedHeatingSetpoint(mOnSuccessCallback_21.Cancel(), mOnFailureCallback_21.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_21, OnFailureCallback_21); } void OnFailureResponse_21(uint8_t status) { ThrowFailureResponse(); } @@ -22067,7 +21943,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOccupiedHeatingSetpoint(mOnSuccessCallback_22.Cancel(), mOnFailureCallback_22.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_22, OnFailureCallback_22); } void OnFailureResponse_22(uint8_t status) { ThrowFailureResponse(); } @@ -22101,7 +21978,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOccupiedHeatingSetpoint(mOnSuccessCallback_24.Cancel(), mOnFailureCallback_24.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_24, OnFailureCallback_24); } void OnFailureResponse_24(uint8_t status) { ThrowFailureResponse(); } @@ -22117,7 +21995,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeMinHeatSetpointLimit(mOnSuccessCallback_25.Cancel(), mOnFailureCallback_25.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_25, OnFailureCallback_25); } void OnFailureResponse_25(uint8_t status) { ThrowFailureResponse(); } @@ -22133,7 +22012,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeMinHeatSetpointLimit(mOnSuccessCallback_26.Cancel(), mOnFailureCallback_26.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_26, OnFailureCallback_26); } void OnFailureResponse_26(uint8_t status) { ThrowFailureResponse(); } @@ -22167,7 +22047,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeMinHeatSetpointLimit(mOnSuccessCallback_28.Cancel(), mOnFailureCallback_28.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_28, OnFailureCallback_28); } void OnFailureResponse_28(uint8_t status) { ThrowFailureResponse(); } @@ -22183,7 +22064,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeMaxHeatSetpointLimit(mOnSuccessCallback_29.Cancel(), mOnFailureCallback_29.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_29, OnFailureCallback_29); } void OnFailureResponse_29(uint8_t status) { ThrowFailureResponse(); } @@ -22199,7 +22081,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeMaxHeatSetpointLimit(mOnSuccessCallback_30.Cancel(), mOnFailureCallback_30.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_30, OnFailureCallback_30); } void OnFailureResponse_30(uint8_t status) { ThrowFailureResponse(); } @@ -22233,7 +22116,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeMaxHeatSetpointLimit(mOnSuccessCallback_32.Cancel(), mOnFailureCallback_32.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_32, OnFailureCallback_32); } void OnFailureResponse_32(uint8_t status) { ThrowFailureResponse(); } @@ -22249,7 +22133,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeMinCoolSetpointLimit(mOnSuccessCallback_33.Cancel(), mOnFailureCallback_33.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_33, OnFailureCallback_33); } void OnFailureResponse_33(uint8_t status) { ThrowFailureResponse(); } @@ -22265,7 +22150,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeMinCoolSetpointLimit(mOnSuccessCallback_34.Cancel(), mOnFailureCallback_34.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_34, OnFailureCallback_34); } void OnFailureResponse_34(uint8_t status) { ThrowFailureResponse(); } @@ -22299,7 +22185,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeMinCoolSetpointLimit(mOnSuccessCallback_36.Cancel(), mOnFailureCallback_36.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_36, OnFailureCallback_36); } void OnFailureResponse_36(uint8_t status) { ThrowFailureResponse(); } @@ -22315,7 +22202,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeMaxCoolSetpointLimit(mOnSuccessCallback_37.Cancel(), mOnFailureCallback_37.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_37, OnFailureCallback_37); } void OnFailureResponse_37(uint8_t status) { ThrowFailureResponse(); } @@ -22331,7 +22219,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeMaxCoolSetpointLimit(mOnSuccessCallback_38.Cancel(), mOnFailureCallback_38.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_38, OnFailureCallback_38); } void OnFailureResponse_38(uint8_t status) { ThrowFailureResponse(); } @@ -22365,7 +22254,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeMaxCoolSetpointLimit(mOnSuccessCallback_40.Cancel(), mOnFailureCallback_40.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_40, OnFailureCallback_40); } void OnFailureResponse_40(uint8_t status) { ThrowFailureResponse(); } @@ -22381,7 +22271,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeControlSequenceOfOperation(mOnSuccessCallback_41.Cancel(), mOnFailureCallback_41.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_41, OnFailureCallback_41); } void OnFailureResponse_41(uint8_t status) { ThrowFailureResponse(); } @@ -22397,7 +22288,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeControlSequenceOfOperation(mOnSuccessCallback_42.Cancel(), mOnFailureCallback_42.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_42, OnFailureCallback_42); } void OnFailureResponse_42(uint8_t status) { ThrowFailureResponse(); } @@ -22430,7 +22322,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeControlSequenceOfOperation(mOnSuccessCallback_44.Cancel(), mOnFailureCallback_44.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_44, OnFailureCallback_44); } void OnFailureResponse_44(uint8_t status) { ThrowFailureResponse(); } @@ -22446,7 +22339,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeSystemMode(mOnSuccessCallback_45.Cancel(), mOnFailureCallback_45.Cancel()); + return cluster.ReadAttribute(this, OnSuccessCallback_45, + OnFailureCallback_45); } void OnFailureResponse_45(uint8_t status) { ThrowFailureResponse(); } @@ -22462,7 +22356,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeSystemMode(mOnSuccessCallback_46.Cancel(), mOnFailureCallback_46.Cancel()); + return cluster.ReadAttribute(this, OnSuccessCallback_46, + OnFailureCallback_46); } void OnFailureResponse_46(uint8_t status) { ThrowFailureResponse(); } @@ -22495,7 +22390,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeSystemMode(mOnSuccessCallback_48.Cancel(), mOnFailureCallback_48.Cancel()); + return cluster.ReadAttribute(this, OnSuccessCallback_48, + OnFailureCallback_48); } void OnFailureResponse_48(uint8_t status) { ThrowFailureResponse(); } @@ -22511,7 +22407,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeMinSetpointDeadBand(mOnSuccessCallback_49.Cancel(), mOnFailureCallback_49.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_49, OnFailureCallback_49); } void OnFailureResponse_49(uint8_t status) { ThrowFailureResponse(); } @@ -22527,7 +22424,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeMinSetpointDeadBand(mOnSuccessCallback_50.Cancel(), mOnFailureCallback_50.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_50, OnFailureCallback_50); } void OnFailureResponse_50(uint8_t status) { ThrowFailureResponse(); } @@ -22560,7 +22458,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeMinSetpointDeadBand(mOnSuccessCallback_52.Cancel(), mOnFailureCallback_52.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_52, OnFailureCallback_52); } void OnFailureResponse_52(uint8_t status) { ThrowFailureResponse(); } @@ -22576,7 +22475,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeStartOfWeek(mOnSuccessCallback_53.Cancel(), mOnFailureCallback_53.Cancel()); + return cluster.ReadAttribute(this, OnSuccessCallback_53, + OnFailureCallback_53); } void OnFailureResponse_53(uint8_t status) { ThrowFailureResponse(); } @@ -22609,7 +22509,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeStartOfWeek(mOnSuccessCallback_55.Cancel(), mOnFailureCallback_55.Cancel()); + return cluster.ReadAttribute(this, OnSuccessCallback_55, + OnFailureCallback_55); } void OnFailureResponse_55(uint8_t status) { ThrowFailureResponse(); } @@ -22625,7 +22526,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeNumberOfWeeklyTransitions(mOnSuccessCallback_56.Cancel(), mOnFailureCallback_56.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_56, OnFailureCallback_56); } void OnFailureResponse_56(uint8_t status) { ThrowFailureResponse(); } @@ -22657,7 +22559,8 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeNumberOfDailyTransitions(mOnSuccessCallback_58.Cancel(), mOnFailureCallback_58.Cancel()); + return cluster.ReadAttribute( + this, OnSuccessCallback_58, OnFailureCallback_58); } void OnFailureResponse_58(uint8_t status) { ThrowFailureResponse(); } @@ -30632,462 +30535,3445 @@ class TestClusterComplexTypes : public TestCommand ChipLogProgress(chipTool, " ***** Test Step 10 : Send Test Command with optional arg set to null.\n"); err = TestSendTestCommandWithOptionalArgSetToNull_10(); break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 11; - - // - // Tests methods - // - - CHIP_ERROR TestSendTestCommandWithStructArgumentAndArg1bIsTrue_0() - { - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevice, 1); - - using requestType = chip::app::Clusters::TestCluster::Commands::TestStructArgumentRequest::Type; - using responseType = chip::app::Clusters::TestCluster::Commands::BooleanResponse::DecodableType; - - chip::app::Clusters::TestCluster::Commands::TestStructArgumentRequest::Type request; - - request.arg1.a = 0; - request.arg1.b = true; - request.arg1.c = static_cast(2); - request.arg1.d = chip::ByteSpan(chip::Uint8::from_const_char("octet_string"), strlen("octet_string")); - request.arg1.e = chip::Span("char_string", strlen("char_string")); - request.arg1.f = static_cast>(1); - - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_0(data.value); - }; - - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_0(status); - }; - return cluster.InvokeCommand(request, this, success, failure); - } - - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_0(bool value) - { - VerifyOrReturn(CheckValue("value", value, true)); - NextTest(); - } - - CHIP_ERROR TestSendTestCommandWithStructArgumentAndArg1bIsFalse_1() - { - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevice, 1); - - using requestType = chip::app::Clusters::TestCluster::Commands::TestStructArgumentRequest::Type; - using responseType = chip::app::Clusters::TestCluster::Commands::BooleanResponse::DecodableType; - - chip::app::Clusters::TestCluster::Commands::TestStructArgumentRequest::Type request; - - request.arg1.a = 0; - request.arg1.b = false; - request.arg1.c = static_cast(2); - request.arg1.d = chip::ByteSpan(chip::Uint8::from_const_char("octet_string"), strlen("octet_string")); - request.arg1.e = chip::Span("char_string", strlen("char_string")); - request.arg1.f = static_cast>(1); - - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_1(data.value); - }; - - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_1(status); - }; - return cluster.InvokeCommand(request, this, success, failure); - } - - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_1(bool value) - { - VerifyOrReturn(CheckValue("value", value, false)); - NextTest(); - } - - CHIP_ERROR TestSendTestCommandWithListOfInt8uAndNoneOfThemIsSetTo0_2() - { - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevice, 1); - - using requestType = chip::app::Clusters::TestCluster::Commands::TestListInt8UArgumentRequest::Type; - using responseType = chip::app::Clusters::TestCluster::Commands::BooleanResponse::DecodableType; - - chip::app::Clusters::TestCluster::Commands::TestListInt8UArgumentRequest::Type request; - - uint8_t arg1List[9]; - arg1List[0] = 1; - arg1List[1] = 2; - arg1List[2] = 3; - arg1List[3] = 4; - arg1List[4] = 5; - arg1List[5] = 6; - arg1List[6] = 7; - arg1List[7] = 8; - arg1List[8] = 9; - request.arg1 = arg1List; - - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_2(data.value); - }; - - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_2(status); - }; - return cluster.InvokeCommand(request, this, success, failure); - } - - void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_2(bool value) - { - VerifyOrReturn(CheckValue("value", value, true)); - NextTest(); - } - - CHIP_ERROR TestSendTestCommandWithListOfInt8uAndOneOfThemIsSetTo0_3() - { - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevice, 1); - + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Write attribute NULLABLE_BOOLEAN null\n"); + err = TestWriteAttributeNullableBooleanNull_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Read attribute NULLABLE_BOOLEAN null\n"); + err = TestReadAttributeNullableBooleanNull_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Write attribute NULLABLE_BOOLEAN True\n"); + err = TestWriteAttributeNullableBooleanTrue_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Read attribute NULLABLE_BOOLEAN True\n"); + err = TestReadAttributeNullableBooleanTrue_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Write attribute NULLABLE_BITMAP8 Max Value\n"); + err = TestWriteAttributeNullableBitmap8MaxValue_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Read attribute NULLABLE_BITMAP8 Max Value\n"); + err = TestReadAttributeNullableBitmap8MaxValue_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : Write attribute NULLABLE_BITMAP8 Invalid Value\n"); + err = TestWriteAttributeNullableBitmap8InvalidValue_17(); + break; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : Read attribute NULLABLE_BITMAP8 unchanged Value\n"); + err = TestReadAttributeNullableBitmap8UnchangedValue_18(); + break; + case 19: + ChipLogProgress(chipTool, " ***** Test Step 19 : Write attribute NULLABLE_BITMAP8 null Value\n"); + err = TestWriteAttributeNullableBitmap8NullValue_19(); + break; + case 20: + ChipLogProgress(chipTool, " ***** Test Step 20 : Read attribute NULLABLE_BITMAP8 null Value\n"); + err = TestReadAttributeNullableBitmap8NullValue_20(); + break; + case 21: + ChipLogProgress(chipTool, " ***** Test Step 21 : Write attribute NULLABLE_BITMAP16 Max Value\n"); + err = TestWriteAttributeNullableBitmap16MaxValue_21(); + break; + case 22: + ChipLogProgress(chipTool, " ***** Test Step 22 : Read attribute NULLABLE_BITMAP16 Max Value\n"); + err = TestReadAttributeNullableBitmap16MaxValue_22(); + break; + case 23: + ChipLogProgress(chipTool, " ***** Test Step 23 : Write attribute NULLABLE_BITMAP16 Invalid Value\n"); + err = TestWriteAttributeNullableBitmap16InvalidValue_23(); + break; + case 24: + ChipLogProgress(chipTool, " ***** Test Step 24 : Read attribute NULLABLE_BITMAP16 unchanged Value\n"); + err = TestReadAttributeNullableBitmap16UnchangedValue_24(); + break; + case 25: + ChipLogProgress(chipTool, " ***** Test Step 25 : Write attribute NULLABLE_BITMAP16 null Value\n"); + err = TestWriteAttributeNullableBitmap16NullValue_25(); + break; + case 26: + ChipLogProgress(chipTool, " ***** Test Step 26 : Read attribute NULLABLE_BITMAP16 null Value\n"); + err = TestReadAttributeNullableBitmap16NullValue_26(); + break; + case 27: + ChipLogProgress(chipTool, " ***** Test Step 27 : Write attribute NULLABLE_BITMAP32 Max Value\n"); + err = TestWriteAttributeNullableBitmap32MaxValue_27(); + break; + case 28: + ChipLogProgress(chipTool, " ***** Test Step 28 : Read attribute NULLABLE_BITMAP32 Max Value\n"); + err = TestReadAttributeNullableBitmap32MaxValue_28(); + break; + case 29: + ChipLogProgress(chipTool, " ***** Test Step 29 : Write attribute NULLABLE_BITMAP32 Invalid Value\n"); + err = TestWriteAttributeNullableBitmap32InvalidValue_29(); + break; + case 30: + ChipLogProgress(chipTool, " ***** Test Step 30 : Read attribute NULLABLE_BITMAP32 unchanged Value\n"); + err = TestReadAttributeNullableBitmap32UnchangedValue_30(); + break; + case 31: + ChipLogProgress(chipTool, " ***** Test Step 31 : Write attribute NULLABLE_BITMAP32 null Value\n"); + err = TestWriteAttributeNullableBitmap32NullValue_31(); + break; + case 32: + ChipLogProgress(chipTool, " ***** Test Step 32 : Read attribute NULLABLE_BITMAP32 null Value\n"); + err = TestReadAttributeNullableBitmap32NullValue_32(); + break; + case 33: + ChipLogProgress(chipTool, " ***** Test Step 33 : Write attribute NULLABLE_BITMAP64 Max Value\n"); + err = TestWriteAttributeNullableBitmap64MaxValue_33(); + break; + case 34: + ChipLogProgress(chipTool, " ***** Test Step 34 : Read attribute NULLABLE_BITMAP64 Max Value\n"); + err = TestReadAttributeNullableBitmap64MaxValue_34(); + break; + case 35: + ChipLogProgress(chipTool, " ***** Test Step 35 : Write attribute NULLABLE_BITMAP64 Invalid Value\n"); + err = TestWriteAttributeNullableBitmap64InvalidValue_35(); + break; + case 36: + ChipLogProgress(chipTool, " ***** Test Step 36 : Read attribute NULLABLE_BITMAP64 unchanged Value\n"); + err = TestReadAttributeNullableBitmap64UnchangedValue_36(); + break; + case 37: + ChipLogProgress(chipTool, " ***** Test Step 37 : Write attribute NULLABLE_BITMAP64 null Value\n"); + err = TestWriteAttributeNullableBitmap64NullValue_37(); + break; + case 38: + ChipLogProgress(chipTool, " ***** Test Step 38 : Read attribute NULLABLE_BITMAP64 null Value\n"); + err = TestReadAttributeNullableBitmap64NullValue_38(); + break; + case 39: + ChipLogProgress(chipTool, " ***** Test Step 39 : Write attribute NULLABLE_INT8U Max Value\n"); + err = TestWriteAttributeNullableInt8uMaxValue_39(); + break; + case 40: + ChipLogProgress(chipTool, " ***** Test Step 40 : Read attribute NULLABLE_INT8U Max Value\n"); + err = TestReadAttributeNullableInt8uMaxValue_40(); + break; + case 41: + ChipLogProgress(chipTool, " ***** Test Step 41 : Write attribute NULLABLE_INT8U Invalid Value\n"); + err = TestWriteAttributeNullableInt8uInvalidValue_41(); + break; + case 42: + ChipLogProgress(chipTool, " ***** Test Step 42 : Read attribute NULLABLE_INT8U unchanged Value\n"); + err = TestReadAttributeNullableInt8uUnchangedValue_42(); + break; + case 43: + ChipLogProgress(chipTool, " ***** Test Step 43 : Write attribute NULLABLE_INT8U null Value\n"); + err = TestWriteAttributeNullableInt8uNullValue_43(); + break; + case 44: + ChipLogProgress(chipTool, " ***** Test Step 44 : Read attribute NULLABLE_INT8U null Value\n"); + err = TestReadAttributeNullableInt8uNullValue_44(); + break; + case 45: + ChipLogProgress(chipTool, " ***** Test Step 45 : Write attribute NULLABLE_INT16U Max Value\n"); + err = TestWriteAttributeNullableInt16uMaxValue_45(); + break; + case 46: + ChipLogProgress(chipTool, " ***** Test Step 46 : Read attribute NULLABLE_INT16U Max Value\n"); + err = TestReadAttributeNullableInt16uMaxValue_46(); + break; + case 47: + ChipLogProgress(chipTool, " ***** Test Step 47 : Write attribute NULLABLE_INT16U Invalid Value\n"); + err = TestWriteAttributeNullableInt16uInvalidValue_47(); + break; + case 48: + ChipLogProgress(chipTool, " ***** Test Step 48 : Read attribute NULLABLE_INT16U unchanged Value\n"); + err = TestReadAttributeNullableInt16uUnchangedValue_48(); + break; + case 49: + ChipLogProgress(chipTool, " ***** Test Step 49 : Write attribute NULLABLE_INT16U null Value\n"); + err = TestWriteAttributeNullableInt16uNullValue_49(); + break; + case 50: + ChipLogProgress(chipTool, " ***** Test Step 50 : Read attribute NULLABLE_INT16U null Value\n"); + err = TestReadAttributeNullableInt16uNullValue_50(); + break; + case 51: + ChipLogProgress(chipTool, " ***** Test Step 51 : Write attribute NULLABLE_INT32U Max Value\n"); + err = TestWriteAttributeNullableInt32uMaxValue_51(); + break; + case 52: + ChipLogProgress(chipTool, " ***** Test Step 52 : Read attribute NULLABLE_INT32U Max Value\n"); + err = TestReadAttributeNullableInt32uMaxValue_52(); + break; + case 53: + ChipLogProgress(chipTool, " ***** Test Step 53 : Write attribute NULLABLE_INT32U Invalid Value\n"); + err = TestWriteAttributeNullableInt32uInvalidValue_53(); + break; + case 54: + ChipLogProgress(chipTool, " ***** Test Step 54 : Read attribute NULLABLE_INT32U unchanged Value\n"); + err = TestReadAttributeNullableInt32uUnchangedValue_54(); + break; + case 55: + ChipLogProgress(chipTool, " ***** Test Step 55 : Write attribute NULLABLE_INT32U null Value\n"); + err = TestWriteAttributeNullableInt32uNullValue_55(); + break; + case 56: + ChipLogProgress(chipTool, " ***** Test Step 56 : Read attribute NULLABLE_INT32U null Value\n"); + err = TestReadAttributeNullableInt32uNullValue_56(); + break; + case 57: + ChipLogProgress(chipTool, " ***** Test Step 57 : Write attribute NULLABLE_INT64U Max Value\n"); + err = TestWriteAttributeNullableInt64uMaxValue_57(); + break; + case 58: + ChipLogProgress(chipTool, " ***** Test Step 58 : Read attribute NULLABLE_INT64U Max Value\n"); + err = TestReadAttributeNullableInt64uMaxValue_58(); + break; + case 59: + ChipLogProgress(chipTool, " ***** Test Step 59 : Write attribute NULLABLE_INT64U Invalid Value\n"); + err = TestWriteAttributeNullableInt64uInvalidValue_59(); + break; + case 60: + ChipLogProgress(chipTool, " ***** Test Step 60 : Read attribute NULLABLE_INT64U unchanged Value\n"); + err = TestReadAttributeNullableInt64uUnchangedValue_60(); + break; + case 61: + ChipLogProgress(chipTool, " ***** Test Step 61 : Write attribute NULLABLE_INT64U null Value\n"); + err = TestWriteAttributeNullableInt64uNullValue_61(); + break; + case 62: + ChipLogProgress(chipTool, " ***** Test Step 62 : Read attribute NULLABLE_INT64U null Value\n"); + err = TestReadAttributeNullableInt64uNullValue_62(); + break; + case 63: + ChipLogProgress(chipTool, " ***** Test Step 63 : Write attribute NULLABLE_INT8S Min Value\n"); + err = TestWriteAttributeNullableInt8sMinValue_63(); + break; + case 64: + ChipLogProgress(chipTool, " ***** Test Step 64 : Read attribute NULLABLE_INT8S Min Value\n"); + err = TestReadAttributeNullableInt8sMinValue_64(); + break; + case 65: + ChipLogProgress(chipTool, " ***** Test Step 65 : Write attribute NULLABLE_INT8S Invalid Value\n"); + err = TestWriteAttributeNullableInt8sInvalidValue_65(); + break; + case 66: + ChipLogProgress(chipTool, " ***** Test Step 66 : Read attribute NULLABLE_INT8S unchanged Value\n"); + err = TestReadAttributeNullableInt8sUnchangedValue_66(); + break; + case 67: + ChipLogProgress(chipTool, " ***** Test Step 67 : Write attribute NULLABLE_INT8S null Value\n"); + err = TestWriteAttributeNullableInt8sNullValue_67(); + break; + case 68: + ChipLogProgress(chipTool, " ***** Test Step 68 : Read attribute NULLABLE_INT8S null Value\n"); + err = TestReadAttributeNullableInt8sNullValue_68(); + break; + case 69: + ChipLogProgress(chipTool, " ***** Test Step 69 : Write attribute NULLABLE_INT16S Min Value\n"); + err = TestWriteAttributeNullableInt16sMinValue_69(); + break; + case 70: + ChipLogProgress(chipTool, " ***** Test Step 70 : Read attribute NULLABLE_INT16S Min Value\n"); + err = TestReadAttributeNullableInt16sMinValue_70(); + break; + case 71: + ChipLogProgress(chipTool, " ***** Test Step 71 : Write attribute NULLABLE_INT16S Invalid Value\n"); + err = TestWriteAttributeNullableInt16sInvalidValue_71(); + break; + case 72: + ChipLogProgress(chipTool, " ***** Test Step 72 : Read attribute NULLABLE_INT16S unchanged Value\n"); + err = TestReadAttributeNullableInt16sUnchangedValue_72(); + break; + case 73: + ChipLogProgress(chipTool, " ***** Test Step 73 : Write attribute NULLABLE_INT16S null Value\n"); + err = TestWriteAttributeNullableInt16sNullValue_73(); + break; + case 74: + ChipLogProgress(chipTool, " ***** Test Step 74 : Read attribute NULLABLE_INT16S null Value\n"); + err = TestReadAttributeNullableInt16sNullValue_74(); + break; + case 75: + ChipLogProgress(chipTool, " ***** Test Step 75 : Write attribute NULLABLE_INT32S Min Value\n"); + err = TestWriteAttributeNullableInt32sMinValue_75(); + break; + case 76: + ChipLogProgress(chipTool, " ***** Test Step 76 : Read attribute NULLABLE_INT32S Min Value\n"); + err = TestReadAttributeNullableInt32sMinValue_76(); + break; + case 77: + ChipLogProgress(chipTool, " ***** Test Step 77 : Write attribute NULLABLE_INT32S Invalid Value\n"); + err = TestWriteAttributeNullableInt32sInvalidValue_77(); + break; + case 78: + ChipLogProgress(chipTool, " ***** Test Step 78 : Read attribute NULLABLE_INT32S unchanged Value\n"); + err = TestReadAttributeNullableInt32sUnchangedValue_78(); + break; + case 79: + ChipLogProgress(chipTool, " ***** Test Step 79 : Write attribute NULLABLE_INT32S null Value\n"); + err = TestWriteAttributeNullableInt32sNullValue_79(); + break; + case 80: + ChipLogProgress(chipTool, " ***** Test Step 80 : Read attribute NULLABLE_INT32S null Value\n"); + err = TestReadAttributeNullableInt32sNullValue_80(); + break; + case 81: + ChipLogProgress(chipTool, " ***** Test Step 81 : Write attribute NULLABLE_INT64S Min Value\n"); + err = TestWriteAttributeNullableInt64sMinValue_81(); + break; + case 82: + ChipLogProgress(chipTool, " ***** Test Step 82 : Read attribute NULLABLE_INT64S Min Value\n"); + err = TestReadAttributeNullableInt64sMinValue_82(); + break; + case 83: + ChipLogProgress(chipTool, " ***** Test Step 83 : Write attribute NULLABLE_INT64S Invalid Value\n"); + err = TestWriteAttributeNullableInt64sInvalidValue_83(); + break; + case 84: + ChipLogProgress(chipTool, " ***** Test Step 84 : Read attribute NULLABLE_INT64S unchanged Value\n"); + err = TestReadAttributeNullableInt64sUnchangedValue_84(); + break; + case 85: + ChipLogProgress(chipTool, " ***** Test Step 85 : Write attribute NULLABLE_INT64S null Value\n"); + err = TestWriteAttributeNullableInt64sNullValue_85(); + break; + case 86: + ChipLogProgress(chipTool, " ***** Test Step 86 : Read attribute NULLABLE_INT64S null Value\n"); + err = TestReadAttributeNullableInt64sNullValue_86(); + break; + case 87: + ChipLogProgress(chipTool, " ***** Test Step 87 : Write attribute NULLABLE_ENUM8 Max Value\n"); + err = TestWriteAttributeNullableEnum8MaxValue_87(); + break; + case 88: + ChipLogProgress(chipTool, " ***** Test Step 88 : Read attribute NULLABLE_ENUM8 Max Value\n"); + err = TestReadAttributeNullableEnum8MaxValue_88(); + break; + case 89: + ChipLogProgress(chipTool, " ***** Test Step 89 : Write attribute NULLABLE_ENUM8 Invalid Value\n"); + err = TestWriteAttributeNullableEnum8InvalidValue_89(); + break; + case 90: + ChipLogProgress(chipTool, " ***** Test Step 90 : Read attribute NULLABLE_ENUM8 unchanged Value\n"); + err = TestReadAttributeNullableEnum8UnchangedValue_90(); + break; + case 91: + ChipLogProgress(chipTool, " ***** Test Step 91 : Write attribute NULLABLE_ENUM8 null Value\n"); + err = TestWriteAttributeNullableEnum8NullValue_91(); + break; + case 92: + ChipLogProgress(chipTool, " ***** Test Step 92 : Read attribute NULLABLE_ENUM8 null Value\n"); + err = TestReadAttributeNullableEnum8NullValue_92(); + break; + case 93: + ChipLogProgress(chipTool, " ***** Test Step 93 : Write attribute NULLABLE_ENUM16 Max Value\n"); + err = TestWriteAttributeNullableEnum16MaxValue_93(); + break; + case 94: + ChipLogProgress(chipTool, " ***** Test Step 94 : Read attribute NULLABLE_ENUM16 Max Value\n"); + err = TestReadAttributeNullableEnum16MaxValue_94(); + break; + case 95: + ChipLogProgress(chipTool, " ***** Test Step 95 : Write attribute NULLABLE_ENUM16 Invalid Value\n"); + err = TestWriteAttributeNullableEnum16InvalidValue_95(); + break; + case 96: + ChipLogProgress(chipTool, " ***** Test Step 96 : Read attribute NULLABLE_ENUM16 unchanged Value\n"); + err = TestReadAttributeNullableEnum16UnchangedValue_96(); + break; + case 97: + ChipLogProgress(chipTool, " ***** Test Step 97 : Write attribute NULLABLE_ENUM16 null Value\n"); + err = TestWriteAttributeNullableEnum16NullValue_97(); + break; + case 98: + ChipLogProgress(chipTool, " ***** Test Step 98 : Read attribute NULLABLE_ENUM16 null Value\n"); + err = TestReadAttributeNullableEnum16NullValue_98(); + break; + case 99: + ChipLogProgress(chipTool, " ***** Test Step 99 : Read attribute NULLABLE_OCTET_STRING Default Value\n"); + err = TestReadAttributeNullableOctetStringDefaultValue_99(); + break; + case 100: + ChipLogProgress(chipTool, " ***** Test Step 100 : Write attribute NULLABLE_OCTET_STRING\n"); + err = TestWriteAttributeNullableOctetString_100(); + break; + case 101: + ChipLogProgress(chipTool, " ***** Test Step 101 : Read attribute NULLABLE_OCTET_STRING\n"); + err = TestReadAttributeNullableOctetString_101(); + break; + case 102: + ChipLogProgress(chipTool, " ***** Test Step 102 : Write attribute NULLABLE_OCTET_STRING\n"); + err = TestWriteAttributeNullableOctetString_102(); + break; + case 103: + ChipLogProgress(chipTool, " ***** Test Step 103 : Read attribute NULLABLE_OCTET_STRING\n"); + err = TestReadAttributeNullableOctetString_103(); + break; + case 104: + ChipLogProgress(chipTool, " ***** Test Step 104 : Write attribute NULLABLE_OCTET_STRING\n"); + err = TestWriteAttributeNullableOctetString_104(); + break; + case 105: + ChipLogProgress(chipTool, " ***** Test Step 105 : Read attribute NULLABLE_OCTET_STRING\n"); + err = TestReadAttributeNullableOctetString_105(); + break; + case 106: + ChipLogProgress(chipTool, " ***** Test Step 106 : Read attribute NULLABLE_CHAR_STRING Default Value\n"); + err = TestReadAttributeNullableCharStringDefaultValue_106(); + break; + case 107: + ChipLogProgress(chipTool, " ***** Test Step 107 : Write attribute NULLABLE_CHAR_STRING\n"); + err = TestWriteAttributeNullableCharString_107(); + break; + case 108: + ChipLogProgress(chipTool, " ***** Test Step 108 : Write attribute NULLABLE_CHAR_STRING - Value too long\n"); + err = TestWriteAttributeNullableCharStringValueTooLong_108(); + break; + case 109: + ChipLogProgress(chipTool, " ***** Test Step 109 : Read attribute NULLABLE_CHAR_STRING\n"); + err = TestReadAttributeNullableCharString_109(); + break; + case 110: + ChipLogProgress(chipTool, " ***** Test Step 110 : Write attribute NULLABLE_CHAR_STRING - Empty\n"); + err = TestWriteAttributeNullableCharStringEmpty_110(); + break; + case 111: + ChipLogProgress(chipTool, " ***** Test Step 111 : Read attribute NULLABLE_CHAR_STRING\n"); + err = TestReadAttributeNullableCharString_111(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 112; + + static void OnFailureCallback_11(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_11(chip::to_underlying(status)); + } + + static void OnSuccessCallback_11(void * context) { (static_cast(context))->OnSuccessResponse_11(); } + + static void OnFailureCallback_12(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_12(chip::to_underlying(status)); + } + + static void OnSuccessCallback_12(void * context, const chip::app::DataModel::Nullable & nullableBoolean) + { + (static_cast(context))->OnSuccessResponse_12(nullableBoolean); + } + + static void OnFailureCallback_13(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_13(chip::to_underlying(status)); + } + + static void OnSuccessCallback_13(void * context) { (static_cast(context))->OnSuccessResponse_13(); } + + static void OnFailureCallback_14(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_14(chip::to_underlying(status)); + } + + static void OnSuccessCallback_14(void * context, const chip::app::DataModel::Nullable & nullableBoolean) + { + (static_cast(context))->OnSuccessResponse_14(nullableBoolean); + } + + static void OnFailureCallback_15(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_15(chip::to_underlying(status)); + } + + static void OnSuccessCallback_15(void * context) { (static_cast(context))->OnSuccessResponse_15(); } + + static void OnFailureCallback_16(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_16(chip::to_underlying(status)); + } + + static void OnSuccessCallback_16(void * context, const chip::app::DataModel::Nullable & nullableBitmap8) + { + (static_cast(context))->OnSuccessResponse_16(nullableBitmap8); + } + + static void OnFailureCallback_17(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_17(chip::to_underlying(status)); + } + + static void OnSuccessCallback_17(void * context) { (static_cast(context))->OnSuccessResponse_17(); } + + static void OnFailureCallback_18(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_18(chip::to_underlying(status)); + } + + static void OnSuccessCallback_18(void * context, const chip::app::DataModel::Nullable & nullableBitmap8) + { + (static_cast(context))->OnSuccessResponse_18(nullableBitmap8); + } + + static void OnFailureCallback_19(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_19(chip::to_underlying(status)); + } + + static void OnSuccessCallback_19(void * context) { (static_cast(context))->OnSuccessResponse_19(); } + + static void OnFailureCallback_20(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_20(chip::to_underlying(status)); + } + + static void OnSuccessCallback_20(void * context, const chip::app::DataModel::Nullable & nullableBitmap8) + { + (static_cast(context))->OnSuccessResponse_20(nullableBitmap8); + } + + static void OnFailureCallback_21(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_21(chip::to_underlying(status)); + } + + static void OnSuccessCallback_21(void * context) { (static_cast(context))->OnSuccessResponse_21(); } + + static void OnFailureCallback_22(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_22(chip::to_underlying(status)); + } + + static void OnSuccessCallback_22(void * context, const chip::app::DataModel::Nullable & nullableBitmap16) + { + (static_cast(context))->OnSuccessResponse_22(nullableBitmap16); + } + + static void OnFailureCallback_23(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_23(chip::to_underlying(status)); + } + + static void OnSuccessCallback_23(void * context) { (static_cast(context))->OnSuccessResponse_23(); } + + static void OnFailureCallback_24(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_24(chip::to_underlying(status)); + } + + static void OnSuccessCallback_24(void * context, const chip::app::DataModel::Nullable & nullableBitmap16) + { + (static_cast(context))->OnSuccessResponse_24(nullableBitmap16); + } + + static void OnFailureCallback_25(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_25(chip::to_underlying(status)); + } + + static void OnSuccessCallback_25(void * context) { (static_cast(context))->OnSuccessResponse_25(); } + + static void OnFailureCallback_26(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_26(chip::to_underlying(status)); + } + + static void OnSuccessCallback_26(void * context, const chip::app::DataModel::Nullable & nullableBitmap16) + { + (static_cast(context))->OnSuccessResponse_26(nullableBitmap16); + } + + static void OnFailureCallback_27(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_27(chip::to_underlying(status)); + } + + static void OnSuccessCallback_27(void * context) { (static_cast(context))->OnSuccessResponse_27(); } + + static void OnFailureCallback_28(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_28(chip::to_underlying(status)); + } + + static void OnSuccessCallback_28(void * context, const chip::app::DataModel::Nullable & nullableBitmap32) + { + (static_cast(context))->OnSuccessResponse_28(nullableBitmap32); + } + + static void OnFailureCallback_29(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_29(chip::to_underlying(status)); + } + + static void OnSuccessCallback_29(void * context) { (static_cast(context))->OnSuccessResponse_29(); } + + static void OnFailureCallback_30(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_30(chip::to_underlying(status)); + } + + static void OnSuccessCallback_30(void * context, const chip::app::DataModel::Nullable & nullableBitmap32) + { + (static_cast(context))->OnSuccessResponse_30(nullableBitmap32); + } + + static void OnFailureCallback_31(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_31(chip::to_underlying(status)); + } + + static void OnSuccessCallback_31(void * context) { (static_cast(context))->OnSuccessResponse_31(); } + + static void OnFailureCallback_32(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_32(chip::to_underlying(status)); + } + + static void OnSuccessCallback_32(void * context, const chip::app::DataModel::Nullable & nullableBitmap32) + { + (static_cast(context))->OnSuccessResponse_32(nullableBitmap32); + } + + static void OnFailureCallback_33(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_33(chip::to_underlying(status)); + } + + static void OnSuccessCallback_33(void * context) { (static_cast(context))->OnSuccessResponse_33(); } + + static void OnFailureCallback_34(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_34(chip::to_underlying(status)); + } + + static void OnSuccessCallback_34(void * context, const chip::app::DataModel::Nullable & nullableBitmap64) + { + (static_cast(context))->OnSuccessResponse_34(nullableBitmap64); + } + + static void OnFailureCallback_35(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_35(chip::to_underlying(status)); + } + + static void OnSuccessCallback_35(void * context) { (static_cast(context))->OnSuccessResponse_35(); } + + static void OnFailureCallback_36(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_36(chip::to_underlying(status)); + } + + static void OnSuccessCallback_36(void * context, const chip::app::DataModel::Nullable & nullableBitmap64) + { + (static_cast(context))->OnSuccessResponse_36(nullableBitmap64); + } + + static void OnFailureCallback_37(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_37(chip::to_underlying(status)); + } + + static void OnSuccessCallback_37(void * context) { (static_cast(context))->OnSuccessResponse_37(); } + + static void OnFailureCallback_38(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_38(chip::to_underlying(status)); + } + + static void OnSuccessCallback_38(void * context, const chip::app::DataModel::Nullable & nullableBitmap64) + { + (static_cast(context))->OnSuccessResponse_38(nullableBitmap64); + } + + static void OnFailureCallback_39(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_39(chip::to_underlying(status)); + } + + static void OnSuccessCallback_39(void * context) { (static_cast(context))->OnSuccessResponse_39(); } + + static void OnFailureCallback_40(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_40(chip::to_underlying(status)); + } + + static void OnSuccessCallback_40(void * context, const chip::app::DataModel::Nullable & nullableInt8u) + { + (static_cast(context))->OnSuccessResponse_40(nullableInt8u); + } + + static void OnFailureCallback_41(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_41(chip::to_underlying(status)); + } + + static void OnSuccessCallback_41(void * context) { (static_cast(context))->OnSuccessResponse_41(); } + + static void OnFailureCallback_42(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_42(chip::to_underlying(status)); + } + + static void OnSuccessCallback_42(void * context, const chip::app::DataModel::Nullable & nullableInt8u) + { + (static_cast(context))->OnSuccessResponse_42(nullableInt8u); + } + + static void OnFailureCallback_43(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_43(chip::to_underlying(status)); + } + + static void OnSuccessCallback_43(void * context) { (static_cast(context))->OnSuccessResponse_43(); } + + static void OnFailureCallback_44(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_44(chip::to_underlying(status)); + } + + static void OnSuccessCallback_44(void * context, const chip::app::DataModel::Nullable & nullableInt8u) + { + (static_cast(context))->OnSuccessResponse_44(nullableInt8u); + } + + static void OnFailureCallback_45(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_45(chip::to_underlying(status)); + } + + static void OnSuccessCallback_45(void * context) { (static_cast(context))->OnSuccessResponse_45(); } + + static void OnFailureCallback_46(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_46(chip::to_underlying(status)); + } + + static void OnSuccessCallback_46(void * context, const chip::app::DataModel::Nullable & nullableInt16u) + { + (static_cast(context))->OnSuccessResponse_46(nullableInt16u); + } + + static void OnFailureCallback_47(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_47(chip::to_underlying(status)); + } + + static void OnSuccessCallback_47(void * context) { (static_cast(context))->OnSuccessResponse_47(); } + + static void OnFailureCallback_48(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_48(chip::to_underlying(status)); + } + + static void OnSuccessCallback_48(void * context, const chip::app::DataModel::Nullable & nullableInt16u) + { + (static_cast(context))->OnSuccessResponse_48(nullableInt16u); + } + + static void OnFailureCallback_49(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_49(chip::to_underlying(status)); + } + + static void OnSuccessCallback_49(void * context) { (static_cast(context))->OnSuccessResponse_49(); } + + static void OnFailureCallback_50(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_50(chip::to_underlying(status)); + } + + static void OnSuccessCallback_50(void * context, const chip::app::DataModel::Nullable & nullableInt16u) + { + (static_cast(context))->OnSuccessResponse_50(nullableInt16u); + } + + static void OnFailureCallback_51(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_51(chip::to_underlying(status)); + } + + static void OnSuccessCallback_51(void * context) { (static_cast(context))->OnSuccessResponse_51(); } + + static void OnFailureCallback_52(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_52(chip::to_underlying(status)); + } + + static void OnSuccessCallback_52(void * context, const chip::app::DataModel::Nullable & nullableInt32u) + { + (static_cast(context))->OnSuccessResponse_52(nullableInt32u); + } + + static void OnFailureCallback_53(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_53(chip::to_underlying(status)); + } + + static void OnSuccessCallback_53(void * context) { (static_cast(context))->OnSuccessResponse_53(); } + + static void OnFailureCallback_54(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_54(chip::to_underlying(status)); + } + + static void OnSuccessCallback_54(void * context, const chip::app::DataModel::Nullable & nullableInt32u) + { + (static_cast(context))->OnSuccessResponse_54(nullableInt32u); + } + + static void OnFailureCallback_55(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_55(chip::to_underlying(status)); + } + + static void OnSuccessCallback_55(void * context) { (static_cast(context))->OnSuccessResponse_55(); } + + static void OnFailureCallback_56(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_56(chip::to_underlying(status)); + } + + static void OnSuccessCallback_56(void * context, const chip::app::DataModel::Nullable & nullableInt32u) + { + (static_cast(context))->OnSuccessResponse_56(nullableInt32u); + } + + static void OnFailureCallback_57(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_57(chip::to_underlying(status)); + } + + static void OnSuccessCallback_57(void * context) { (static_cast(context))->OnSuccessResponse_57(); } + + static void OnFailureCallback_58(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_58(chip::to_underlying(status)); + } + + static void OnSuccessCallback_58(void * context, const chip::app::DataModel::Nullable & nullableInt64u) + { + (static_cast(context))->OnSuccessResponse_58(nullableInt64u); + } + + static void OnFailureCallback_59(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_59(chip::to_underlying(status)); + } + + static void OnSuccessCallback_59(void * context) { (static_cast(context))->OnSuccessResponse_59(); } + + static void OnFailureCallback_60(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_60(chip::to_underlying(status)); + } + + static void OnSuccessCallback_60(void * context, const chip::app::DataModel::Nullable & nullableInt64u) + { + (static_cast(context))->OnSuccessResponse_60(nullableInt64u); + } + + static void OnFailureCallback_61(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_61(chip::to_underlying(status)); + } + + static void OnSuccessCallback_61(void * context) { (static_cast(context))->OnSuccessResponse_61(); } + + static void OnFailureCallback_62(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_62(chip::to_underlying(status)); + } + + static void OnSuccessCallback_62(void * context, const chip::app::DataModel::Nullable & nullableInt64u) + { + (static_cast(context))->OnSuccessResponse_62(nullableInt64u); + } + + static void OnFailureCallback_63(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_63(chip::to_underlying(status)); + } + + static void OnSuccessCallback_63(void * context) { (static_cast(context))->OnSuccessResponse_63(); } + + static void OnFailureCallback_64(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_64(chip::to_underlying(status)); + } + + static void OnSuccessCallback_64(void * context, const chip::app::DataModel::Nullable & nullableInt8s) + { + (static_cast(context))->OnSuccessResponse_64(nullableInt8s); + } + + static void OnFailureCallback_65(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_65(chip::to_underlying(status)); + } + + static void OnSuccessCallback_65(void * context) { (static_cast(context))->OnSuccessResponse_65(); } + + static void OnFailureCallback_66(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_66(chip::to_underlying(status)); + } + + static void OnSuccessCallback_66(void * context, const chip::app::DataModel::Nullable & nullableInt8s) + { + (static_cast(context))->OnSuccessResponse_66(nullableInt8s); + } + + static void OnFailureCallback_67(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_67(chip::to_underlying(status)); + } + + static void OnSuccessCallback_67(void * context) { (static_cast(context))->OnSuccessResponse_67(); } + + static void OnFailureCallback_68(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_68(chip::to_underlying(status)); + } + + static void OnSuccessCallback_68(void * context, const chip::app::DataModel::Nullable & nullableInt8s) + { + (static_cast(context))->OnSuccessResponse_68(nullableInt8s); + } + + static void OnFailureCallback_69(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_69(chip::to_underlying(status)); + } + + static void OnSuccessCallback_69(void * context) { (static_cast(context))->OnSuccessResponse_69(); } + + static void OnFailureCallback_70(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_70(chip::to_underlying(status)); + } + + static void OnSuccessCallback_70(void * context, const chip::app::DataModel::Nullable & nullableInt16s) + { + (static_cast(context))->OnSuccessResponse_70(nullableInt16s); + } + + static void OnFailureCallback_71(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_71(chip::to_underlying(status)); + } + + static void OnSuccessCallback_71(void * context) { (static_cast(context))->OnSuccessResponse_71(); } + + static void OnFailureCallback_72(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_72(chip::to_underlying(status)); + } + + static void OnSuccessCallback_72(void * context, const chip::app::DataModel::Nullable & nullableInt16s) + { + (static_cast(context))->OnSuccessResponse_72(nullableInt16s); + } + + static void OnFailureCallback_73(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_73(chip::to_underlying(status)); + } + + static void OnSuccessCallback_73(void * context) { (static_cast(context))->OnSuccessResponse_73(); } + + static void OnFailureCallback_74(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_74(chip::to_underlying(status)); + } + + static void OnSuccessCallback_74(void * context, const chip::app::DataModel::Nullable & nullableInt16s) + { + (static_cast(context))->OnSuccessResponse_74(nullableInt16s); + } + + static void OnFailureCallback_75(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_75(chip::to_underlying(status)); + } + + static void OnSuccessCallback_75(void * context) { (static_cast(context))->OnSuccessResponse_75(); } + + static void OnFailureCallback_76(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_76(chip::to_underlying(status)); + } + + static void OnSuccessCallback_76(void * context, const chip::app::DataModel::Nullable & nullableInt32s) + { + (static_cast(context))->OnSuccessResponse_76(nullableInt32s); + } + + static void OnFailureCallback_77(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_77(chip::to_underlying(status)); + } + + static void OnSuccessCallback_77(void * context) { (static_cast(context))->OnSuccessResponse_77(); } + + static void OnFailureCallback_78(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_78(chip::to_underlying(status)); + } + + static void OnSuccessCallback_78(void * context, const chip::app::DataModel::Nullable & nullableInt32s) + { + (static_cast(context))->OnSuccessResponse_78(nullableInt32s); + } + + static void OnFailureCallback_79(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_79(chip::to_underlying(status)); + } + + static void OnSuccessCallback_79(void * context) { (static_cast(context))->OnSuccessResponse_79(); } + + static void OnFailureCallback_80(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_80(chip::to_underlying(status)); + } + + static void OnSuccessCallback_80(void * context, const chip::app::DataModel::Nullable & nullableInt32s) + { + (static_cast(context))->OnSuccessResponse_80(nullableInt32s); + } + + static void OnFailureCallback_81(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_81(chip::to_underlying(status)); + } + + static void OnSuccessCallback_81(void * context) { (static_cast(context))->OnSuccessResponse_81(); } + + static void OnFailureCallback_82(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_82(chip::to_underlying(status)); + } + + static void OnSuccessCallback_82(void * context, const chip::app::DataModel::Nullable & nullableInt64s) + { + (static_cast(context))->OnSuccessResponse_82(nullableInt64s); + } + + static void OnFailureCallback_83(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_83(chip::to_underlying(status)); + } + + static void OnSuccessCallback_83(void * context) { (static_cast(context))->OnSuccessResponse_83(); } + + static void OnFailureCallback_84(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_84(chip::to_underlying(status)); + } + + static void OnSuccessCallback_84(void * context, const chip::app::DataModel::Nullable & nullableInt64s) + { + (static_cast(context))->OnSuccessResponse_84(nullableInt64s); + } + + static void OnFailureCallback_85(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_85(chip::to_underlying(status)); + } + + static void OnSuccessCallback_85(void * context) { (static_cast(context))->OnSuccessResponse_85(); } + + static void OnFailureCallback_86(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_86(chip::to_underlying(status)); + } + + static void OnSuccessCallback_86(void * context, const chip::app::DataModel::Nullable & nullableInt64s) + { + (static_cast(context))->OnSuccessResponse_86(nullableInt64s); + } + + static void OnFailureCallback_87(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_87(chip::to_underlying(status)); + } + + static void OnSuccessCallback_87(void * context) { (static_cast(context))->OnSuccessResponse_87(); } + + static void OnFailureCallback_88(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_88(chip::to_underlying(status)); + } + + static void OnSuccessCallback_88(void * context, const chip::app::DataModel::Nullable & nullableEnum8) + { + (static_cast(context))->OnSuccessResponse_88(nullableEnum8); + } + + static void OnFailureCallback_89(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_89(chip::to_underlying(status)); + } + + static void OnSuccessCallback_89(void * context) { (static_cast(context))->OnSuccessResponse_89(); } + + static void OnFailureCallback_90(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_90(chip::to_underlying(status)); + } + + static void OnSuccessCallback_90(void * context, const chip::app::DataModel::Nullable & nullableEnum8) + { + (static_cast(context))->OnSuccessResponse_90(nullableEnum8); + } + + static void OnFailureCallback_91(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_91(chip::to_underlying(status)); + } + + static void OnSuccessCallback_91(void * context) { (static_cast(context))->OnSuccessResponse_91(); } + + static void OnFailureCallback_92(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_92(chip::to_underlying(status)); + } + + static void OnSuccessCallback_92(void * context, const chip::app::DataModel::Nullable & nullableEnum8) + { + (static_cast(context))->OnSuccessResponse_92(nullableEnum8); + } + + static void OnFailureCallback_93(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_93(chip::to_underlying(status)); + } + + static void OnSuccessCallback_93(void * context) { (static_cast(context))->OnSuccessResponse_93(); } + + static void OnFailureCallback_94(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_94(chip::to_underlying(status)); + } + + static void OnSuccessCallback_94(void * context, const chip::app::DataModel::Nullable & nullableEnum16) + { + (static_cast(context))->OnSuccessResponse_94(nullableEnum16); + } + + static void OnFailureCallback_95(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_95(chip::to_underlying(status)); + } + + static void OnSuccessCallback_95(void * context) { (static_cast(context))->OnSuccessResponse_95(); } + + static void OnFailureCallback_96(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_96(chip::to_underlying(status)); + } + + static void OnSuccessCallback_96(void * context, const chip::app::DataModel::Nullable & nullableEnum16) + { + (static_cast(context))->OnSuccessResponse_96(nullableEnum16); + } + + static void OnFailureCallback_97(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_97(chip::to_underlying(status)); + } + + static void OnSuccessCallback_97(void * context) { (static_cast(context))->OnSuccessResponse_97(); } + + static void OnFailureCallback_98(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_98(chip::to_underlying(status)); + } + + static void OnSuccessCallback_98(void * context, const chip::app::DataModel::Nullable & nullableEnum16) + { + (static_cast(context))->OnSuccessResponse_98(nullableEnum16); + } + + static void OnFailureCallback_99(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_99(chip::to_underlying(status)); + } + + static void OnSuccessCallback_99(void * context, const chip::app::DataModel::Nullable & nullableOctetString) + { + (static_cast(context))->OnSuccessResponse_99(nullableOctetString); + } + + static void OnFailureCallback_100(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_100(chip::to_underlying(status)); + } + + static void OnSuccessCallback_100(void * context) + { + (static_cast(context))->OnSuccessResponse_100(); + } + + static void OnFailureCallback_101(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_101(chip::to_underlying(status)); + } + + static void OnSuccessCallback_101(void * context, const chip::app::DataModel::Nullable & nullableOctetString) + { + (static_cast(context))->OnSuccessResponse_101(nullableOctetString); + } + + static void OnFailureCallback_102(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_102(chip::to_underlying(status)); + } + + static void OnSuccessCallback_102(void * context) + { + (static_cast(context))->OnSuccessResponse_102(); + } + + static void OnFailureCallback_103(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_103(chip::to_underlying(status)); + } + + static void OnSuccessCallback_103(void * context, const chip::app::DataModel::Nullable & nullableOctetString) + { + (static_cast(context))->OnSuccessResponse_103(nullableOctetString); + } + + static void OnFailureCallback_104(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_104(chip::to_underlying(status)); + } + + static void OnSuccessCallback_104(void * context) + { + (static_cast(context))->OnSuccessResponse_104(); + } + + static void OnFailureCallback_105(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_105(chip::to_underlying(status)); + } + + static void OnSuccessCallback_105(void * context, const chip::app::DataModel::Nullable & nullableOctetString) + { + (static_cast(context))->OnSuccessResponse_105(nullableOctetString); + } + + static void OnFailureCallback_106(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_106(chip::to_underlying(status)); + } + + static void OnSuccessCallback_106(void * context, const chip::app::DataModel::Nullable & nullableCharString) + { + (static_cast(context))->OnSuccessResponse_106(nullableCharString); + } + + static void OnFailureCallback_107(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_107(chip::to_underlying(status)); + } + + static void OnSuccessCallback_107(void * context) + { + (static_cast(context))->OnSuccessResponse_107(); + } + + static void OnFailureCallback_108(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_108(chip::to_underlying(status)); + } + + static void OnSuccessCallback_108(void * context) + { + (static_cast(context))->OnSuccessResponse_108(); + } + + static void OnFailureCallback_109(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_109(chip::to_underlying(status)); + } + + static void OnSuccessCallback_109(void * context, const chip::app::DataModel::Nullable & nullableCharString) + { + (static_cast(context))->OnSuccessResponse_109(nullableCharString); + } + + static void OnFailureCallback_110(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_110(chip::to_underlying(status)); + } + + static void OnSuccessCallback_110(void * context) + { + (static_cast(context))->OnSuccessResponse_110(); + } + + static void OnFailureCallback_111(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_111(chip::to_underlying(status)); + } + + static void OnSuccessCallback_111(void * context, const chip::app::DataModel::Nullable & nullableCharString) + { + (static_cast(context))->OnSuccessResponse_111(nullableCharString); + } + + // + // Tests methods + // + + CHIP_ERROR TestSendTestCommandWithStructArgumentAndArg1bIsTrue_0() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::TestCluster::Commands::TestStructArgumentRequest::Type; + using responseType = chip::app::Clusters::TestCluster::Commands::BooleanResponse::DecodableType; + + chip::app::Clusters::TestCluster::Commands::TestStructArgumentRequest::Type request; + + request.arg1.a = 0; + request.arg1.b = true; + request.arg1.c = static_cast(2); + request.arg1.d = chip::ByteSpan(chip::Uint8::from_const_char("octet_string"), strlen("octet_string")); + request.arg1.e = chip::Span("char_string", strlen("char_string")); + request.arg1.f = static_cast>(1); + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_0(data.value); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_0(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_0(bool value) + { + VerifyOrReturn(CheckValue("value", value, true)); + NextTest(); + } + + CHIP_ERROR TestSendTestCommandWithStructArgumentAndArg1bIsFalse_1() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::TestCluster::Commands::TestStructArgumentRequest::Type; + using responseType = chip::app::Clusters::TestCluster::Commands::BooleanResponse::DecodableType; + + chip::app::Clusters::TestCluster::Commands::TestStructArgumentRequest::Type request; + + request.arg1.a = 0; + request.arg1.b = false; + request.arg1.c = static_cast(2); + request.arg1.d = chip::ByteSpan(chip::Uint8::from_const_char("octet_string"), strlen("octet_string")); + request.arg1.e = chip::Span("char_string", strlen("char_string")); + request.arg1.f = static_cast>(1); + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_1(data.value); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_1(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1(bool value) + { + VerifyOrReturn(CheckValue("value", value, false)); + NextTest(); + } + + CHIP_ERROR TestSendTestCommandWithListOfInt8uAndNoneOfThemIsSetTo0_2() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::TestCluster::Commands::TestListInt8UArgumentRequest::Type; + using responseType = chip::app::Clusters::TestCluster::Commands::BooleanResponse::DecodableType; + + chip::app::Clusters::TestCluster::Commands::TestListInt8UArgumentRequest::Type request; + + uint8_t arg1List[9]; + arg1List[0] = 1; + arg1List[1] = 2; + arg1List[2] = 3; + arg1List[3] = 4; + arg1List[4] = 5; + arg1List[5] = 6; + arg1List[6] = 7; + arg1List[7] = 8; + arg1List[8] = 9; + request.arg1 = arg1List; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_2(data.value); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_2(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_2(bool value) + { + VerifyOrReturn(CheckValue("value", value, true)); + NextTest(); + } + + CHIP_ERROR TestSendTestCommandWithListOfInt8uAndOneOfThemIsSetTo0_3() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + using requestType = chip::app::Clusters::TestCluster::Commands::TestListInt8UArgumentRequest::Type; using responseType = chip::app::Clusters::TestCluster::Commands::BooleanResponse::DecodableType; - chip::app::Clusters::TestCluster::Commands::TestListInt8UArgumentRequest::Type request; + chip::app::Clusters::TestCluster::Commands::TestListInt8UArgumentRequest::Type request; + + uint8_t arg1List[10]; + arg1List[0] = 1; + arg1List[1] = 2; + arg1List[2] = 3; + arg1List[3] = 4; + arg1List[4] = 5; + arg1List[5] = 6; + arg1List[6] = 7; + arg1List[7] = 8; + arg1List[8] = 9; + arg1List[9] = 0; + request.arg1 = arg1List; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_3(data.value); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_3(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_3(bool value) + { + VerifyOrReturn(CheckValue("value", value, false)); + NextTest(); + } + + CHIP_ERROR TestSendTestCommandWithListOfInt8uAndGetItReversed_4() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::TestCluster::Commands::TestListInt8UReverseRequest::Type; + using responseType = chip::app::Clusters::TestCluster::Commands::TestListInt8UReverseResponse::DecodableType; + + chip::app::Clusters::TestCluster::Commands::TestListInt8UReverseRequest::Type request; + + uint8_t arg1List[9]; + arg1List[0] = 1; + arg1List[1] = 2; + arg1List[2] = 3; + arg1List[3] = 4; + arg1List[4] = 5; + arg1List[5] = 6; + arg1List[6] = 7; + arg1List[7] = 8; + arg1List[8] = 9; + request.arg1 = arg1List; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_4(data.arg1); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_4(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_4(const chip::app::DataModel::DecodableList & arg1) + { + auto iter = arg1.begin(); + VerifyOrReturn(CheckNextListItemDecodes("arg1", iter, 0)); + VerifyOrReturn(CheckValue("arg1[0]", iter.GetValue(), 9)); + VerifyOrReturn(CheckNextListItemDecodes("arg1", iter, 1)); + VerifyOrReturn(CheckValue("arg1[1]", iter.GetValue(), 8)); + VerifyOrReturn(CheckNextListItemDecodes("arg1", iter, 2)); + VerifyOrReturn(CheckValue("arg1[2]", iter.GetValue(), 7)); + VerifyOrReturn(CheckNextListItemDecodes("arg1", iter, 3)); + VerifyOrReturn(CheckValue("arg1[3]", iter.GetValue(), 6)); + VerifyOrReturn(CheckNextListItemDecodes("arg1", iter, 4)); + VerifyOrReturn(CheckValue("arg1[4]", iter.GetValue(), 5)); + VerifyOrReturn(CheckNextListItemDecodes("arg1", iter, 5)); + VerifyOrReturn(CheckValue("arg1[5]", iter.GetValue(), 4)); + VerifyOrReturn(CheckNextListItemDecodes("arg1", iter, 6)); + VerifyOrReturn(CheckValue("arg1[6]", iter.GetValue(), 3)); + VerifyOrReturn(CheckNextListItemDecodes("arg1", iter, 7)); + VerifyOrReturn(CheckValue("arg1[7]", iter.GetValue(), 2)); + VerifyOrReturn(CheckNextListItemDecodes("arg1", iter, 8)); + VerifyOrReturn(CheckValue("arg1[8]", iter.GetValue(), 1)); + VerifyOrReturn(CheckNoMoreListItems("arg1", iter, 9)); + NextTest(); + } + + CHIP_ERROR TestSendTestCommandWithEmptyListOfInt8uAndGetAnEmptyListBack_5() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::TestCluster::Commands::TestListInt8UReverseRequest::Type; + using responseType = chip::app::Clusters::TestCluster::Commands::TestListInt8UReverseResponse::DecodableType; + + chip::app::Clusters::TestCluster::Commands::TestListInt8UReverseRequest::Type request; + + request.arg1 = chip::app::DataModel::List(); + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_5(data.arg1); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_5(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_5(const chip::app::DataModel::DecodableList & arg1) + { + auto iter = arg1.begin(); + VerifyOrReturn(CheckNoMoreListItems("arg1", iter, 0)); + NextTest(); + } + + CHIP_ERROR TestSendTestCommandWithListOfStructArgumentAndArg1bOfFirstItemIsTrue_6() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::TestCluster::Commands::TestListStructArgumentRequest::Type; + using responseType = chip::app::Clusters::TestCluster::Commands::BooleanResponse::DecodableType; + + chip::app::Clusters::TestCluster::Commands::TestListStructArgumentRequest::Type request; + + chip::app::Clusters::TestCluster::Structs::SimpleStruct::Type arg1List[2]; + + arg1List[0].a = 0; + arg1List[0].b = true; + arg1List[0].c = static_cast(2); + arg1List[0].d = chip::ByteSpan(chip::Uint8::from_const_char("first_octet_string"), strlen("first_octet_string")); + arg1List[0].e = chip::Span("first_char_string", strlen("first_char_string")); + arg1List[0].f = static_cast>(1); + + arg1List[1].a = 1; + arg1List[1].b = true; + arg1List[1].c = static_cast(3); + arg1List[1].d = chip::ByteSpan(chip::Uint8::from_const_char("second_octet_string"), strlen("second_octet_string")); + arg1List[1].e = chip::Span("second_char_string", strlen("second_char_string")); + arg1List[1].f = static_cast>(1); + + request.arg1 = arg1List; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_6(data.value); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_6(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_6(bool value) + { + VerifyOrReturn(CheckValue("value", value, true)); + NextTest(); + } + + CHIP_ERROR TestSendTestCommandWithListOfStructArgumentAndArg1bOfFirstItemIsFalse_7() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::TestCluster::Commands::TestListStructArgumentRequest::Type; + using responseType = chip::app::Clusters::TestCluster::Commands::BooleanResponse::DecodableType; + + chip::app::Clusters::TestCluster::Commands::TestListStructArgumentRequest::Type request; + + chip::app::Clusters::TestCluster::Structs::SimpleStruct::Type arg1List[2]; + + arg1List[0].a = 1; + arg1List[0].b = true; + arg1List[0].c = static_cast(3); + arg1List[0].d = chip::ByteSpan(chip::Uint8::from_const_char("second_octet_string"), strlen("second_octet_string")); + arg1List[0].e = chip::Span("second_char_string", strlen("second_char_string")); + arg1List[0].f = static_cast>(1); + + arg1List[1].a = 0; + arg1List[1].b = false; + arg1List[1].c = static_cast(2); + arg1List[1].d = chip::ByteSpan(chip::Uint8::from_const_char("first_octet_string"), strlen("first_octet_string")); + arg1List[1].e = chip::Span("first_char_string", strlen("first_char_string")); + arg1List[1].f = static_cast>(1); + + request.arg1 = arg1List; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_7(data.value); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_7(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_7(bool value) + { + VerifyOrReturn(CheckValue("value", value, false)); + NextTest(); + } + + CHIP_ERROR TestSendTestCommandWithOptionalArgSet_8() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::TestCluster::Commands::TestNullableOptionalRequest::Type; + using responseType = chip::app::Clusters::TestCluster::Commands::TestNullableOptionalResponse::DecodableType; + + chip::app::Clusters::TestCluster::Commands::TestNullableOptionalRequest::Type request; + request.arg1.Emplace().SetNonNull() = 5; + + auto success = [](void * context, const responseType & data) { + (static_cast(context)) + ->OnSuccessResponse_8(data.wasPresent, data.wasNull, data.value, data.originalValue); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_8(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_8(bool wasPresent, const chip::Optional & wasNull, const chip::Optional & value, + const chip::Optional> & originalValue) + { + VerifyOrReturn(CheckValue("wasPresent", wasPresent, true)); + + VerifyOrReturn(CheckValuePresent("wasNull", wasNull)); + VerifyOrReturn(CheckValue("wasNull.Value()", wasNull.Value(), false)); + + VerifyOrReturn(CheckValuePresent("value", value)); + VerifyOrReturn(CheckValue("value.Value()", value.Value(), 5)); + + VerifyOrReturn(CheckValuePresent("originalValue", originalValue)); + VerifyOrReturn(CheckValueNonNull("originalValue.Value()", originalValue.Value())); + VerifyOrReturn(CheckValue("originalValue.Value().Value()", originalValue.Value().Value(), 5)); + NextTest(); + } + + CHIP_ERROR TestSendTestCommandWithoutItsOptionalArg_9() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::TestCluster::Commands::TestNullableOptionalRequest::Type; + using responseType = chip::app::Clusters::TestCluster::Commands::TestNullableOptionalResponse::DecodableType; + + chip::app::Clusters::TestCluster::Commands::TestNullableOptionalRequest::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context)) + ->OnSuccessResponse_9(data.wasPresent, data.wasNull, data.value, data.originalValue); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_9(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_9(bool wasPresent, const chip::Optional & wasNull, const chip::Optional & value, + const chip::Optional> & originalValue) + { + VerifyOrReturn(CheckValue("wasPresent", wasPresent, false)); + + NextTest(); + } + + CHIP_ERROR TestSendTestCommandWithOptionalArgSetToNull_10() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::TestCluster::Commands::TestNullableOptionalRequest::Type; + using responseType = chip::app::Clusters::TestCluster::Commands::TestNullableOptionalResponse::DecodableType; + + chip::app::Clusters::TestCluster::Commands::TestNullableOptionalRequest::Type request; + request.arg1.Emplace().SetNull(); + + auto success = [](void * context, const responseType & data) { + (static_cast(context)) + ->OnSuccessResponse_10(data.wasPresent, data.wasNull, data.value, data.originalValue); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_10(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_10(bool wasPresent, const chip::Optional & wasNull, const chip::Optional & value, + const chip::Optional> & originalValue) + { + VerifyOrReturn(CheckValue("wasPresent", wasPresent, true)); + + VerifyOrReturn(CheckValuePresent("wasNull", wasNull)); + VerifyOrReturn(CheckValue("wasNull.Value()", wasNull.Value(), true)); + + VerifyOrReturn(CheckValuePresent("originalValue", originalValue)); + VerifyOrReturn(CheckValueNull("originalValue.Value()", originalValue.Value())); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableBooleanNull_11() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableBooleanArgument; + nullableBooleanArgument.SetNull(); + + return cluster.WriteAttribute( + nullableBooleanArgument, this, OnSuccessCallback_11, OnFailureCallback_11); + } + + void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_11() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableBooleanNull_12() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_12, OnFailureCallback_12); + } + + void OnFailureResponse_12(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_12(const chip::app::DataModel::Nullable & nullableBoolean) + { + VerifyOrReturn(CheckValueNull("nullableBoolean", nullableBoolean)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableBooleanTrue_13() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableBooleanArgument; + nullableBooleanArgument.SetNonNull() = true; + + return cluster.WriteAttribute( + nullableBooleanArgument, this, OnSuccessCallback_13, OnFailureCallback_13); + } + + void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_13() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableBooleanTrue_14() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_14, OnFailureCallback_14); + } + + void OnFailureResponse_14(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_14(const chip::app::DataModel::Nullable & nullableBoolean) + { + VerifyOrReturn(CheckValueNonNull("nullableBoolean", nullableBoolean)); + VerifyOrReturn(CheckValue("nullableBoolean.Value()", nullableBoolean.Value(), true)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableBitmap8MaxValue_15() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableBitmap8Argument; + nullableBitmap8Argument.SetNonNull() = 254; + + return cluster.WriteAttribute( + nullableBitmap8Argument, this, OnSuccessCallback_15, OnFailureCallback_15); + } + + void OnFailureResponse_15(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_15() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableBitmap8MaxValue_16() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_16, OnFailureCallback_16); + } + + void OnFailureResponse_16(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_16(const chip::app::DataModel::Nullable & nullableBitmap8) + { + VerifyOrReturn(CheckValueNonNull("nullableBitmap8", nullableBitmap8)); + VerifyOrReturn(CheckValue("nullableBitmap8.Value()", nullableBitmap8.Value(), 254)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableBitmap8InvalidValue_17() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableBitmap8Argument; + nullableBitmap8Argument.SetNonNull() = 255; + + return cluster.WriteAttribute( + nullableBitmap8Argument, this, OnSuccessCallback_17, OnFailureCallback_17); + } + + void OnFailureResponse_17(uint8_t status) { NextTest(); } + + void OnSuccessResponse_17() { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadAttributeNullableBitmap8UnchangedValue_18() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_18, OnFailureCallback_18); + } + + void OnFailureResponse_18(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_18(const chip::app::DataModel::Nullable & nullableBitmap8) + { + VerifyOrReturn(CheckValueNonNull("nullableBitmap8", nullableBitmap8)); + VerifyOrReturn(CheckValue("nullableBitmap8.Value()", nullableBitmap8.Value(), 254)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableBitmap8NullValue_19() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableBitmap8Argument; + nullableBitmap8Argument.SetNull(); + + return cluster.WriteAttribute( + nullableBitmap8Argument, this, OnSuccessCallback_19, OnFailureCallback_19); + } + + void OnFailureResponse_19(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_19() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableBitmap8NullValue_20() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_20, OnFailureCallback_20); + } + + void OnFailureResponse_20(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_20(const chip::app::DataModel::Nullable & nullableBitmap8) + { + VerifyOrReturn(CheckValueNull("nullableBitmap8", nullableBitmap8)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableBitmap16MaxValue_21() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableBitmap16Argument; + nullableBitmap16Argument.SetNonNull() = 65534U; + + return cluster.WriteAttribute( + nullableBitmap16Argument, this, OnSuccessCallback_21, OnFailureCallback_21); + } + + void OnFailureResponse_21(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_21() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableBitmap16MaxValue_22() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_22, OnFailureCallback_22); + } + + void OnFailureResponse_22(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_22(const chip::app::DataModel::Nullable & nullableBitmap16) + { + VerifyOrReturn(CheckValueNonNull("nullableBitmap16", nullableBitmap16)); + VerifyOrReturn(CheckValue("nullableBitmap16.Value()", nullableBitmap16.Value(), 65534U)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableBitmap16InvalidValue_23() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableBitmap16Argument; + nullableBitmap16Argument.SetNonNull() = 65535U; + + return cluster.WriteAttribute( + nullableBitmap16Argument, this, OnSuccessCallback_23, OnFailureCallback_23); + } + + void OnFailureResponse_23(uint8_t status) { NextTest(); } + + void OnSuccessResponse_23() { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadAttributeNullableBitmap16UnchangedValue_24() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_24, OnFailureCallback_24); + } + + void OnFailureResponse_24(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_24(const chip::app::DataModel::Nullable & nullableBitmap16) + { + VerifyOrReturn(CheckValueNonNull("nullableBitmap16", nullableBitmap16)); + VerifyOrReturn(CheckValue("nullableBitmap16.Value()", nullableBitmap16.Value(), 65534U)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableBitmap16NullValue_25() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableBitmap16Argument; + nullableBitmap16Argument.SetNull(); + + return cluster.WriteAttribute( + nullableBitmap16Argument, this, OnSuccessCallback_25, OnFailureCallback_25); + } + + void OnFailureResponse_25(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_25() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableBitmap16NullValue_26() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_26, OnFailureCallback_26); + } + + void OnFailureResponse_26(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_26(const chip::app::DataModel::Nullable & nullableBitmap16) + { + VerifyOrReturn(CheckValueNull("nullableBitmap16", nullableBitmap16)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableBitmap32MaxValue_27() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableBitmap32Argument; + nullableBitmap32Argument.SetNonNull() = 4294967294UL; + + return cluster.WriteAttribute( + nullableBitmap32Argument, this, OnSuccessCallback_27, OnFailureCallback_27); + } + + void OnFailureResponse_27(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_27() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableBitmap32MaxValue_28() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_28, OnFailureCallback_28); + } + + void OnFailureResponse_28(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_28(const chip::app::DataModel::Nullable & nullableBitmap32) + { + VerifyOrReturn(CheckValueNonNull("nullableBitmap32", nullableBitmap32)); + VerifyOrReturn(CheckValue("nullableBitmap32.Value()", nullableBitmap32.Value(), 4294967294UL)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableBitmap32InvalidValue_29() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableBitmap32Argument; + nullableBitmap32Argument.SetNonNull() = 4294967295UL; + + return cluster.WriteAttribute( + nullableBitmap32Argument, this, OnSuccessCallback_29, OnFailureCallback_29); + } + + void OnFailureResponse_29(uint8_t status) { NextTest(); } + + void OnSuccessResponse_29() { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadAttributeNullableBitmap32UnchangedValue_30() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_30, OnFailureCallback_30); + } + + void OnFailureResponse_30(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_30(const chip::app::DataModel::Nullable & nullableBitmap32) + { + VerifyOrReturn(CheckValueNonNull("nullableBitmap32", nullableBitmap32)); + VerifyOrReturn(CheckValue("nullableBitmap32.Value()", nullableBitmap32.Value(), 4294967294UL)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableBitmap32NullValue_31() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableBitmap32Argument; + nullableBitmap32Argument.SetNull(); + + return cluster.WriteAttribute( + nullableBitmap32Argument, this, OnSuccessCallback_31, OnFailureCallback_31); + } + + void OnFailureResponse_31(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_31() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableBitmap32NullValue_32() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_32, OnFailureCallback_32); + } + + void OnFailureResponse_32(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_32(const chip::app::DataModel::Nullable & nullableBitmap32) + { + VerifyOrReturn(CheckValueNull("nullableBitmap32", nullableBitmap32)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableBitmap64MaxValue_33() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableBitmap64Argument; + nullableBitmap64Argument.SetNonNull() = 18446744073709551614ULL; + + return cluster.WriteAttribute( + nullableBitmap64Argument, this, OnSuccessCallback_33, OnFailureCallback_33); + } + + void OnFailureResponse_33(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_33() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableBitmap64MaxValue_34() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_34, OnFailureCallback_34); + } + + void OnFailureResponse_34(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_34(const chip::app::DataModel::Nullable & nullableBitmap64) + { + VerifyOrReturn(CheckValueNonNull("nullableBitmap64", nullableBitmap64)); + VerifyOrReturn(CheckValue("nullableBitmap64.Value()", nullableBitmap64.Value(), 18446744073709551614ULL)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableBitmap64InvalidValue_35() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableBitmap64Argument; + nullableBitmap64Argument.SetNonNull() = 18446744073709551615ULL; + + return cluster.WriteAttribute( + nullableBitmap64Argument, this, OnSuccessCallback_35, OnFailureCallback_35); + } + + void OnFailureResponse_35(uint8_t status) { NextTest(); } + + void OnSuccessResponse_35() { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadAttributeNullableBitmap64UnchangedValue_36() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_36, OnFailureCallback_36); + } + + void OnFailureResponse_36(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_36(const chip::app::DataModel::Nullable & nullableBitmap64) + { + VerifyOrReturn(CheckValueNonNull("nullableBitmap64", nullableBitmap64)); + VerifyOrReturn(CheckValue("nullableBitmap64.Value()", nullableBitmap64.Value(), 18446744073709551614ULL)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableBitmap64NullValue_37() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableBitmap64Argument; + nullableBitmap64Argument.SetNull(); + + return cluster.WriteAttribute( + nullableBitmap64Argument, this, OnSuccessCallback_37, OnFailureCallback_37); + } + + void OnFailureResponse_37(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_37() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableBitmap64NullValue_38() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_38, OnFailureCallback_38); + } + + void OnFailureResponse_38(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_38(const chip::app::DataModel::Nullable & nullableBitmap64) + { + VerifyOrReturn(CheckValueNull("nullableBitmap64", nullableBitmap64)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableInt8uMaxValue_39() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableInt8uArgument; + nullableInt8uArgument.SetNonNull() = 254; + + return cluster.WriteAttribute( + nullableInt8uArgument, this, OnSuccessCallback_39, OnFailureCallback_39); + } + + void OnFailureResponse_39(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_39() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableInt8uMaxValue_40() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_40, OnFailureCallback_40); + } + + void OnFailureResponse_40(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_40(const chip::app::DataModel::Nullable & nullableInt8u) + { + VerifyOrReturn(CheckValueNonNull("nullableInt8u", nullableInt8u)); + VerifyOrReturn(CheckValue("nullableInt8u.Value()", nullableInt8u.Value(), 254)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableInt8uInvalidValue_41() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableInt8uArgument; + nullableInt8uArgument.SetNonNull() = 255; + + return cluster.WriteAttribute( + nullableInt8uArgument, this, OnSuccessCallback_41, OnFailureCallback_41); + } + + void OnFailureResponse_41(uint8_t status) { NextTest(); } + + void OnSuccessResponse_41() { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadAttributeNullableInt8uUnchangedValue_42() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_42, OnFailureCallback_42); + } + + void OnFailureResponse_42(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_42(const chip::app::DataModel::Nullable & nullableInt8u) + { + VerifyOrReturn(CheckValueNonNull("nullableInt8u", nullableInt8u)); + VerifyOrReturn(CheckValue("nullableInt8u.Value()", nullableInt8u.Value(), 254)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableInt8uNullValue_43() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableInt8uArgument; + nullableInt8uArgument.SetNull(); + + return cluster.WriteAttribute( + nullableInt8uArgument, this, OnSuccessCallback_43, OnFailureCallback_43); + } + + void OnFailureResponse_43(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_43() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableInt8uNullValue_44() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_44, OnFailureCallback_44); + } + + void OnFailureResponse_44(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_44(const chip::app::DataModel::Nullable & nullableInt8u) + { + VerifyOrReturn(CheckValueNull("nullableInt8u", nullableInt8u)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableInt16uMaxValue_45() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableInt16uArgument; + nullableInt16uArgument.SetNonNull() = 65534U; + + return cluster.WriteAttribute( + nullableInt16uArgument, this, OnSuccessCallback_45, OnFailureCallback_45); + } + + void OnFailureResponse_45(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_45() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableInt16uMaxValue_46() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_46, OnFailureCallback_46); + } + + void OnFailureResponse_46(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_46(const chip::app::DataModel::Nullable & nullableInt16u) + { + VerifyOrReturn(CheckValueNonNull("nullableInt16u", nullableInt16u)); + VerifyOrReturn(CheckValue("nullableInt16u.Value()", nullableInt16u.Value(), 65534U)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableInt16uInvalidValue_47() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableInt16uArgument; + nullableInt16uArgument.SetNonNull() = 65535U; + + return cluster.WriteAttribute( + nullableInt16uArgument, this, OnSuccessCallback_47, OnFailureCallback_47); + } + + void OnFailureResponse_47(uint8_t status) { NextTest(); } + + void OnSuccessResponse_47() { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadAttributeNullableInt16uUnchangedValue_48() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_48, OnFailureCallback_48); + } + + void OnFailureResponse_48(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_48(const chip::app::DataModel::Nullable & nullableInt16u) + { + VerifyOrReturn(CheckValueNonNull("nullableInt16u", nullableInt16u)); + VerifyOrReturn(CheckValue("nullableInt16u.Value()", nullableInt16u.Value(), 65534U)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableInt16uNullValue_49() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableInt16uArgument; + nullableInt16uArgument.SetNull(); + + return cluster.WriteAttribute( + nullableInt16uArgument, this, OnSuccessCallback_49, OnFailureCallback_49); + } + + void OnFailureResponse_49(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_49() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableInt16uNullValue_50() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_50, OnFailureCallback_50); + } + + void OnFailureResponse_50(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_50(const chip::app::DataModel::Nullable & nullableInt16u) + { + VerifyOrReturn(CheckValueNull("nullableInt16u", nullableInt16u)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableInt32uMaxValue_51() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableInt32uArgument; + nullableInt32uArgument.SetNonNull() = 4294967294UL; + + return cluster.WriteAttribute( + nullableInt32uArgument, this, OnSuccessCallback_51, OnFailureCallback_51); + } + + void OnFailureResponse_51(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_51() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableInt32uMaxValue_52() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_52, OnFailureCallback_52); + } + + void OnFailureResponse_52(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_52(const chip::app::DataModel::Nullable & nullableInt32u) + { + VerifyOrReturn(CheckValueNonNull("nullableInt32u", nullableInt32u)); + VerifyOrReturn(CheckValue("nullableInt32u.Value()", nullableInt32u.Value(), 4294967294UL)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableInt32uInvalidValue_53() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableInt32uArgument; + nullableInt32uArgument.SetNonNull() = 4294967295UL; + + return cluster.WriteAttribute( + nullableInt32uArgument, this, OnSuccessCallback_53, OnFailureCallback_53); + } + + void OnFailureResponse_53(uint8_t status) { NextTest(); } + + void OnSuccessResponse_53() { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadAttributeNullableInt32uUnchangedValue_54() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_54, OnFailureCallback_54); + } + + void OnFailureResponse_54(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_54(const chip::app::DataModel::Nullable & nullableInt32u) + { + VerifyOrReturn(CheckValueNonNull("nullableInt32u", nullableInt32u)); + VerifyOrReturn(CheckValue("nullableInt32u.Value()", nullableInt32u.Value(), 4294967294UL)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableInt32uNullValue_55() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableInt32uArgument; + nullableInt32uArgument.SetNull(); + + return cluster.WriteAttribute( + nullableInt32uArgument, this, OnSuccessCallback_55, OnFailureCallback_55); + } + + void OnFailureResponse_55(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_55() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableInt32uNullValue_56() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_56, OnFailureCallback_56); + } + + void OnFailureResponse_56(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_56(const chip::app::DataModel::Nullable & nullableInt32u) + { + VerifyOrReturn(CheckValueNull("nullableInt32u", nullableInt32u)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableInt64uMaxValue_57() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableInt64uArgument; + nullableInt64uArgument.SetNonNull() = 18446744073709551614ULL; + + return cluster.WriteAttribute( + nullableInt64uArgument, this, OnSuccessCallback_57, OnFailureCallback_57); + } + + void OnFailureResponse_57(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_57() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableInt64uMaxValue_58() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_58, OnFailureCallback_58); + } + + void OnFailureResponse_58(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_58(const chip::app::DataModel::Nullable & nullableInt64u) + { + VerifyOrReturn(CheckValueNonNull("nullableInt64u", nullableInt64u)); + VerifyOrReturn(CheckValue("nullableInt64u.Value()", nullableInt64u.Value(), 18446744073709551614ULL)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableInt64uInvalidValue_59() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableInt64uArgument; + nullableInt64uArgument.SetNonNull() = 18446744073709551615ULL; + + return cluster.WriteAttribute( + nullableInt64uArgument, this, OnSuccessCallback_59, OnFailureCallback_59); + } + + void OnFailureResponse_59(uint8_t status) { NextTest(); } + + void OnSuccessResponse_59() { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadAttributeNullableInt64uUnchangedValue_60() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_60, OnFailureCallback_60); + } + + void OnFailureResponse_60(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_60(const chip::app::DataModel::Nullable & nullableInt64u) + { + VerifyOrReturn(CheckValueNonNull("nullableInt64u", nullableInt64u)); + VerifyOrReturn(CheckValue("nullableInt64u.Value()", nullableInt64u.Value(), 18446744073709551614ULL)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableInt64uNullValue_61() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableInt64uArgument; + nullableInt64uArgument.SetNull(); + + return cluster.WriteAttribute( + nullableInt64uArgument, this, OnSuccessCallback_61, OnFailureCallback_61); + } + + void OnFailureResponse_61(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_61() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableInt64uNullValue_62() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_62, OnFailureCallback_62); + } + + void OnFailureResponse_62(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_62(const chip::app::DataModel::Nullable & nullableInt64u) + { + VerifyOrReturn(CheckValueNull("nullableInt64u", nullableInt64u)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableInt8sMinValue_63() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableInt8sArgument; + nullableInt8sArgument.SetNonNull() = -127; + + return cluster.WriteAttribute( + nullableInt8sArgument, this, OnSuccessCallback_63, OnFailureCallback_63); + } + + void OnFailureResponse_63(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_63() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableInt8sMinValue_64() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_64, OnFailureCallback_64); + } + + void OnFailureResponse_64(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_64(const chip::app::DataModel::Nullable & nullableInt8s) + { + VerifyOrReturn(CheckValueNonNull("nullableInt8s", nullableInt8s)); + VerifyOrReturn(CheckValue("nullableInt8s.Value()", nullableInt8s.Value(), -127)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableInt8sInvalidValue_65() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableInt8sArgument; + nullableInt8sArgument.SetNonNull() = -128; + + return cluster.WriteAttribute( + nullableInt8sArgument, this, OnSuccessCallback_65, OnFailureCallback_65); + } + + void OnFailureResponse_65(uint8_t status) { NextTest(); } + + void OnSuccessResponse_65() { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadAttributeNullableInt8sUnchangedValue_66() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_66, OnFailureCallback_66); + } + + void OnFailureResponse_66(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_66(const chip::app::DataModel::Nullable & nullableInt8s) + { + VerifyOrReturn(CheckValueNonNull("nullableInt8s", nullableInt8s)); + VerifyOrReturn(CheckValue("nullableInt8s.Value()", nullableInt8s.Value(), -127)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableInt8sNullValue_67() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableInt8sArgument; + nullableInt8sArgument.SetNull(); + + return cluster.WriteAttribute( + nullableInt8sArgument, this, OnSuccessCallback_67, OnFailureCallback_67); + } + + void OnFailureResponse_67(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_67() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableInt8sNullValue_68() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_68, OnFailureCallback_68); + } + + void OnFailureResponse_68(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_68(const chip::app::DataModel::Nullable & nullableInt8s) + { + VerifyOrReturn(CheckValueNull("nullableInt8s", nullableInt8s)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableInt16sMinValue_69() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableInt16sArgument; + nullableInt16sArgument.SetNonNull() = -32767; + + return cluster.WriteAttribute( + nullableInt16sArgument, this, OnSuccessCallback_69, OnFailureCallback_69); + } + + void OnFailureResponse_69(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_69() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableInt16sMinValue_70() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_70, OnFailureCallback_70); + } + + void OnFailureResponse_70(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_70(const chip::app::DataModel::Nullable & nullableInt16s) + { + VerifyOrReturn(CheckValueNonNull("nullableInt16s", nullableInt16s)); + VerifyOrReturn(CheckValue("nullableInt16s.Value()", nullableInt16s.Value(), -32767)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableInt16sInvalidValue_71() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableInt16sArgument; + nullableInt16sArgument.SetNonNull() = -32768; + + return cluster.WriteAttribute( + nullableInt16sArgument, this, OnSuccessCallback_71, OnFailureCallback_71); + } + + void OnFailureResponse_71(uint8_t status) { NextTest(); } + + void OnSuccessResponse_71() { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadAttributeNullableInt16sUnchangedValue_72() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_72, OnFailureCallback_72); + } + + void OnFailureResponse_72(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_72(const chip::app::DataModel::Nullable & nullableInt16s) + { + VerifyOrReturn(CheckValueNonNull("nullableInt16s", nullableInt16s)); + VerifyOrReturn(CheckValue("nullableInt16s.Value()", nullableInt16s.Value(), -32767)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableInt16sNullValue_73() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableInt16sArgument; + nullableInt16sArgument.SetNull(); + + return cluster.WriteAttribute( + nullableInt16sArgument, this, OnSuccessCallback_73, OnFailureCallback_73); + } + + void OnFailureResponse_73(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_73() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableInt16sNullValue_74() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_74, OnFailureCallback_74); + } + + void OnFailureResponse_74(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_74(const chip::app::DataModel::Nullable & nullableInt16s) + { + VerifyOrReturn(CheckValueNull("nullableInt16s", nullableInt16s)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableInt32sMinValue_75() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableInt32sArgument; + nullableInt32sArgument.SetNonNull() = -2147483647L; - uint8_t arg1List[10]; - arg1List[0] = 1; - arg1List[1] = 2; - arg1List[2] = 3; - arg1List[3] = 4; - arg1List[4] = 5; - arg1List[5] = 6; - arg1List[6] = 7; - arg1List[7] = 8; - arg1List[8] = 9; - arg1List[9] = 0; - request.arg1 = arg1List; + return cluster.WriteAttribute( + nullableInt32sArgument, this, OnSuccessCallback_75, OnFailureCallback_75); + } - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_3(data.value); - }; + void OnFailureResponse_75(uint8_t status) { ThrowFailureResponse(); } - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_3(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + void OnSuccessResponse_75() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableInt32sMinValue_76() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_76, OnFailureCallback_76); } - void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_76(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_3(bool value) + void OnSuccessResponse_76(const chip::app::DataModel::Nullable & nullableInt32s) + { + VerifyOrReturn(CheckValueNonNull("nullableInt32s", nullableInt32s)); + VerifyOrReturn(CheckValue("nullableInt32s.Value()", nullableInt32s.Value(), -2147483647L)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableInt32sInvalidValue_77() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableInt32sArgument; + nullableInt32sArgument.SetNonNull() = -2147483648L; + + return cluster.WriteAttribute( + nullableInt32sArgument, this, OnSuccessCallback_77, OnFailureCallback_77); + } + + void OnFailureResponse_77(uint8_t status) { NextTest(); } + + void OnSuccessResponse_77() { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadAttributeNullableInt32sUnchangedValue_78() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_78, OnFailureCallback_78); + } + + void OnFailureResponse_78(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_78(const chip::app::DataModel::Nullable & nullableInt32s) + { + VerifyOrReturn(CheckValueNonNull("nullableInt32s", nullableInt32s)); + VerifyOrReturn(CheckValue("nullableInt32s.Value()", nullableInt32s.Value(), -2147483647L)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableInt32sNullValue_79() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableInt32sArgument; + nullableInt32sArgument.SetNull(); + + return cluster.WriteAttribute( + nullableInt32sArgument, this, OnSuccessCallback_79, OnFailureCallback_79); + } + + void OnFailureResponse_79(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_79() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableInt32sNullValue_80() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_80, OnFailureCallback_80); + } + + void OnFailureResponse_80(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_80(const chip::app::DataModel::Nullable & nullableInt32s) + { + VerifyOrReturn(CheckValueNull("nullableInt32s", nullableInt32s)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableInt64sMinValue_81() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableInt64sArgument; + nullableInt64sArgument.SetNonNull() = -9223372036854775807LL; + + return cluster.WriteAttribute( + nullableInt64sArgument, this, OnSuccessCallback_81, OnFailureCallback_81); + } + + void OnFailureResponse_81(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_81() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableInt64sMinValue_82() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_82, OnFailureCallback_82); + } + + void OnFailureResponse_82(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_82(const chip::app::DataModel::Nullable & nullableInt64s) + { + VerifyOrReturn(CheckValueNonNull("nullableInt64s", nullableInt64s)); + VerifyOrReturn(CheckValue("nullableInt64s.Value()", nullableInt64s.Value(), -9223372036854775807LL)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableInt64sInvalidValue_83() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableInt64sArgument; + nullableInt64sArgument.SetNonNull() = -9223372036854775807LL - 1LL; + + return cluster.WriteAttribute( + nullableInt64sArgument, this, OnSuccessCallback_83, OnFailureCallback_83); + } + + void OnFailureResponse_83(uint8_t status) { NextTest(); } + + void OnSuccessResponse_83() { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadAttributeNullableInt64sUnchangedValue_84() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_84, OnFailureCallback_84); + } + + void OnFailureResponse_84(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_84(const chip::app::DataModel::Nullable & nullableInt64s) + { + VerifyOrReturn(CheckValueNonNull("nullableInt64s", nullableInt64s)); + VerifyOrReturn(CheckValue("nullableInt64s.Value()", nullableInt64s.Value(), -9223372036854775807LL)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableInt64sNullValue_85() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableInt64sArgument; + nullableInt64sArgument.SetNull(); + + return cluster.WriteAttribute( + nullableInt64sArgument, this, OnSuccessCallback_85, OnFailureCallback_85); + } + + void OnFailureResponse_85(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_85() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableInt64sNullValue_86() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_86, OnFailureCallback_86); + } + + void OnFailureResponse_86(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_86(const chip::app::DataModel::Nullable & nullableInt64s) + { + VerifyOrReturn(CheckValueNull("nullableInt64s", nullableInt64s)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableEnum8MaxValue_87() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableEnum8Argument; + nullableEnum8Argument.SetNonNull() = static_cast(254); + + return cluster.WriteAttribute( + nullableEnum8Argument, this, OnSuccessCallback_87, OnFailureCallback_87); + } + + void OnFailureResponse_87(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_87() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableEnum8MaxValue_88() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_88, OnFailureCallback_88); + } + + void OnFailureResponse_88(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_88(const chip::app::DataModel::Nullable & nullableEnum8) + { + VerifyOrReturn(CheckValueNonNull("nullableEnum8", nullableEnum8)); + VerifyOrReturn(CheckValue("nullableEnum8.Value()", nullableEnum8.Value(), 254)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableEnum8InvalidValue_89() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableEnum8Argument; + nullableEnum8Argument.SetNonNull() = static_cast(255); + + return cluster.WriteAttribute( + nullableEnum8Argument, this, OnSuccessCallback_89, OnFailureCallback_89); + } + + void OnFailureResponse_89(uint8_t status) { NextTest(); } + + void OnSuccessResponse_89() { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadAttributeNullableEnum8UnchangedValue_90() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_90, OnFailureCallback_90); + } + + void OnFailureResponse_90(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_90(const chip::app::DataModel::Nullable & nullableEnum8) + { + VerifyOrReturn(CheckValueNonNull("nullableEnum8", nullableEnum8)); + VerifyOrReturn(CheckValue("nullableEnum8.Value()", nullableEnum8.Value(), 254)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableEnum8NullValue_91() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableEnum8Argument; + nullableEnum8Argument.SetNull(); + + return cluster.WriteAttribute( + nullableEnum8Argument, this, OnSuccessCallback_91, OnFailureCallback_91); + } + + void OnFailureResponse_91(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_91() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableEnum8NullValue_92() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_92, OnFailureCallback_92); + } + + void OnFailureResponse_92(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_92(const chip::app::DataModel::Nullable & nullableEnum8) + { + VerifyOrReturn(CheckValueNull("nullableEnum8", nullableEnum8)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableEnum16MaxValue_93() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableEnum16Argument; + nullableEnum16Argument.SetNonNull() = static_cast(65534); + + return cluster.WriteAttribute( + nullableEnum16Argument, this, OnSuccessCallback_93, OnFailureCallback_93); + } + + void OnFailureResponse_93(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_93() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableEnum16MaxValue_94() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_94, OnFailureCallback_94); + } + + void OnFailureResponse_94(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_94(const chip::app::DataModel::Nullable & nullableEnum16) + { + VerifyOrReturn(CheckValueNonNull("nullableEnum16", nullableEnum16)); + VerifyOrReturn(CheckValue("nullableEnum16.Value()", nullableEnum16.Value(), 65534U)); + NextTest(); + } + + CHIP_ERROR TestWriteAttributeNullableEnum16InvalidValue_95() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableEnum16Argument; + nullableEnum16Argument.SetNonNull() = static_cast(65535); + + return cluster.WriteAttribute( + nullableEnum16Argument, this, OnSuccessCallback_95, OnFailureCallback_95); + } + + void OnFailureResponse_95(uint8_t status) { NextTest(); } + + void OnSuccessResponse_95() { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadAttributeNullableEnum16UnchangedValue_96() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_96, OnFailureCallback_96); + } + + void OnFailureResponse_96(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_96(const chip::app::DataModel::Nullable & nullableEnum16) { - VerifyOrReturn(CheckValue("value", value, false)); + VerifyOrReturn(CheckValueNonNull("nullableEnum16", nullableEnum16)); + VerifyOrReturn(CheckValue("nullableEnum16.Value()", nullableEnum16.Value(), 65534U)); NextTest(); } - CHIP_ERROR TestSendTestCommandWithListOfInt8uAndGetItReversed_4() + CHIP_ERROR TestWriteAttributeNullableEnum16NullValue_97() { chip::Controller::TestClusterClusterTest cluster; cluster.Associate(mDevice, 1); - using requestType = chip::app::Clusters::TestCluster::Commands::TestListInt8UReverseRequest::Type; - using responseType = chip::app::Clusters::TestCluster::Commands::TestListInt8UReverseResponse::DecodableType; + chip::app::DataModel::Nullable nullableEnum16Argument; + nullableEnum16Argument.SetNull(); - chip::app::Clusters::TestCluster::Commands::TestListInt8UReverseRequest::Type request; + return cluster.WriteAttribute( + nullableEnum16Argument, this, OnSuccessCallback_97, OnFailureCallback_97); + } - uint8_t arg1List[9]; - arg1List[0] = 1; - arg1List[1] = 2; - arg1List[2] = 3; - arg1List[3] = 4; - arg1List[4] = 5; - arg1List[5] = 6; - arg1List[6] = 7; - arg1List[7] = 8; - arg1List[8] = 9; - request.arg1 = arg1List; + void OnFailureResponse_97(uint8_t status) { ThrowFailureResponse(); } - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_4(data.arg1); - }; + void OnSuccessResponse_97() { NextTest(); } - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_4(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + CHIP_ERROR TestReadAttributeNullableEnum16NullValue_98() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_98, OnFailureCallback_98); } - void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_98(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_4(const chip::app::DataModel::DecodableList & arg1) + void OnSuccessResponse_98(const chip::app::DataModel::Nullable & nullableEnum16) { - auto iter = arg1.begin(); - VerifyOrReturn(CheckNextListItemDecodes("arg1", iter, 0)); - VerifyOrReturn(CheckValue("arg1[0]", iter.GetValue(), 9)); - VerifyOrReturn(CheckNextListItemDecodes("arg1", iter, 1)); - VerifyOrReturn(CheckValue("arg1[1]", iter.GetValue(), 8)); - VerifyOrReturn(CheckNextListItemDecodes("arg1", iter, 2)); - VerifyOrReturn(CheckValue("arg1[2]", iter.GetValue(), 7)); - VerifyOrReturn(CheckNextListItemDecodes("arg1", iter, 3)); - VerifyOrReturn(CheckValue("arg1[3]", iter.GetValue(), 6)); - VerifyOrReturn(CheckNextListItemDecodes("arg1", iter, 4)); - VerifyOrReturn(CheckValue("arg1[4]", iter.GetValue(), 5)); - VerifyOrReturn(CheckNextListItemDecodes("arg1", iter, 5)); - VerifyOrReturn(CheckValue("arg1[5]", iter.GetValue(), 4)); - VerifyOrReturn(CheckNextListItemDecodes("arg1", iter, 6)); - VerifyOrReturn(CheckValue("arg1[6]", iter.GetValue(), 3)); - VerifyOrReturn(CheckNextListItemDecodes("arg1", iter, 7)); - VerifyOrReturn(CheckValue("arg1[7]", iter.GetValue(), 2)); - VerifyOrReturn(CheckNextListItemDecodes("arg1", iter, 8)); - VerifyOrReturn(CheckValue("arg1[8]", iter.GetValue(), 1)); - VerifyOrReturn(CheckNoMoreListItems("arg1", iter, 9)); + VerifyOrReturn(CheckValueNull("nullableEnum16", nullableEnum16)); NextTest(); } - CHIP_ERROR TestSendTestCommandWithEmptyListOfInt8uAndGetAnEmptyListBack_5() + CHIP_ERROR TestReadAttributeNullableOctetStringDefaultValue_99() { chip::Controller::TestClusterClusterTest cluster; cluster.Associate(mDevice, 1); - using requestType = chip::app::Clusters::TestCluster::Commands::TestListInt8UReverseRequest::Type; - using responseType = chip::app::Clusters::TestCluster::Commands::TestListInt8UReverseResponse::DecodableType; - - chip::app::Clusters::TestCluster::Commands::TestListInt8UReverseRequest::Type request; - - request.arg1 = chip::app::DataModel::List(); - - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_5(data.arg1); - }; - - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_5(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + return cluster.ReadAttribute( + this, OnSuccessCallback_99, OnFailureCallback_99); } - void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_99(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_5(const chip::app::DataModel::DecodableList & arg1) + void OnSuccessResponse_99(const chip::app::DataModel::Nullable & nullableOctetString) { - auto iter = arg1.begin(); - VerifyOrReturn(CheckNoMoreListItems("arg1", iter, 0)); + VerifyOrReturn(CheckValueNonNull("nullableOctetString", nullableOctetString)); + VerifyOrReturn(CheckValueAsString("nullableOctetString.Value()", nullableOctetString.Value(), "")); NextTest(); } - CHIP_ERROR TestSendTestCommandWithListOfStructArgumentAndArg1bOfFirstItemIsTrue_6() + CHIP_ERROR TestWriteAttributeNullableOctetString_100() { chip::Controller::TestClusterClusterTest cluster; cluster.Associate(mDevice, 1); - using requestType = chip::app::Clusters::TestCluster::Commands::TestListStructArgumentRequest::Type; - using responseType = chip::app::Clusters::TestCluster::Commands::BooleanResponse::DecodableType; - - chip::app::Clusters::TestCluster::Commands::TestListStructArgumentRequest::Type request; - - chip::app::Clusters::TestCluster::Structs::SimpleStruct::Type arg1List[2]; + chip::app::DataModel::Nullable nullableOctetStringArgument; + nullableOctetStringArgument.SetNonNull() = chip::ByteSpan(chip::Uint8::from_const_char("TestValue"), strlen("TestValue")); - arg1List[0].a = 0; - arg1List[0].b = true; - arg1List[0].c = static_cast(2); - arg1List[0].d = chip::ByteSpan(chip::Uint8::from_const_char("first_octet_string"), strlen("first_octet_string")); - arg1List[0].e = chip::Span("first_char_string", strlen("first_char_string")); - arg1List[0].f = static_cast>(1); + return cluster.WriteAttribute( + nullableOctetStringArgument, this, OnSuccessCallback_100, OnFailureCallback_100); + } - arg1List[1].a = 1; - arg1List[1].b = true; - arg1List[1].c = static_cast(3); - arg1List[1].d = chip::ByteSpan(chip::Uint8::from_const_char("second_octet_string"), strlen("second_octet_string")); - arg1List[1].e = chip::Span("second_char_string", strlen("second_char_string")); - arg1List[1].f = static_cast>(1); + void OnFailureResponse_100(uint8_t status) { ThrowFailureResponse(); } - request.arg1 = arg1List; + void OnSuccessResponse_100() { NextTest(); } - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_6(data.value); - }; + CHIP_ERROR TestReadAttributeNullableOctetString_101() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_6(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + return cluster.ReadAttribute( + this, OnSuccessCallback_101, OnFailureCallback_101); } - void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_101(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_6(bool value) + void OnSuccessResponse_101(const chip::app::DataModel::Nullable & nullableOctetString) { - VerifyOrReturn(CheckValue("value", value, true)); + VerifyOrReturn(CheckValueNonNull("nullableOctetString", nullableOctetString)); + VerifyOrReturn(CheckValueAsString("nullableOctetString.Value()", nullableOctetString.Value(), "TestValue")); NextTest(); } - CHIP_ERROR TestSendTestCommandWithListOfStructArgumentAndArg1bOfFirstItemIsFalse_7() + CHIP_ERROR TestWriteAttributeNullableOctetString_102() { chip::Controller::TestClusterClusterTest cluster; cluster.Associate(mDevice, 1); - using requestType = chip::app::Clusters::TestCluster::Commands::TestListStructArgumentRequest::Type; - using responseType = chip::app::Clusters::TestCluster::Commands::BooleanResponse::DecodableType; - - chip::app::Clusters::TestCluster::Commands::TestListStructArgumentRequest::Type request; - - chip::app::Clusters::TestCluster::Structs::SimpleStruct::Type arg1List[2]; + chip::app::DataModel::Nullable nullableOctetStringArgument; + nullableOctetStringArgument.SetNull(); - arg1List[0].a = 1; - arg1List[0].b = true; - arg1List[0].c = static_cast(3); - arg1List[0].d = chip::ByteSpan(chip::Uint8::from_const_char("second_octet_string"), strlen("second_octet_string")); - arg1List[0].e = chip::Span("second_char_string", strlen("second_char_string")); - arg1List[0].f = static_cast>(1); + return cluster.WriteAttribute( + nullableOctetStringArgument, this, OnSuccessCallback_102, OnFailureCallback_102); + } - arg1List[1].a = 0; - arg1List[1].b = false; - arg1List[1].c = static_cast(2); - arg1List[1].d = chip::ByteSpan(chip::Uint8::from_const_char("first_octet_string"), strlen("first_octet_string")); - arg1List[1].e = chip::Span("first_char_string", strlen("first_char_string")); - arg1List[1].f = static_cast>(1); + void OnFailureResponse_102(uint8_t status) { ThrowFailureResponse(); } - request.arg1 = arg1List; + void OnSuccessResponse_102() { NextTest(); } - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_7(data.value); - }; + CHIP_ERROR TestReadAttributeNullableOctetString_103() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_7(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + return cluster.ReadAttribute( + this, OnSuccessCallback_103, OnFailureCallback_103); } - void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_103(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_7(bool value) + void OnSuccessResponse_103(const chip::app::DataModel::Nullable & nullableOctetString) { - VerifyOrReturn(CheckValue("value", value, false)); + VerifyOrReturn(CheckValueNull("nullableOctetString", nullableOctetString)); NextTest(); } - CHIP_ERROR TestSendTestCommandWithOptionalArgSet_8() + CHIP_ERROR TestWriteAttributeNullableOctetString_104() { chip::Controller::TestClusterClusterTest cluster; cluster.Associate(mDevice, 1); - using requestType = chip::app::Clusters::TestCluster::Commands::TestNullableOptionalRequest::Type; - using responseType = chip::app::Clusters::TestCluster::Commands::TestNullableOptionalResponse::DecodableType; + chip::app::DataModel::Nullable nullableOctetStringArgument; + nullableOctetStringArgument.SetNonNull() = chip::ByteSpan(chip::Uint8::from_const_char(""), strlen("")); - chip::app::Clusters::TestCluster::Commands::TestNullableOptionalRequest::Type request; - request.arg1.Emplace().SetNonNull() = 5; + return cluster.WriteAttribute( + nullableOctetStringArgument, this, OnSuccessCallback_104, OnFailureCallback_104); + } - auto success = [](void * context, const responseType & data) { - (static_cast(context)) - ->OnSuccessResponse_8(data.wasPresent, data.wasNull, data.value, data.originalValue); - }; + void OnFailureResponse_104(uint8_t status) { ThrowFailureResponse(); } - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_8(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + void OnSuccessResponse_104() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableOctetString_105() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_105, OnFailureCallback_105); } - void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_105(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_8(bool wasPresent, const chip::Optional & wasNull, const chip::Optional & value, - const chip::Optional> & originalValue) + void OnSuccessResponse_105(const chip::app::DataModel::Nullable & nullableOctetString) { - VerifyOrReturn(CheckValue("wasPresent", wasPresent, true)); + VerifyOrReturn(CheckValueNonNull("nullableOctetString", nullableOctetString)); + VerifyOrReturn(CheckValueAsString("nullableOctetString.Value()", nullableOctetString.Value(), "")); + NextTest(); + } - VerifyOrReturn(CheckValuePresent("wasNull", wasNull)); - VerifyOrReturn(CheckValue("wasNull.Value()", wasNull.Value(), false)); + CHIP_ERROR TestReadAttributeNullableCharStringDefaultValue_106() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); - VerifyOrReturn(CheckValuePresent("value", value)); - VerifyOrReturn(CheckValue("value.Value()", value.Value(), 5)); + return cluster.ReadAttribute( + this, OnSuccessCallback_106, OnFailureCallback_106); + } - VerifyOrReturn(CheckValuePresent("originalValue", originalValue)); - VerifyOrReturn(CheckValueNonNull("originalValue.Value()", originalValue.Value())); - VerifyOrReturn(CheckValue("originalValue.Value().Value()", originalValue.Value().Value(), 5)); + void OnFailureResponse_106(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_106(const chip::app::DataModel::Nullable & nullableCharString) + { + VerifyOrReturn(CheckValueNonNull("nullableCharString", nullableCharString)); + VerifyOrReturn(CheckValueAsString("nullableCharString.Value()", nullableCharString.Value(), "")); NextTest(); } - CHIP_ERROR TestSendTestCommandWithoutItsOptionalArg_9() + CHIP_ERROR TestWriteAttributeNullableCharString_107() { chip::Controller::TestClusterClusterTest cluster; cluster.Associate(mDevice, 1); - using requestType = chip::app::Clusters::TestCluster::Commands::TestNullableOptionalRequest::Type; - using responseType = chip::app::Clusters::TestCluster::Commands::TestNullableOptionalResponse::DecodableType; + chip::app::DataModel::Nullable nullableCharStringArgument; + nullableCharStringArgument.SetNonNull() = chip::Span("☉T☉", strlen("☉T☉")); - chip::app::Clusters::TestCluster::Commands::TestNullableOptionalRequest::Type request; + return cluster.WriteAttribute( + nullableCharStringArgument, this, OnSuccessCallback_107, OnFailureCallback_107); + } - auto success = [](void * context, const responseType & data) { - (static_cast(context)) - ->OnSuccessResponse_9(data.wasPresent, data.wasNull, data.value, data.originalValue); - }; + void OnFailureResponse_107(uint8_t status) { ThrowFailureResponse(); } - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_9(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + void OnSuccessResponse_107() { NextTest(); } + + CHIP_ERROR TestWriteAttributeNullableCharStringValueTooLong_108() + { + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + chip::app::DataModel::Nullable nullableCharStringArgument; + nullableCharStringArgument.SetNull(); + + return cluster.WriteAttribute( + nullableCharStringArgument, this, OnSuccessCallback_108, OnFailureCallback_108); } - void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_108(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_9(bool wasPresent, const chip::Optional & wasNull, const chip::Optional & value, - const chip::Optional> & originalValue) + void OnSuccessResponse_108() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableCharString_109() { - VerifyOrReturn(CheckValue("wasPresent", wasPresent, false)); + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttribute( + this, OnSuccessCallback_109, OnFailureCallback_109); + } + void OnFailureResponse_109(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_109(const chip::app::DataModel::Nullable & nullableCharString) + { + VerifyOrReturn(CheckValueNull("nullableCharString", nullableCharString)); NextTest(); } - CHIP_ERROR TestSendTestCommandWithOptionalArgSetToNull_10() + CHIP_ERROR TestWriteAttributeNullableCharStringEmpty_110() { chip::Controller::TestClusterClusterTest cluster; cluster.Associate(mDevice, 1); - using requestType = chip::app::Clusters::TestCluster::Commands::TestNullableOptionalRequest::Type; - using responseType = chip::app::Clusters::TestCluster::Commands::TestNullableOptionalResponse::DecodableType; - - chip::app::Clusters::TestCluster::Commands::TestNullableOptionalRequest::Type request; - request.arg1.Emplace().SetNull(); - - auto success = [](void * context, const responseType & data) { - (static_cast(context)) - ->OnSuccessResponse_10(data.wasPresent, data.wasNull, data.value, data.originalValue); - }; + chip::app::DataModel::Nullable nullableCharStringArgument; + nullableCharStringArgument.SetNonNull() = chip::Span("", strlen("")); - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_10(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + return cluster.WriteAttribute( + nullableCharStringArgument, this, OnSuccessCallback_110, OnFailureCallback_110); } - void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_110(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_10(bool wasPresent, const chip::Optional & wasNull, const chip::Optional & value, - const chip::Optional> & originalValue) + void OnSuccessResponse_110() { NextTest(); } + + CHIP_ERROR TestReadAttributeNullableCharString_111() { - VerifyOrReturn(CheckValue("wasPresent", wasPresent, true)); + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevice, 1); - VerifyOrReturn(CheckValuePresent("wasNull", wasNull)); - VerifyOrReturn(CheckValue("wasNull.Value()", wasNull.Value(), true)); + return cluster.ReadAttribute( + this, OnSuccessCallback_111, OnFailureCallback_111); + } - VerifyOrReturn(CheckValuePresent("originalValue", originalValue)); - VerifyOrReturn(CheckValueNull("originalValue.Value()", originalValue.Value())); + void OnFailureResponse_111(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_111(const chip::app::DataModel::Nullable & nullableCharString) + { + VerifyOrReturn(CheckValueNonNull("nullableCharString", nullableCharString)); + VerifyOrReturn(CheckValueAsString("nullableCharString.Value()", nullableCharString.Value(), "")); NextTest(); } }; diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.cpp b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.cpp index 6c671bc1fc8f27..9a15197b9ee204 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.cpp +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.cpp @@ -11926,6 +11926,380 @@ CHIP_ERROR TestClusterCluster::WriteAttributeUnsupported(Callback::Cancelable * return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } +CHIP_ERROR TestClusterCluster::ReadAttributeNullableBoolean(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + app::AttributePathParams attributePath; + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mAttributeId = 0x00008000; + return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, + BasicAttributeFilter); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeNullableBoolean(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, bool value) +{ + app::WriteClientHandle handle; + ReturnErrorOnFailure( + app::InteractionModelEngine::GetInstance()->NewWriteClient(handle, mDevice->GetInteractionModelDelegate())); + ReturnErrorOnFailure(handle.EncodeAttributeWritePayload( + chip::app::AttributePathParams(mEndpoint, mClusterId, TestCluster::Attributes::NullableBoolean::Id), value)); + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeNullableBitmap8(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + app::AttributePathParams attributePath; + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mAttributeId = 0x00008001; + return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, + BasicAttributeFilter); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeNullableBitmap8(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint8_t value) +{ + app::WriteClientHandle handle; + ReturnErrorOnFailure( + app::InteractionModelEngine::GetInstance()->NewWriteClient(handle, mDevice->GetInteractionModelDelegate())); + ReturnErrorOnFailure(handle.EncodeAttributeWritePayload( + chip::app::AttributePathParams(mEndpoint, mClusterId, TestCluster::Attributes::NullableBitmap8::Id), value)); + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeNullableBitmap16(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + app::AttributePathParams attributePath; + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mAttributeId = 0x00008002; + return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, + BasicAttributeFilter); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeNullableBitmap16(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t value) +{ + app::WriteClientHandle handle; + ReturnErrorOnFailure( + app::InteractionModelEngine::GetInstance()->NewWriteClient(handle, mDevice->GetInteractionModelDelegate())); + ReturnErrorOnFailure(handle.EncodeAttributeWritePayload( + chip::app::AttributePathParams(mEndpoint, mClusterId, TestCluster::Attributes::NullableBitmap16::Id), value)); + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeNullableBitmap32(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + app::AttributePathParams attributePath; + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mAttributeId = 0x00008003; + return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, + BasicAttributeFilter); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeNullableBitmap32(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint32_t value) +{ + app::WriteClientHandle handle; + ReturnErrorOnFailure( + app::InteractionModelEngine::GetInstance()->NewWriteClient(handle, mDevice->GetInteractionModelDelegate())); + ReturnErrorOnFailure(handle.EncodeAttributeWritePayload( + chip::app::AttributePathParams(mEndpoint, mClusterId, TestCluster::Attributes::NullableBitmap32::Id), value)); + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeNullableBitmap64(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + app::AttributePathParams attributePath; + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mAttributeId = 0x00008004; + return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, + BasicAttributeFilter); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeNullableBitmap64(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint64_t value) +{ + app::WriteClientHandle handle; + ReturnErrorOnFailure( + app::InteractionModelEngine::GetInstance()->NewWriteClient(handle, mDevice->GetInteractionModelDelegate())); + ReturnErrorOnFailure(handle.EncodeAttributeWritePayload( + chip::app::AttributePathParams(mEndpoint, mClusterId, TestCluster::Attributes::NullableBitmap64::Id), value)); + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeNullableInt8u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + app::AttributePathParams attributePath; + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mAttributeId = 0x00008005; + return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, + BasicAttributeFilter); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeNullableInt8u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint8_t value) +{ + app::WriteClientHandle handle; + ReturnErrorOnFailure( + app::InteractionModelEngine::GetInstance()->NewWriteClient(handle, mDevice->GetInteractionModelDelegate())); + ReturnErrorOnFailure(handle.EncodeAttributeWritePayload( + chip::app::AttributePathParams(mEndpoint, mClusterId, TestCluster::Attributes::NullableInt8u::Id), value)); + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeNullableInt16u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + app::AttributePathParams attributePath; + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mAttributeId = 0x00008006; + return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, + BasicAttributeFilter); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeNullableInt16u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t value) +{ + app::WriteClientHandle handle; + ReturnErrorOnFailure( + app::InteractionModelEngine::GetInstance()->NewWriteClient(handle, mDevice->GetInteractionModelDelegate())); + ReturnErrorOnFailure(handle.EncodeAttributeWritePayload( + chip::app::AttributePathParams(mEndpoint, mClusterId, TestCluster::Attributes::NullableInt16u::Id), value)); + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeNullableInt32u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + app::AttributePathParams attributePath; + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mAttributeId = 0x00008008; + return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, + BasicAttributeFilter); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeNullableInt32u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint32_t value) +{ + app::WriteClientHandle handle; + ReturnErrorOnFailure( + app::InteractionModelEngine::GetInstance()->NewWriteClient(handle, mDevice->GetInteractionModelDelegate())); + ReturnErrorOnFailure(handle.EncodeAttributeWritePayload( + chip::app::AttributePathParams(mEndpoint, mClusterId, TestCluster::Attributes::NullableInt32u::Id), value)); + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeNullableInt64u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + app::AttributePathParams attributePath; + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mAttributeId = 0x0000800C; + return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, + BasicAttributeFilter); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeNullableInt64u(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint64_t value) +{ + app::WriteClientHandle handle; + ReturnErrorOnFailure( + app::InteractionModelEngine::GetInstance()->NewWriteClient(handle, mDevice->GetInteractionModelDelegate())); + ReturnErrorOnFailure(handle.EncodeAttributeWritePayload( + chip::app::AttributePathParams(mEndpoint, mClusterId, TestCluster::Attributes::NullableInt64u::Id), value)); + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeNullableInt8s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + app::AttributePathParams attributePath; + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mAttributeId = 0x0000800D; + return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, + BasicAttributeFilter); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeNullableInt8s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, int8_t value) +{ + app::WriteClientHandle handle; + ReturnErrorOnFailure( + app::InteractionModelEngine::GetInstance()->NewWriteClient(handle, mDevice->GetInteractionModelDelegate())); + ReturnErrorOnFailure(handle.EncodeAttributeWritePayload( + chip::app::AttributePathParams(mEndpoint, mClusterId, TestCluster::Attributes::NullableInt8s::Id), value)); + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeNullableInt16s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + app::AttributePathParams attributePath; + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mAttributeId = 0x0000800E; + return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, + BasicAttributeFilter); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeNullableInt16s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, int16_t value) +{ + app::WriteClientHandle handle; + ReturnErrorOnFailure( + app::InteractionModelEngine::GetInstance()->NewWriteClient(handle, mDevice->GetInteractionModelDelegate())); + ReturnErrorOnFailure(handle.EncodeAttributeWritePayload( + chip::app::AttributePathParams(mEndpoint, mClusterId, TestCluster::Attributes::NullableInt16s::Id), value)); + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeNullableInt32s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + app::AttributePathParams attributePath; + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mAttributeId = 0x00008010; + return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, + BasicAttributeFilter); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeNullableInt32s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, int32_t value) +{ + app::WriteClientHandle handle; + ReturnErrorOnFailure( + app::InteractionModelEngine::GetInstance()->NewWriteClient(handle, mDevice->GetInteractionModelDelegate())); + ReturnErrorOnFailure(handle.EncodeAttributeWritePayload( + chip::app::AttributePathParams(mEndpoint, mClusterId, TestCluster::Attributes::NullableInt32s::Id), value)); + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeNullableInt64s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + app::AttributePathParams attributePath; + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mAttributeId = 0x00008014; + return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, + BasicAttributeFilter); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeNullableInt64s(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, int64_t value) +{ + app::WriteClientHandle handle; + ReturnErrorOnFailure( + app::InteractionModelEngine::GetInstance()->NewWriteClient(handle, mDevice->GetInteractionModelDelegate())); + ReturnErrorOnFailure(handle.EncodeAttributeWritePayload( + chip::app::AttributePathParams(mEndpoint, mClusterId, TestCluster::Attributes::NullableInt64s::Id), value)); + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeNullableEnum8(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + app::AttributePathParams attributePath; + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mAttributeId = 0x00008015; + return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, + BasicAttributeFilter); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeNullableEnum8(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint8_t value) +{ + app::WriteClientHandle handle; + ReturnErrorOnFailure( + app::InteractionModelEngine::GetInstance()->NewWriteClient(handle, mDevice->GetInteractionModelDelegate())); + ReturnErrorOnFailure(handle.EncodeAttributeWritePayload( + chip::app::AttributePathParams(mEndpoint, mClusterId, TestCluster::Attributes::NullableEnum8::Id), value)); + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeNullableEnum16(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + app::AttributePathParams attributePath; + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mAttributeId = 0x00008016; + return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, + BasicAttributeFilter); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeNullableEnum16(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t value) +{ + app::WriteClientHandle handle; + ReturnErrorOnFailure( + app::InteractionModelEngine::GetInstance()->NewWriteClient(handle, mDevice->GetInteractionModelDelegate())); + ReturnErrorOnFailure(handle.EncodeAttributeWritePayload( + chip::app::AttributePathParams(mEndpoint, mClusterId, TestCluster::Attributes::NullableEnum16::Id), value)); + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeNullableOctetString(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + app::AttributePathParams attributePath; + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mAttributeId = 0x00008019; + return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, + BasicAttributeFilter); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeNullableOctetString(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, chip::ByteSpan value) +{ + app::WriteClientHandle handle; + ReturnErrorOnFailure( + app::InteractionModelEngine::GetInstance()->NewWriteClient(handle, mDevice->GetInteractionModelDelegate())); + ReturnErrorOnFailure(handle.EncodeAttributeWritePayload( + chip::app::AttributePathParams(mEndpoint, mClusterId, TestCluster::Attributes::NullableOctetString::Id), value)); + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReadAttributeNullableCharString(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + app::AttributePathParams attributePath; + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mAttributeId = 0x0000801E; + return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, + BasicAttributeFilter); +} + +CHIP_ERROR TestClusterCluster::WriteAttributeNullableCharString(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, chip::CharSpan value) +{ + app::WriteClientHandle handle; + ReturnErrorOnFailure( + app::InteractionModelEngine::GetInstance()->NewWriteClient(handle, mDevice->GetInteractionModelDelegate())); + ReturnErrorOnFailure(handle.EncodeAttributeWritePayload( + chip::app::AttributePathParams(mEndpoint, mClusterId, TestCluster::Attributes::NullableCharString::Id), value)); + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); +} + CHIP_ERROR TestClusterCluster::ReadAttributeClusterRevision(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 72c6c5bf00a1cd..b38723f8612194 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h @@ -1413,6 +1413,23 @@ class DLL_EXPORT TestClusterCluster : public ClusterBase CHIP_ERROR ReadAttributeListNullablesAndOptionalsStruct(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); CHIP_ERROR ReadAttributeUnsupported(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeNullableBoolean(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeNullableBitmap8(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeNullableBitmap16(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeNullableBitmap32(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeNullableBitmap64(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeNullableInt8u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeNullableInt16u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeNullableInt32u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeNullableInt64u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeNullableInt8s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeNullableInt16s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeNullableInt32s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeNullableInt64s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeNullableEnum8(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeNullableEnum16(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeNullableOctetString(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeNullableCharString(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); CHIP_ERROR ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); CHIP_ERROR WriteAttributeBoolean(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, bool value); @@ -1460,6 +1477,40 @@ class DLL_EXPORT TestClusterCluster : public ClusterBase chip::VendorId value); CHIP_ERROR WriteAttributeUnsupported(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, bool value); + CHIP_ERROR WriteAttributeNullableBoolean(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + bool value); + CHIP_ERROR WriteAttributeNullableBitmap8(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t value); + CHIP_ERROR WriteAttributeNullableBitmap16(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t value); + CHIP_ERROR WriteAttributeNullableBitmap32(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint32_t value); + CHIP_ERROR WriteAttributeNullableBitmap64(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint64_t value); + CHIP_ERROR WriteAttributeNullableInt8u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t value); + CHIP_ERROR WriteAttributeNullableInt16u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t value); + CHIP_ERROR WriteAttributeNullableInt32u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint32_t value); + CHIP_ERROR WriteAttributeNullableInt64u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint64_t value); + CHIP_ERROR WriteAttributeNullableInt8s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + int8_t value); + CHIP_ERROR WriteAttributeNullableInt16s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + int16_t value); + CHIP_ERROR WriteAttributeNullableInt32s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + int32_t value); + CHIP_ERROR WriteAttributeNullableInt64s(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + int64_t value); + CHIP_ERROR WriteAttributeNullableEnum8(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t value); + CHIP_ERROR WriteAttributeNullableEnum16(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t value); + CHIP_ERROR WriteAttributeNullableOctetString(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + chip::ByteSpan value); + CHIP_ERROR WriteAttributeNullableCharString(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + chip::CharSpan value); private: };