Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
yunhanw-google committed Jul 13, 2022
1 parent 340bccd commit 73c15dd
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/app/data-model/Decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ template <typename X, typename std::enable_if_t<std::is_enum<X>::value, int> = 0
CHIP_ERROR Decode(TLV::TLVReader & reader, X & x)
{
ReturnErrorOnFailure(reader.Get(x));
x = chip::app::Clusters::EnsureKnownEnumValue(x);
x = Clusters::EnsureKnownEnumValue(x);
return CHIP_NO_ERROR;
}

Expand Down
8 changes: 4 additions & 4 deletions src/app/tests/suites/TestCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2801,8 +2801,8 @@ tests:
command: "readAttribute"
attribute: "nullable_enum_attr"
response:
saveAs: nullableEnumAttr4
value: 4
saveAs: nullableEnumAttr3
value: 3

- label: "Write attribute NULLABLE_SIMPLE_ENUM null Value"
command: "writeAttribute"
Expand All @@ -2816,12 +2816,12 @@ tests:
response:
value: null

- label: "Read attribute NULLABLE_SIMPLE_ENUM not 254 Value"
- label: "Read attribute NULLABLE_SIMPLE_ENUM not 3 Value"
command: "readAttribute"
attribute: "nullable_enum_attr"
response:
constraints:
notValue: nullableEnumAttr4
notValue: nullableEnumAttr3

# Tests for Octet String attribute

Expand Down
1 change: 1 addition & 0 deletions src/app/zap-templates/templates/app/cluster-enums.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ k{{asUpperCamelCase label}} = {{asHex value 2}},
using {{asType label}} = EmberAf{{asType label}};
#endif // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM
{{/if}}
static {{asType label}} k{{asType label}}FirstUnusedEnumVal = static_cast<{{asType label}}>({{first_unused_enum_value mode="first_unused"}});
{{/zcl_enums}}
{{#zcl_bitmaps}}

Expand Down
Loading

0 comments on commit 73c15dd

Please sign in to comment.